lkml.org 
[lkml]   [2015]   [Oct]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 1/2] PM / sleep: ensure deferred probe workqueue is finished in wait_for_device_probe
Date
On Thursday, October 08, 2015 11:57:06 AM Grygorii Strashko wrote:
> Now wait_for_device_probe() waits for currently executing probes to finish,
> but it doesn't take into account deferred probing mechanism. As result,
> nothing prevents deferred probe workqueue to continue probing devices right
> after wait_for_device_probe() is finished.
>
> Hence, lest ensure deferred probe workqueue is finished in

s/lest/let's/

> wait_for_device_probe() before proceeding.
>
> 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>
> ---
> drivers/base/dd.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/base/dd.c b/drivers/base/dd.c
> index be0eb46..98de1a5 100644
> --- a/drivers/base/dd.c
> +++ b/drivers/base/dd.c
> @@ -391,6 +391,10 @@ int driver_probe_done(void)
> */
> void wait_for_device_probe(void)
> {
> + /* wait for the deferred probe workqueue to finish */
> + if (driver_deferred_probe_enable)
> + flush_workqueue(deferred_wq);
> +
> /* wait for the known devices to complete their probing */
> wait_event(probe_waitqueue, atomic_read(&probe_count) == 0);
> async_synchronize_full();

I'm not sure if this is sufficient.

Something may be added to the workqueue right after you've flushed it and
then be reporobed after the wait_event() in theory. Or am I missing anything?

Thanks,
Rafael



\
 
 \ /
  Last update: 2015-10-08 22:41    [W:0.068 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site