Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1263581 > unrolled thread
| Started by | Pavel Machek <pavel@ucw.cz> |
|---|---|
| First post | 2015-11-05 23:20 +0100 |
| Last post | 2015-11-06 23:20 +0100 |
| Articles | 4 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH v2] PM / sleep: prohibit devices probing during suspend/hibernation Pavel Machek <pavel@ucw.cz> - 2015-11-05 23:20 +0100
Re: [PATCH v2] PM / sleep: prohibit devices probing during suspend/hibernation "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-11-06 00:50 +0100
Re: [PATCH v2] PM / sleep: prohibit devices probing during suspend/hibernation Grygorii Strashko <grygorii.strashko@ti.com> - 2015-11-06 11:00 +0100
Re: [PATCH v2] PM / sleep: prohibit devices probing during suspend/hibernation "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-11-06 23:20 +0100
| From | Pavel Machek <pavel@ucw.cz> |
|---|---|
| Date | 2015-11-05 23:20 +0100 |
| Subject | Re: [PATCH v2] PM / sleep: prohibit devices probing during suspend/hibernation |
| Message-ID | <qrB2X-4c0-19@gated-at.bofh.it> |
On Mon 2015-10-19 23:54:24, Grygorii Strashko wrote:
> It is unsafe [1] if probing of devices will happen during suspend or
> hibernation and system behavior will be unpredictable in this case
> (for example: after successful probe the device potentially has a different
> set of PM callbacks than before [2]).
> So, let's prohibit device's probing in dpm_prepare() and defer their
> probes instead. The normal behavior will be restored in dpm_complete().
>
> This patch introduces new DD core APIs:
> device_defer_all_probes_enable()
> It will disable probing of devices and defer their probes.
> device_defer_all_probes_disable()
> It will restore normal behavior and trigger re-probing of deferred
> devices.
>
> [1] https://lkml.org/lkml/2015/9/11/554
> [2] https://lkml.org/lkml/2015/9/15/1039
> Cc: Alan Stern <stern@rowland.harvard.edu>
> Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
> ---
> Changes in v2:
> - DD core API device_defer_all_probes(bool enable) split on two
> void device_defer_all_probes_enable(void);
> void device_defer_all_probes_disable(void);
> - more comments added
>
> Link on v1:
> - https://lkml.org/lkml/2015/10/8/681
>
> drivers/base/base.h | 2 ++
> drivers/base/dd.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++-
> drivers/base/power/main.c | 17 +++++++++++++++++
> 3 files changed, 66 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/base/base.h b/drivers/base/base.h
> index 1782f3a..c332b68 100644
> --- a/drivers/base/base.h
> +++ b/drivers/base/base.h
> @@ -131,6 +131,8 @@ extern void device_remove_groups(struct device *dev,
> extern char *make_class_name(const char *name, struct kobject *kobj);
>
> extern int devres_release_all(struct device *dev);
> +extern void device_defer_all_probes_enable(void);
> +extern void device_defer_all_probes_disable(void);
>
> /* /sys/devices directory */
> extern struct kset *devices_kset;
> diff --git a/drivers/base/dd.c b/drivers/base/dd.c
> index be0eb46..b8d9e70 100644
> --- a/drivers/base/dd.c
> +++ b/drivers/base/dd.c
> @@ -55,6 +55,13 @@ static struct workqueue_struct *deferred_wq;
> static atomic_t deferred_trigger_count = ATOMIC_INIT(0);
>
> /*
> + * In some cases, like suspend to RAM or hibernation, It might be reasonable
> + * to prohibit probing of devices as it could be unsafe.
> + * Once defer_all_probes is true all drivers probes will be forcibly deferred.
> + */
> +static bool defer_all_probes;
> +
> +/*
> * deferred_probe_work_func() - Retry probing devices in the active list.
> */
> static void deferred_probe_work_func(struct work_struct *work)
> @@ -172,6 +179,30 @@ static void driver_deferred_probe_trigger(void)
> }
>
> /**
> + * device_defer_all_probes_enable() - Enable deferring of device's probes
> + *
> + * It will disable probing of devices and defer their probes.
> + */
> +void device_defer_all_probes_enable(void)
> +{
> + defer_all_probes = true;
> + /* sync with probes to avoid races. */
> + wait_for_device_probe();
> +}
device_pause_probing()?
> +/**
> + * device_defer_all_probes_disable() - Disable deferring of device's probes
> + *
> + * It will restore normal behavior and trigger re-probing of deferred
> + * devices.
> + */
Hmm. This is not quite a double negative... but it sounds like one.
device_restart_probing()?
Thanks,
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | "Rafael J. Wysocki" <rjw@rjwysocki.net> |
|---|---|
| Date | 2015-11-06 00:50 +0100 |
| Subject | Re: [PATCH v2] PM / sleep: prohibit devices probing during suspend/hibernation |
| Message-ID | <qrCs3-5az-45@gated-at.bofh.it> |
| In reply to | #1263581 |
On Thursday, November 05, 2015 11:19:03 PM Pavel Machek wrote:
> On Mon 2015-10-19 23:54:24, Grygorii Strashko wrote:
> > It is unsafe [1] if probing of devices will happen during suspend or
> > hibernation and system behavior will be unpredictable in this case
> > (for example: after successful probe the device potentially has a different
> > set of PM callbacks than before [2]).
> > So, let's prohibit device's probing in dpm_prepare() and defer their
> > probes instead. The normal behavior will be restored in dpm_complete().
> >
> > This patch introduces new DD core APIs:
> > device_defer_all_probes_enable()
> > It will disable probing of devices and defer their probes.
> > device_defer_all_probes_disable()
> > It will restore normal behavior and trigger re-probing of deferred
> > devices.
> >
> > [1] https://lkml.org/lkml/2015/9/11/554
> > [2] https://lkml.org/lkml/2015/9/15/1039
> > Cc: Alan Stern <stern@rowland.harvard.edu>
> > Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
> > Cc: Thierry Reding <thierry.reding@gmail.com>
> > Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
> > ---
> > Changes in v2:
> > - DD core API device_defer_all_probes(bool enable) split on two
> > void device_defer_all_probes_enable(void);
> > void device_defer_all_probes_disable(void);
> > - more comments added
> >
> > Link on v1:
> > - https://lkml.org/lkml/2015/10/8/681
> >
> > drivers/base/base.h | 2 ++
> > drivers/base/dd.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++-
> > drivers/base/power/main.c | 17 +++++++++++++++++
> > 3 files changed, 66 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/base/base.h b/drivers/base/base.h
> > index 1782f3a..c332b68 100644
> > --- a/drivers/base/base.h
> > +++ b/drivers/base/base.h
> > @@ -131,6 +131,8 @@ extern void device_remove_groups(struct device *dev,
> > extern char *make_class_name(const char *name, struct kobject *kobj);
> >
> > extern int devres_release_all(struct device *dev);
> > +extern void device_defer_all_probes_enable(void);
> > +extern void device_defer_all_probes_disable(void);
> >
> > /* /sys/devices directory */
> > extern struct kset *devices_kset;
> > diff --git a/drivers/base/dd.c b/drivers/base/dd.c
> > index be0eb46..b8d9e70 100644
> > --- a/drivers/base/dd.c
> > +++ b/drivers/base/dd.c
> > @@ -55,6 +55,13 @@ static struct workqueue_struct *deferred_wq;
> > static atomic_t deferred_trigger_count = ATOMIC_INIT(0);
> >
> > /*
> > + * In some cases, like suspend to RAM or hibernation, It might be reasonable
> > + * to prohibit probing of devices as it could be unsafe.
> > + * Once defer_all_probes is true all drivers probes will be forcibly deferred.
> > + */
> > +static bool defer_all_probes;
> > +
> > +/*
> > * deferred_probe_work_func() - Retry probing devices in the active list.
> > */
> > static void deferred_probe_work_func(struct work_struct *work)
> > @@ -172,6 +179,30 @@ static void driver_deferred_probe_trigger(void)
> > }
> >
> > /**
> > + * device_defer_all_probes_enable() - Enable deferring of device's probes
> > + *
> > + * It will disable probing of devices and defer their probes.
> > + */
> > +void device_defer_all_probes_enable(void)
> > +{
> > + defer_all_probes = true;
> > + /* sync with probes to avoid races. */
> > + wait_for_device_probe();
> > +}
>
> device_pause_probing()?
>
> > +/**
> > + * device_defer_all_probes_disable() - Disable deferring of device's probes
> > + *
> > + * It will restore normal behavior and trigger re-probing of deferred
> > + * devices.
> > + */
>
> Hmm. This is not quite a double negative... but it sounds like one.
>
> device_restart_probing()?
I _start/_stop would be fine by me too.
Thanks,
Rafael
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Grygorii Strashko <grygorii.strashko@ti.com> |
|---|---|
| Date | 2015-11-06 11:00 +0100 |
| Message-ID | <qrLYm-2Oc-29@gated-at.bofh.it> |
| In reply to | #1263636 |
On 11/06/2015 02:13 AM, Rafael J. Wysocki wrote:
> On Thursday, November 05, 2015 11:19:03 PM Pavel Machek wrote:
>> On Mon 2015-10-19 23:54:24, Grygorii Strashko wrote:
>>> It is unsafe [1] if probing of devices will happen during suspend or
>>> hibernation and system behavior will be unpredictable in this case
>>> (for example: after successful probe the device potentially has a different
>>> set of PM callbacks than before [2]).
>>> So, let's prohibit device's probing in dpm_prepare() and defer their
>>> probes instead. The normal behavior will be restored in dpm_complete().
>>>
>>> This patch introduces new DD core APIs:
>>> device_defer_all_probes_enable()
>>> It will disable probing of devices and defer their probes.
>>> device_defer_all_probes_disable()
>>> It will restore normal behavior and trigger re-probing of deferred
>>> devices.
>>>
>>> [1] https://lkml.org/lkml/2015/9/11/554
>>> [2] https://lkml.org/lkml/2015/9/15/1039
>>> Cc: Alan Stern <stern@rowland.harvard.edu>
>>> Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
>>> Cc: Thierry Reding <thierry.reding@gmail.com>
>>> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
>>> ---
>>> Changes in v2:
>>> - DD core API device_defer_all_probes(bool enable) split on two
>>> void device_defer_all_probes_enable(void);
>>> void device_defer_all_probes_disable(void);
>>> - more comments added
>>>
>>> Link on v1:
>>> - https://lkml.org/lkml/2015/10/8/681
>>>
>>> drivers/base/base.h | 2 ++
>>> drivers/base/dd.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++-
>>> drivers/base/power/main.c | 17 +++++++++++++++++
>>> 3 files changed, 66 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/base/base.h b/drivers/base/base.h
>>> index 1782f3a..c332b68 100644
>>> --- a/drivers/base/base.h
>>> +++ b/drivers/base/base.h
>>> @@ -131,6 +131,8 @@ extern void device_remove_groups(struct device *dev,
>>> extern char *make_class_name(const char *name, struct kobject *kobj);
>>>
>>> extern int devres_release_all(struct device *dev);
>>> +extern void device_defer_all_probes_enable(void);
>>> +extern void device_defer_all_probes_disable(void);
>>>
>>> /* /sys/devices directory */
>>> extern struct kset *devices_kset;
>>> diff --git a/drivers/base/dd.c b/drivers/base/dd.c
>>> index be0eb46..b8d9e70 100644
>>> --- a/drivers/base/dd.c
>>> +++ b/drivers/base/dd.c
>>> @@ -55,6 +55,13 @@ static struct workqueue_struct *deferred_wq;
>>> static atomic_t deferred_trigger_count = ATOMIC_INIT(0);
>>>
>>> /*
>>> + * In some cases, like suspend to RAM or hibernation, It might be reasonable
>>> + * to prohibit probing of devices as it could be unsafe.
>>> + * Once defer_all_probes is true all drivers probes will be forcibly deferred.
>>> + */
>>> +static bool defer_all_probes;
>>> +
>>> +/*
>>> * deferred_probe_work_func() - Retry probing devices in the active list.
>>> */
>>> static void deferred_probe_work_func(struct work_struct *work)
>>> @@ -172,6 +179,30 @@ static void driver_deferred_probe_trigger(void)
>>> }
>>>
>>> /**
>>> + * device_defer_all_probes_enable() - Enable deferring of device's probes
>>> + *
>>> + * It will disable probing of devices and defer their probes.
>>> + */
>>> +void device_defer_all_probes_enable(void)
>>> +{
>>> + defer_all_probes = true;
>>> + /* sync with probes to avoid races. */
>>> + wait_for_device_probe();
>>> +}
>>
>> device_pause_probing()?
device_stop_probing(). Right?
>>
>>> +/**
>>> + * device_defer_all_probes_disable() - Disable deferring of device's probes
>>> + *
>>> + * It will restore normal behavior and trigger re-probing of deferred
>>> + * devices.
>>> + */
device_start_probing(). Right?
>>
>> Hmm. This is not quite a double negative... but it sounds like one.
>>
>> device_restart_probing()?
>
> I _start/_stop would be fine by me too.
Ok. So do I need rename/resend it again?
Probably, I'll need to wait for -rc1 before resending.
--
regards,
-grygorii
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | "Rafael J. Wysocki" <rjw@rjwysocki.net> |
|---|---|
| Date | 2015-11-06 23:20 +0100 |
| Subject | Re: [PATCH v2] PM / sleep: prohibit devices probing during suspend/hibernation |
| Message-ID | <qrXwu-25P-17@gated-at.bofh.it> |
| In reply to | #1263877 |
On Friday, November 06, 2015 11:58:40 AM Grygorii Strashko wrote:
> On 11/06/2015 02:13 AM, Rafael J. Wysocki wrote:
> > On Thursday, November 05, 2015 11:19:03 PM Pavel Machek wrote:
> >> On Mon 2015-10-19 23:54:24, Grygorii Strashko wrote:
> >>> It is unsafe [1] if probing of devices will happen during suspend or
> >>> hibernation and system behavior will be unpredictable in this case
> >>> (for example: after successful probe the device potentially has a different
> >>> set of PM callbacks than before [2]).
> >>> So, let's prohibit device's probing in dpm_prepare() and defer their
> >>> probes instead. The normal behavior will be restored in dpm_complete().
> >>>
> >>> This patch introduces new DD core APIs:
> >>> device_defer_all_probes_enable()
> >>> It will disable probing of devices and defer their probes.
> >>> device_defer_all_probes_disable()
> >>> It will restore normal behavior and trigger re-probing of deferred
> >>> devices.
> >>>
> >>> [1] https://lkml.org/lkml/2015/9/11/554
> >>> [2] https://lkml.org/lkml/2015/9/15/1039
> >>> Cc: Alan Stern <stern@rowland.harvard.edu>
> >>> Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
> >>> Cc: Thierry Reding <thierry.reding@gmail.com>
> >>> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
> >>> ---
> >>> Changes in v2:
> >>> - DD core API device_defer_all_probes(bool enable) split on two
> >>> void device_defer_all_probes_enable(void);
> >>> void device_defer_all_probes_disable(void);
> >>> - more comments added
> >>>
> >>> Link on v1:
> >>> - https://lkml.org/lkml/2015/10/8/681
> >>>
> >>> drivers/base/base.h | 2 ++
> >>> drivers/base/dd.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++-
> >>> drivers/base/power/main.c | 17 +++++++++++++++++
> >>> 3 files changed, 66 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/drivers/base/base.h b/drivers/base/base.h
> >>> index 1782f3a..c332b68 100644
> >>> --- a/drivers/base/base.h
> >>> +++ b/drivers/base/base.h
> >>> @@ -131,6 +131,8 @@ extern void device_remove_groups(struct device *dev,
> >>> extern char *make_class_name(const char *name, struct kobject *kobj);
> >>>
> >>> extern int devres_release_all(struct device *dev);
> >>> +extern void device_defer_all_probes_enable(void);
> >>> +extern void device_defer_all_probes_disable(void);
> >>>
> >>> /* /sys/devices directory */
> >>> extern struct kset *devices_kset;
> >>> diff --git a/drivers/base/dd.c b/drivers/base/dd.c
> >>> index be0eb46..b8d9e70 100644
> >>> --- a/drivers/base/dd.c
> >>> +++ b/drivers/base/dd.c
> >>> @@ -55,6 +55,13 @@ static struct workqueue_struct *deferred_wq;
> >>> static atomic_t deferred_trigger_count = ATOMIC_INIT(0);
> >>>
> >>> /*
> >>> + * In some cases, like suspend to RAM or hibernation, It might be reasonable
> >>> + * to prohibit probing of devices as it could be unsafe.
> >>> + * Once defer_all_probes is true all drivers probes will be forcibly deferred.
> >>> + */
> >>> +static bool defer_all_probes;
> >>> +
> >>> +/*
> >>> * deferred_probe_work_func() - Retry probing devices in the active list.
> >>> */
> >>> static void deferred_probe_work_func(struct work_struct *work)
> >>> @@ -172,6 +179,30 @@ static void driver_deferred_probe_trigger(void)
> >>> }
> >>>
> >>> /**
> >>> + * device_defer_all_probes_enable() - Enable deferring of device's probes
> >>> + *
> >>> + * It will disable probing of devices and defer their probes.
> >>> + */
> >>> +void device_defer_all_probes_enable(void)
> >>> +{
> >>> + defer_all_probes = true;
> >>> + /* sync with probes to avoid races. */
> >>> + wait_for_device_probe();
> >>> +}
> >>
> >> device_pause_probing()?
>
> device_stop_probing(). Right?
Or device_block_probing()
> >>
> >>> +/**
> >>> + * device_defer_all_probes_disable() - Disable deferring of device's probes
> >>> + *
> >>> + * It will restore normal behavior and trigger re-probing of deferred
> >>> + * devices.
> >>> + */
>
> device_start_probing(). Right?
and device_unblock_probing()
>
> >>
> >> Hmm. This is not quite a double negative... but it sounds like one.
> >>
> >> device_restart_probing()?
> >
> > I _start/_stop would be fine by me too.
>
> Ok. So do I need rename/resend it again?
Yes, please.
> Probably, I'll need to wait for -rc1 before resending.
No, you don't. Please resend when you're ready.
Thanks,
Rafael
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web