All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Fabio Estevam <festevam@gmail.com>
Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com>,
	Daniel Kurtz <djkurtz@chromium.org>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Russell King <linux@arm.linux.org.uk>,
	Kevin Hilman <khilman@kernel.org>,
	Tony Lindgren <tony@atomide.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	Pavel Machek <pavel@ucw.cz>,
	Tomas Winkler <tomas.winkler@intel.com>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	Len Brown <lenb@kernel.org>
Subject: Re: [PATCH v11 2/4] PM / Domains: add setter for dev.pm_domain
Date: Mon, 11 Jan 2016 15:45:09 +0100	[thread overview]
Message-ID: <2574144.OjYZBRkjZl@vostro.rjw.lan> (raw)
In-Reply-To: <CAOMZO5A7p6iZTdnZtnzMPED1e7rPp=1Q9UiZ_598QNTWSL5jMw@mail.gmail.com>

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@collabora.com> wrote:
> > On 10 November 2015 at 10:33, Daniel Kurtz <djkurtz@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@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@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);
 }
 
 /**


WARNING: multiple messages have this Message-ID (diff)
From: rjw@rjwysocki.net (Rafael J. Wysocki)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v11 2/4] PM / Domains: add setter for dev.pm_domain
Date: Mon, 11 Jan 2016 15:45:09 +0100	[thread overview]
Message-ID: <2574144.OjYZBRkjZl@vostro.rjw.lan> (raw)
In-Reply-To: <CAOMZO5A7p6iZTdnZtnzMPED1e7rPp=1Q9UiZ_598QNTWSL5jMw@mail.gmail.com>

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@collabora.com> wrote:
> > On 10 November 2015 at 10:33, Daniel Kurtz <djkurtz@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@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@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);
 }
 
 /**

  reply	other threads:[~2016-01-11 14:44 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-27 14:38 [PATCH v11 0/4] Allow USB devices to remain runtime-suspended when sleeping Tomeu Vizoso
2015-10-27 14:38 ` Tomeu Vizoso
2015-10-27 14:38 ` [PATCH v11 1/4] device core: add device_is_bound() Tomeu Vizoso
2015-10-27 14:38 ` [PATCH v11 2/4] PM / Domains: add setter for dev.pm_domain Tomeu Vizoso
2015-10-27 14:38   ` Tomeu Vizoso
2015-10-27 14:38   ` Tomeu Vizoso
2015-11-10  9:33   ` Daniel Kurtz
2015-11-10  9:33     ` Daniel Kurtz
2015-11-10  9:33     ` Daniel Kurtz
2016-01-07 14:47     ` Tomeu Vizoso
2016-01-07 14:47       ` Tomeu Vizoso
2016-01-07 14:47       ` Tomeu Vizoso
2016-01-08  0:20       ` Rafael J. Wysocki
2016-01-08  0:20         ` Rafael J. Wysocki
2016-01-08  0:20         ` Rafael J. Wysocki
2016-01-11 14:35       ` Fabio Estevam
2016-01-11 14:35         ` Fabio Estevam
2016-01-11 14:35         ` Fabio Estevam
2016-01-11 14:45         ` Rafael J. Wysocki [this message]
2016-01-11 14:45           ` Rafael J. Wysocki
2016-01-11 14:45           ` Rafael J. Wysocki
2016-01-11 14:52           ` Fabio Estevam
2016-01-11 14:52             ` Fabio Estevam
2016-01-11 14:52             ` Fabio Estevam
2016-01-11 21:09           ` Ulf Hansson
2016-01-11 21:09             ` Ulf Hansson
2016-01-11 21:09             ` Ulf Hansson
2015-10-27 14:38 ` [PATCH v11 3/4] PM / sleep: Go direct_complete if driver has no callbacks Tomeu Vizoso
2015-10-27 14:38 ` [PATCH v11 4/4] USB / PM: Allow USB devices to remain runtime-suspended when sleeping Tomeu Vizoso
2015-11-02  1:50 ` [PATCH v11 0/4] " Rafael J. Wysocki
2015-11-02  1:50   ` Rafael J. Wysocki
2016-01-05  2:27   ` Derek Basehore
2016-01-05  2:27     ` Derek Basehore
2016-01-05 12:48     ` Rafael J. Wysocki
2016-01-05 12:48       ` Rafael J. Wysocki
2016-01-05 23:38       ` dbasehore .
2016-01-05 23:38         ` dbasehore .
2016-01-05 23:38         ` dbasehore .

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2574144.OjYZBRkjZl@vostro.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=djkurtz@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=festevam@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=khilman@kernel.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=pavel@ucw.cz \
    --cc=stern@rowland.harvard.edu \
    --cc=tomas.winkler@intel.com \
    --cc=tomeu.vizoso@collabora.com \
    --cc=tony@atomide.com \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.