From patchwork Mon Jan 11 14:45:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 8004921 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8DC90BEEED for ; Mon, 11 Jan 2016 14:46:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9FCFF201BC for ; Mon, 11 Jan 2016 14:46:35 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 31D1320328 for ; Mon, 11 Jan 2016 14:46:34 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aIdiV-0002k2-Os; Mon, 11 Jan 2016 14:45:07 +0000 Received: from v094114.home.net.pl ([79.96.170.134]) by bombadil.infradead.org with smtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aIdiR-0002Ic-8P for linux-arm-kernel@lists.infradead.org; Mon, 11 Jan 2016 14:45:05 +0000 Received: from cmv19.neoplus.adsl.tpnet.pl (83.31.149.19) (HELO vostro.rjw.lan) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer v0.80) id 0a405a5be7d24803; Mon, 11 Jan 2016 15:44:37 +0100 From: "Rafael J. Wysocki" To: Fabio Estevam Subject: Re: [PATCH v11 2/4] PM / Domains: add setter for dev.pm_domain Date: Mon, 11 Jan 2016 15:45:09 +0100 Message-ID: <2574144.OjYZBRkjZl@vostro.rjw.lan> User-Agent: KMail/4.11.5 (Linux/4.1.0-rc5+; KDE/4.11.5; x86_64; ; ) In-Reply-To: References: <1445956731-6304-1-git-send-email-tomeu.vizoso@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160111_064503_564174_7CB1E9B6 X-CRM114-Status: GOOD ( 26.43 ) X-Spam-Score: -1.9 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , Russell King , Tomeu Vizoso , Kevin Hilman , Tony Lindgren , Greg Kroah-Hartman , "linux-pm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Daniel Kurtz , ACPI Devel Maling List , Alan Stern , dri-devel , Pavel Machek , Tomas Winkler , "linux-omap@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , Len Brown Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Monday, January 11, 2016 12:35:28 PM Fabio Estevam wrote: > On Thu, Jan 7, 2016 at 12:47 PM, Tomeu Vizoso > wrote: > > On 10 November 2015 at 10:33, Daniel Kurtz wrote: > > [snip] > >> > >> The problem appears to be that: > >> * On boot, platform_drv_probe() calls dev_pm_domain_attach() before > >> drv->probe(); thus, it calls dev_pm_domain_attach() while the device > >> is unbound. > >> > >> * However, for a platform_device, the reboot path calls > >> device_shutdown(), but not __device_release_driver(): > >> device_shutdown() > >> dev->driver->shutdown => platform_drv_shutdown() > >> dev_pm_domain_detach() > >> dev->pm_domain->detach() => genpd_dev_pm_detach() > >> pm_genpd_remove_device() > >> dev_pm_domain_set(dev, NULL); > >> > >> So, for a platform_device in a genpd power domain with .shutdown > >> installed, platform_drv_shutdown() calls dev_pm_domain_detach() while > >> the device is still bound, which triggers the WARN(). > > > > Hi Rafael, Alan and Ulf, > > > > do you have any suggestion about this? I don't really understand why > > the device is detached from the domain on shutdown. > > I am running linux-next and this commit causes the same problem for me > on a mx6 after running a 'reboot' command: > > Requesting system reboot > [ 15.058782] ------------[ cut here ]------------ > [ 15.063459] WARNING: CPU: 3 PID: 1122 at > drivers/base/power/common.c:150 dev_pm_domain_set+0x4c/0x58() > [ 15.072838] PM domains can only be changed for unbound devices > [ 15.078735] Modules linked in: > [ 15.081849] CPU: 3 PID: 1122 Comm: init Not tainted > 4.4.0-rc8-next-20160111-dirty #207 > [ 15.089826] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree) > [ 15.096375] Backtrace: > [ 15.098941] [] (dump_backtrace) from [] > (show_stack+0x18/0x1c) > [ 15.106532] r6:00000096 r5:00000000 r4:00000000 r3:00000000 > [ 15.112390] [] (show_stack) from [] > (dump_stack+0x88/0xa4) > [ 15.119708] [] (dump_stack) from [] > (warn_slowpath_common+0x80/0xbc) > [ 15.127860] r5:c03da810 r4:ee63bd68 > [ 15.131533] [] (warn_slowpath_common) from [] > (warn_slowpath_fmt+0x38/0x40) > [ 15.140292] r8:eea01db0 r7:c0b0f87c r6:eea01d80 r5:00000000 r4:ef181410 > [ 15.147165] [] (warn_slowpath_fmt) from [] > (dev_pm_domain_set+0x4c/0x58) > [ 15.155661] r3:c0b0f7f0 r2:c09e82dc > [ 15.159373] [] (dev_pm_domain_set) from [] > (genpd_free_dev_data+0x20/0x50) > [ 15.168065] r5:ef1814a0 r4:ef181410 > [ 15.171737] [] (genpd_free_dev_data) from [] > (pm_genpd_remove_device+0xb4/0xe0) > [ 15.180842] r6:ef181410 r5:eea01d80 r4:c0b0f7f0 r3:00000000 > [ 15.186644] [] (pm_genpd_remove_device) from [] > (genpd_dev_pm_detach+0x30/0xac) > [ 15.195743] r8:c0b0f7f0 r7:c1379734 r6:00000001 r5:c0b209c4 > r4:ef181410 r3:00000000 > [ 15.203694] [] (genpd_dev_pm_detach) from [] > (dev_pm_domain_detach+0x28/0x2c) > [ 15.212621] r10:ef181444 r8:c0b6f560 r7:c1379734 r6:ef181410 > r5:ef173c10 r4:ef181410 > [ 15.220683] [] (dev_pm_domain_detach) from [] > (platform_drv_shutdown+0x34/0x38) > [ 15.229817] [] (platform_drv_shutdown) from [] > (device_shutdown+0x3c/0x194) OK, so does the appended patch help? Rafael Tested-by: Fabio Estevam Acked-by: Ulf Hansson --- From: Rafael J. Wysocki Subject: [PATCH] platform: Do not detach from PM domains on shutdown Shutdown is carried out when the driver is still bound to the device, so it is incorrect to detach it from a PM domain (if any) at this point. Signed-off-by: Rafael J. Wysocki --- drivers/base/platform.c | 1 - 1 file changed, 1 deletion(-) Index: linux-pm/drivers/base/platform.c =================================================================== --- linux-pm.orig/drivers/base/platform.c +++ linux-pm/drivers/base/platform.c @@ -577,7 +577,6 @@ static void platform_drv_shutdown(struct if (drv->shutdown) drv->shutdown(dev); - dev_pm_domain_detach(_dev, true); } /**