[PATCH v11 2/4] PM / Domains: add setter for dev.pm_domain

Rafael J. Wysocki rjw at rjwysocki.net
Mon Jan 11 06:45:09 PST 2016


On Monday, January 11, 2016 12:35:28 PM Fabio Estevam wrote:
> On Thu, Jan 7, 2016 at 12:47 PM, Tomeu Vizoso
> <tomeu.vizoso at collabora.com> wrote:
> > On 10 November 2015 at 10:33, Daniel Kurtz <djkurtz at chromium.org> 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] [<c00136d8>] (dump_backtrace) from [<c0013874>]
> (show_stack+0x18/0x1c)
> [   15.106532]  r6:00000096 r5:00000000 r4:00000000 r3:00000000
> [   15.112390] [<c001385c>] (show_stack) from [<c02de89c>]
> (dump_stack+0x88/0xa4)
> [   15.119708] [<c02de814>] (dump_stack) from [<c002bcac>]
> (warn_slowpath_common+0x80/0xbc)
> [   15.127860]  r5:c03da810 r4:ee63bd68
> [   15.131533] [<c002bc2c>] (warn_slowpath_common) from [<c002bd8c>]
> (warn_slowpath_fmt+0x38/0x40)
> [   15.140292]  r8:eea01db0 r7:c0b0f87c r6:eea01d80 r5:00000000 r4:ef181410
> [   15.147165] [<c002bd58>] (warn_slowpath_fmt) from [<c03da810>]
> (dev_pm_domain_set+0x4c/0x58)
> [   15.155661]  r3:c0b0f7f0 r2:c09e82dc
> [   15.159373] [<c03da7c4>] (dev_pm_domain_set) from [<c03e4e5c>]
> (genpd_free_dev_data+0x20/0x50)
> [   15.168065]  r5:ef1814a0 r4:ef181410
> [   15.171737] [<c03e4e3c>] (genpd_free_dev_data) from [<c03e5fe4>]
> (pm_genpd_remove_device+0xb4/0xe0)
> [   15.180842]  r6:ef181410 r5:eea01d80 r4:c0b0f7f0 r3:00000000
> [   15.186644] [<c03e5f30>] (pm_genpd_remove_device) from [<c03e6040>]
> (genpd_dev_pm_detach+0x30/0xac)
> [   15.195743]  r8:c0b0f7f0 r7:c1379734 r6:00000001 r5:c0b209c4
> r4:ef181410 r3:00000000
> [   15.203694] [<c03e6010>] (genpd_dev_pm_detach) from [<c03da7c0>]
> (dev_pm_domain_detach+0x28/0x2c)
> [   15.212621]  r10:ef181444 r8:c0b6f560 r7:c1379734 r6:ef181410
> r5:ef173c10 r4:ef181410
> [   15.220683] [<c03da798>] (dev_pm_domain_detach) from [<c03d3ea0>]
> (platform_drv_shutdown+0x34/0x38)
> [   15.229817] [<c03d3e6c>] (platform_drv_shutdown) from [<c03d05b0>]
> (device_shutdown+0x3c/0x194)

OK, so does the appended patch help?

Rafael

---
From: Rafael J. Wysocki <rafael.j.wysocki at intel.com>
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 <rafael.j.wysocki at intel.com>
---
 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);
 }
 
 /**



More information about the dri-devel mailing list