All of lore.kernel.org
 help / color / mirror / Atom feed
From: Grygorii Strashko <grygorii.strashko@ti.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Thierry Reding <thierry.reding@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Tomeu Vizoso <tomeu.vizoso@collabora.com>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] driver core: Ensure proper suspend/resume ordering
Date: Wed, 16 Sep 2015 16:38:07 +0300	[thread overview]
Message-ID: <55F970BF.2050107@ti.com> (raw)
In-Reply-To: <2849486.q7QWJNfWm1@vostro.rjw.lan>

On 09/16/2015 04:18 AM, Rafael J. Wysocki wrote:
> On Tuesday, September 15, 2015 05:53:02 PM Thierry Reding wrote:
>> On Sat, Sep 12, 2015 at 12:38:19AM +0200, Rafael J. Wysocki wrote:
>>> On Friday, September 11, 2015 02:03:46 PM Thierry Reding wrote:
>>>> On Fri, Sep 11, 2015 at 12:08:02AM +0200, Rafael J. Wysocki wrote:
>>>>> On Thursday, September 10, 2015 12:19:03 PM Thierry Reding wrote:
>>>>>> From: Thierry Reding <treding@nvidia.com>
>>>>>> =3D20
>>>>>> Deferred probe can lead to strange situations where a device that i=
>> s a
>>>>>> dependency for others will be moved to the end of the dpm_list. At =
>> the
>>>>>> same time the dependers may not be moved because at the time they w=
>> ill
>>>>>> be probed the dependee may already have been successfully reprobed =
>> and
>>>>>> they will not have to defer the probe themselves.
>>>>> =3D20
>>>>> So there's a bug in the implementation of deferred probing IMO.
>>>> =20
>>>> Well, yeah. The root problem here is that we don't have dependency
>>>> information and deferred probing is supposed to fix that. It does so
>>>> fairly well, but it breaks in this particular case.
>>>> =20
>>>>>> One example where this happens is the Jetson TK1 board (Tegra124). =
>> The
>>>>>> gpio-keys driver exposes the power key of the board as an input dev=
>> ice
>>>>>> that can also be used as a wakeup source. Commit 17cdddf0fb68 ("ARM:
>>>>>> tegra: Add gpio-ranges property") results in the gpio-tegra driver
>>>>>> deferring probe because one of its dependencies, the pinctrl-tegra
>>>>>> driver, has not successfully completed probing. Currently the defer=
>> red
>>>>>> probe code will move the corresponding gpio-tegra device to the end=
>>   of
>>>>>> the dpm_list, but by the time the gpio-keys device, depending on the
>>>>>> gpio-tegra device, is probed, gpio-tegra has already been reprobed,=
>>   so
>>>>>> the gpio-keys device is not moved to the end of dpm_list itself.
>>> =20
>>> At this point, when checking its dependencies, gpio-keys should also check
>>> if their ordering with respect to it in dpm_list is correct and move itse=
>> lf
>>> to the end of it otherwise.
>>> =20
>>> There might be a helper for that I suppose.
>>
>> But that's essentially the same thing as what this patch proposes,
>> except that every driver now needs to call this helper, rather than
>> having the core take care of it.
>
> Well, not quite.  Not "every driver", but "every driver with dependencies
> the driver core doesn't know about".  That's quite a difference in my view.
>
> [...]
>
>>> I'm always cautious about changes that make the core do something for eve=
>> ry
>>> device/driver, because they are very likely to step on corner cases that =
>> we
>>> don't need to worry about otherwise.
>>
>> To me this seems more like a fundamental issue that should be fixed at
>> the root rather than be fixed up case by case as we find them. Keeping
>> the suspend/resume order the same as probe order sounds like the most
>> logical thing to do. I grant you that there could be cases where this
>> might break, but then I'd consider those cases to be broken rather than
>> the other way around.
>
> We have to disagree, then.
>
>> With the current situation potentially every user of GPIOs (and the same
>> is true for other types of resources) is broken, though we may not
>> notice (immediately). In fact it was mostly by coincidence that I
>> noticed in this case. The GPIO key works perfectly fine for regular use,
>> it just doesn't work as a wakeup source anymore. That's not something
>> that people test very frequently, hence could've gone unnoticed for much
>> longer.
>>
>> Of course reordering the dpm_list to follow the probe order has the
>> potential to break other setups in similarily subtle ways, so I do
>> understand your reluctance.
>>
>> Perhaps it would help if we put this patch into some boot farm to get
>> more coverage, maybe that would give us a better picture for how
>> invasive the change is, or how bad the fallout could be?
>
> I'd actually prefer to have a patch that I don't have to worry about
> even in theory.
>
> What about an opt-in mechanism for things that are likely to need this
> stuff instead of imposing it on everybody unconditionally?
>
>> I can of course go and come up with a more ad-hoc solution that fixes
>> the issue for this particular use-case, but I'd like to avoid a
>> situation where we end up having to patch up drivers one by one, when
>> we could have a solution that works in the general case.
>>
>> Also note that a recent commit (52cdbdd49853 "driver core: correct
>> device's shutdown order") patch already made an equivalent change to the
>> shutdown order. I'd expect that most devices would fail with that patch
>> already if ordering is a real problem. Of course shutdown is a one-way
>> ticket, so failure might not be as relevant as for suspend/resume.

It was in linux-next for at about one month or more.

>
> Did you forget about the other Alan's concerns regarding probing devices
> during suspend/resume?
>
>> Grygorii, Greg: have you heard of any fallout caused by the above patch
>> yet?

no

>
> Did that patch manipulate dpm_list?

no.

-- 
regards,
-grygorii

WARNING: multiple messages have this Message-ID (diff)
From: Grygorii Strashko <grygorii.strashko@ti.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Thierry Reding <thierry.reding@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Tomeu Vizoso <tomeu.vizoso@collabora.com>,
	<linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] driver core: Ensure proper suspend/resume ordering
Date: Wed, 16 Sep 2015 16:38:07 +0300	[thread overview]
Message-ID: <55F970BF.2050107@ti.com> (raw)
In-Reply-To: <2849486.q7QWJNfWm1@vostro.rjw.lan>

On 09/16/2015 04:18 AM, Rafael J. Wysocki wrote:
> On Tuesday, September 15, 2015 05:53:02 PM Thierry Reding wrote:
>> On Sat, Sep 12, 2015 at 12:38:19AM +0200, Rafael J. Wysocki wrote:
>>> On Friday, September 11, 2015 02:03:46 PM Thierry Reding wrote:
>>>> On Fri, Sep 11, 2015 at 12:08:02AM +0200, Rafael J. Wysocki wrote:
>>>>> On Thursday, September 10, 2015 12:19:03 PM Thierry Reding wrote:
>>>>>> From: Thierry Reding <treding@nvidia.com>
>>>>>> =3D20
>>>>>> Deferred probe can lead to strange situations where a device that i=
>> s a
>>>>>> dependency for others will be moved to the end of the dpm_list. At =
>> the
>>>>>> same time the dependers may not be moved because at the time they w=
>> ill
>>>>>> be probed the dependee may already have been successfully reprobed =
>> and
>>>>>> they will not have to defer the probe themselves.
>>>>> =3D20
>>>>> So there's a bug in the implementation of deferred probing IMO.
>>>> =20
>>>> Well, yeah. The root problem here is that we don't have dependency
>>>> information and deferred probing is supposed to fix that. It does so
>>>> fairly well, but it breaks in this particular case.
>>>> =20
>>>>>> One example where this happens is the Jetson TK1 board (Tegra124). =
>> The
>>>>>> gpio-keys driver exposes the power key of the board as an input dev=
>> ice
>>>>>> that can also be used as a wakeup source. Commit 17cdddf0fb68 ("ARM:
>>>>>> tegra: Add gpio-ranges property") results in the gpio-tegra driver
>>>>>> deferring probe because one of its dependencies, the pinctrl-tegra
>>>>>> driver, has not successfully completed probing. Currently the defer=
>> red
>>>>>> probe code will move the corresponding gpio-tegra device to the end=
>>   of
>>>>>> the dpm_list, but by the time the gpio-keys device, depending on the
>>>>>> gpio-tegra device, is probed, gpio-tegra has already been reprobed,=
>>   so
>>>>>> the gpio-keys device is not moved to the end of dpm_list itself.
>>> =20
>>> At this point, when checking its dependencies, gpio-keys should also check
>>> if their ordering with respect to it in dpm_list is correct and move itse=
>> lf
>>> to the end of it otherwise.
>>> =20
>>> There might be a helper for that I suppose.
>>
>> But that's essentially the same thing as what this patch proposes,
>> except that every driver now needs to call this helper, rather than
>> having the core take care of it.
>
> Well, not quite.  Not "every driver", but "every driver with dependencies
> the driver core doesn't know about".  That's quite a difference in my view.
>
> [...]
>
>>> I'm always cautious about changes that make the core do something for eve=
>> ry
>>> device/driver, because they are very likely to step on corner cases that =
>> we
>>> don't need to worry about otherwise.
>>
>> To me this seems more like a fundamental issue that should be fixed at
>> the root rather than be fixed up case by case as we find them. Keeping
>> the suspend/resume order the same as probe order sounds like the most
>> logical thing to do. I grant you that there could be cases where this
>> might break, but then I'd consider those cases to be broken rather than
>> the other way around.
>
> We have to disagree, then.
>
>> With the current situation potentially every user of GPIOs (and the same
>> is true for other types of resources) is broken, though we may not
>> notice (immediately). In fact it was mostly by coincidence that I
>> noticed in this case. The GPIO key works perfectly fine for regular use,
>> it just doesn't work as a wakeup source anymore. That's not something
>> that people test very frequently, hence could've gone unnoticed for much
>> longer.
>>
>> Of course reordering the dpm_list to follow the probe order has the
>> potential to break other setups in similarily subtle ways, so I do
>> understand your reluctance.
>>
>> Perhaps it would help if we put this patch into some boot farm to get
>> more coverage, maybe that would give us a better picture for how
>> invasive the change is, or how bad the fallout could be?
>
> I'd actually prefer to have a patch that I don't have to worry about
> even in theory.
>
> What about an opt-in mechanism for things that are likely to need this
> stuff instead of imposing it on everybody unconditionally?
>
>> I can of course go and come up with a more ad-hoc solution that fixes
>> the issue for this particular use-case, but I'd like to avoid a
>> situation where we end up having to patch up drivers one by one, when
>> we could have a solution that works in the general case.
>>
>> Also note that a recent commit (52cdbdd49853 "driver core: correct
>> device's shutdown order") patch already made an equivalent change to the
>> shutdown order. I'd expect that most devices would fail with that patch
>> already if ordering is a real problem. Of course shutdown is a one-way
>> ticket, so failure might not be as relevant as for suspend/resume.

It was in linux-next for at about one month or more.

>
> Did you forget about the other Alan's concerns regarding probing devices
> during suspend/resume?
>
>> Grygorii, Greg: have you heard of any fallout caused by the above patch
>> yet?

no

>
> Did that patch manipulate dpm_list?

no.

-- 
regards,
-grygorii

  reply	other threads:[~2015-09-16 13:38 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-10 10:19 [PATCH] driver core: Ensure proper suspend/resume ordering Thierry Reding
2015-09-10 10:58 ` Grygorii Strashko
2015-09-10 10:58   ` Grygorii Strashko
2015-09-10 22:08 ` Rafael J. Wysocki
2015-09-11 12:03   ` Thierry Reding
2015-09-11 19:01     ` Alan Stern
2015-09-11 19:01       ` Alan Stern
2015-09-11 22:28       ` Rafael J. Wysocki
2015-09-12 17:40         ` Alan Stern
2015-09-12 17:40           ` Alan Stern
2015-09-15  0:40           ` Rafael J. Wysocki
2015-09-15 14:23             ` Alan Stern
2015-09-16  1:04               ` Rafael J. Wysocki
2015-09-16 13:39         ` Grygorii Strashko
2015-09-16 13:39           ` Grygorii Strashko
2015-09-16 19:27           ` Alan Stern
2015-09-16 19:27             ` Alan Stern
2015-09-17  0:07             ` Rafael J. Wysocki
2015-09-17 15:48               ` Grygorii Strashko
2015-09-17 15:48                 ` Grygorii Strashko
2015-09-17 23:59                 ` Rafael J. Wysocki
2015-09-18  0:03                   ` Rafael J. Wysocki
2015-10-01 18:14                   ` Grygorii Strashko
2015-09-15 16:10       ` Thierry Reding
2015-09-15 19:18         ` Alan Stern
2015-09-15 19:18           ` Alan Stern
2015-09-16  1:28           ` Rafael J. Wysocki
2015-09-16 13:38             ` Grygorii Strashko
2015-09-16 13:38               ` Grygorii Strashko
2015-09-16 16:58               ` Alan Stern
2015-09-16 16:58                 ` Alan Stern
2015-09-16 17:08             ` Alan Stern
2015-09-16 17:08               ` Alan Stern
2015-09-16 13:16           ` Thierry Reding
2015-09-16 19:22             ` Alan Stern
2015-09-16 19:22               ` Alan Stern
2015-09-17  0:27               ` Rafael J. Wysocki
2015-09-17  2:04                 ` Rafael J. Wysocki
2015-09-17 17:02                   ` Alan Stern
2015-09-17 18:43                     ` Rafael J. Wysocki
2015-09-17 21:06                       ` Alan Stern
2015-09-18  0:13                         ` Rafael J. Wysocki
2015-09-18 15:55                       ` Thierry Reding
2015-09-18 23:07                         ` Rafael J. Wysocki
2015-09-21  8:51                           ` Thierry Reding
2015-09-21 14:34                             ` Alan Stern
2015-09-22  0:26                               ` Rafael J. Wysocki
2015-09-22  1:22                                 ` Alan Stern
2015-09-22  0:39                             ` Rafael J. Wysocki
2015-09-17  5:40                 ` Tomeu Vizoso
2015-09-17 18:15                   ` Rafael J. Wysocki
2015-09-17 19:21                     ` Alan Stern
2015-09-11 22:38     ` Rafael J. Wysocki
2015-09-15 15:53       ` Thierry Reding
2015-09-16  1:18         ` Rafael J. Wysocki
2015-09-16 13:38           ` Grygorii Strashko [this message]
2015-09-16 13:38             ` Grygorii Strashko
2015-09-17  0:55             ` Rafael J. Wysocki
2015-09-11 14:05   ` Alan Stern
2015-09-11 14:05     ` Alan Stern

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=55F970BF.2050107@ti.com \
    --to=grygorii.strashko@ti.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=rjw@rjwysocki.net \
    --cc=stern@rowland.harvard.edu \
    --cc=thierry.reding@gmail.com \
    --cc=tomeu.vizoso@collabora.com \
    /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.