Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp7465509ybn; Mon, 30 Sep 2019 14:25:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqxm1zdPSSTVNwNw+he5NHqQML2YoWQFOAsMtZB/Gp44X4M/IZULFXdow+mfpof9x5FMb0YL X-Received: by 2002:a17:906:4d0f:: with SMTP id r15mr21312982eju.147.1569878702300; Mon, 30 Sep 2019 14:25:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569878702; cv=none; d=google.com; s=arc-20160816; b=nIvKixoi2uFU6Z9OE/hzQj6N8eXL1P8QMyMgkXKHf8nT/oroFKezvS1Tt2/9+MFqfy a53DkTiweTMsLJLszZN6w8lmC409m1jPOzd/mbGGwIRo9nyKGPCJBpWiwJmmTp6R4uv/ GuIl3hpWum+6/Xc0T1VYknRonKRsthxkYfWyOX57oSKLAXU1rlaNV3pwi7dQR5nlkvjl CULigbftId2+FSNG6pNuLsvHB7V17LPmj32CcSWSvkaNr0QReOnW7kjXjwwAezB5IwsN 4pqWdwZRL2/RxGppEbrU6XB+1k/jMmARKM/A3qlpuU820Y+K434ZhK8JRIEzvAvOAEcu 9DMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=wwO3LKMH46pvv0bC8x8eV217XsJBNp2LC9T/6N0lajk=; b=0funPahKwbUKwAnRvHJUq319qE4b2AuPe9dptlGDL4QwJJ+fTK5ya1TRWvEFUFJgs+ yOfbl+LXim7lbVIp0qVqsuC/GunThWOCmidlfBtjagloms+gq3z7IWSQTaqvgHqTjFbN Load9rSC1Uj9Fszm32CGFXklbZ6r/0r9binJ64pngJs0jCkUzw2sO3oqp+JsDOrj374g DiBtqwSYoFmx4rxl1HsVXyiO3NnVOaWQdp3eeZagZCqfjkmN4yh/jMV4ahtUJoJXqlHt daUPRLXH35lk4ByS/aXdQ3AOOLKRCP3wfrdwwTsZEGOEgrbbQ0Z59zxelHnk3tmseA07 7iKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lentin.co.uk header.s=budgerigar header.b=SPTGolhE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q25si8182253edb.159.2019.09.30.14.24.37; Mon, 30 Sep 2019 14:25:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@lentin.co.uk header.s=budgerigar header.b=SPTGolhE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732481AbfI3VXe (ORCPT + 99 others); Mon, 30 Sep 2019 17:23:34 -0400 Received: from marmot.wormnet.eu ([188.246.204.87]:42046 "EHLO marmot.wormnet.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726784AbfI3VXd (ORCPT ); Mon, 30 Sep 2019 17:23:33 -0400 X-Greylist: delayed 1800 seconds by postgrey-1.27 at vger.kernel.org; Mon, 30 Sep 2019 17:23:32 EDT DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lentin.co.uk; s=budgerigar; h=Content-Type:MIME-Version:References: Message-ID:In-Reply-To:Subject:cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=wwO3LKMH46pvv0bC8x8eV217XsJBNp2LC9T/6N0lajk=; b=SPTGolhEBz8cT6g6z06+BIWKo s5GIK38N9GfBmNBfGFXPuuHBKRonTencUPiNWCQeZXIQtNcFcnQwPpoGcxa2ByNfUzSCO0jPnilmj 2xoeIKa0bg5jEuljsq/C7QOLv2x9y7fcdLcopucWoexdaLaAT7ZeO0AwLTCu4hqjgaDLs=; Received: from [31.146.104.22] (helo=[192.168.0.100]) by marmot.wormnet.eu with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.2) (envelope-from ) id 1iF1ZW-0006jM-GN; Mon, 30 Sep 2019 20:43:02 +0100 Date: Mon, 30 Sep 2019 20:42:53 +0100 (BST) From: Jamie Lentin X-X-Sender: lentinj@clifford.vandergast.wormnet.eu To: Andrew Lunn cc: Oleksandr Suvorov , "linux-kernel@vger.kernel.org" , Marcel Ziswiler , "linux-pm@vger.kernel.org" , Igor Opaniuk , "devicetree@vger.kernel.org" , Sebastian Reichel , Rob Herring , Mark Rutland Subject: Re: [PATCH 0/2] This patch introduces a feature to force gpio-poweroff module In-Reply-To: <20190930163203.GC15343@lunn.ch> Message-ID: References: <20190930103531.13764-1-oleksandr.suvorov@toradex.com> <20190930121440.GC13301@lunn.ch> <20190930163203.GC15343@lunn.ch> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 30 Sep 2019, Andrew Lunn wrote: > On Mon, Sep 30, 2019 at 02:11:59PM +0000, Oleksandr Suvorov wrote: >> Hi Andrew, >> >> On Mon, Sep 30, 2019 at 3:16 PM Andrew Lunn wrote: >>> >>> On Mon, Sep 30, 2019 at 10:35:36AM +0000, Oleksandr Suvorov wrote: >>>> to register its own pm_power_off handler even if someone has registered >>>> this handler earlier. >>>> Useful to change a way to power off the system using DT files. >>> >>> Hi Oleksandr >>> >>> I'm not sure this is a good idea. What happens when there are two >>> drivers using forced mode? You then get which ever is register last. >>> Non deterministic behaviour. >> >> You're right, we have to handle a case when gpio-poweroff fails to >> power the system off. Please look at the >> 2nd version of the patchset. >> >> There are 3 only drivers that forcibly register its own pm_power_off >> handler even if it has been registered before. >> >> drivers/firmware/efi/reboot.c - supports chained call of next >> pm_power_off handler if its own handler fails. >> >> arch/x86/platform/iris/iris.c, drivers/char/ipmi/ipmi_poweroff.c - >> don't support calling of next pm_power_off handler. >> Looks like these drivers should be fixed too. >> >> All other drivers don't change already initialized pm_power_off handler. >> >>> What is the other driver which is causing you problems? How is it >>> getting probed? DT? >> >> There are several PMUs, RTCs, watchdogs that register their own pm_power_off. >> Most of them, probably not all, are probed from DT. > > And which specific one is causing you problems. > > I don't like this forced parameter. No other driver is using it. > > Maybe we should change this driver to support chained pm_power_off > handlers? There's still scope for non-deterministic behaviour though, as the chaining would take place depending on the probe ordering. Admittedly if the gpio-poweroff works it's unlikely to be a problem, but still seems messy. Without knowing specifics, disabling the devices that can't turn the device off seems like a better bet. If they'd be otherwise useful, I see there's a of_device_is_system_power_controller(), see: /Documentation/devicetree/bindings/power/power-controller.txt https://elixir.bootlin.com/linux/latest/source/drivers/mfd/max77620.c#L566 ...maybe that can be added to the devices getting in the way? Cheers, [0] https://elixir.bootlin.com/linux/latest/source/drivers/watchdog/bcm2835_wdt.c#L152 (chosen at random) > > Andrew > -- Jamie Lentin