Re: [PATCH 7/9] PM: Add suspend blocking work.

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Arve Hjønnevåg
Date: Friday, April 23, 2010 - 3:49 pm

On Fri, Apr 23, 2010 at 5:20 AM, Oleg Nesterov <oleg@redhat.com> wrote:

I want the suspend blocker active when the work is pending or running.
I did not see a way to do this on top of the workqueue api without
adding additional locking.


Calling suspend_unblock() twice is not a problem as long as
"unblocked" is the expected final state.


OK.


If the work is both queued and starts running on another workqueue
between "get_wq_data(work) == cwq" and "!work_pending(work)", then
suspend_unblock will be called when it shouldn't. It should work fine
if I change to it check pending first though, since it cannot move
back to the current workqueue without locking cwq->lock first.

Or are you talking about the race when the callback is running on
multiple (cpu) workqueues at the same time. In that case the suspend
blocker is released when the callback returns from the last workqueue
is was queued on, not when all the callbacks have returned. On that
note, is it ever safe to use flush_work and cancel_work_sync for work
queues on anything other than a single single threaded workqueue?

-- 
Arve Hjønnevåg
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/9] Suspend block api (version 4), =?UTF-8?q?Arve=20Hj= ..., (Thu Apr 22, 6:08 pm)
[PATCH 1/9] PM: Add suspend block api., =?UTF-8?q?Arve=20Hj= ..., (Thu Apr 22, 6:08 pm)
[PATCH 2/9] PM: suspend_block: Add driver to access suspen ..., =?UTF-8?q?Arve=20Hj= ..., (Thu Apr 22, 6:08 pm)
[PATCH 3/9] PM: suspend_block: Abort task freezing if a su ..., =?UTF-8?q?Arve=20Hj= ..., (Thu Apr 22, 6:08 pm)
[PATCH 4/9] PM: suspend_block: Switch to list of active an ..., =?UTF-8?q?Arve=20Hj= ..., (Thu Apr 22, 6:08 pm)
[PATCH 5/9] PM: suspend_block: Add debugfs file, =?UTF-8?q?Arve=20Hj= ..., (Thu Apr 22, 6:08 pm)
[PATCH 6/9] PM: suspend_block: Add suspend_blocker stats, =?UTF-8?q?Arve=20Hj= ..., (Thu Apr 22, 6:08 pm)
[PATCH 7/9] PM: Add suspend blocking work., =?UTF-8?q?Arve=20Hj= ..., (Thu Apr 22, 6:08 pm)
[PATCH 8/9] Input: Block suspend while event queue is not ..., =?UTF-8?q?Arve=20Hj= ..., (Thu Apr 22, 6:08 pm)
[PATCH 9/9] power_supply: Block suspend while power supply ..., =?UTF-8?q?Arve=20Hj= ..., (Thu Apr 22, 6:08 pm)
Re: [PATCH 7/9] PM: Add suspend blocking work., Tejun Heo, (Fri Apr 23, 1:16 am)
Re: [PATCH 7/9] PM: Add suspend blocking work., Oleg Nesterov, (Fri Apr 23, 5:20 am)
Re: [PATCH 5/9] PM: suspend_block: Add debugfs file, Randy Dunlap, (Fri Apr 23, 1:58 pm)
Re: [PATCH 7/9] PM: Add suspend blocking work., Arve Hjønnevåg, (Fri Apr 23, 3:49 pm)
Re: [PATCH 5/9] PM: suspend_block: Add debugfs file, Arve Hjønnevåg, (Fri Apr 23, 8:23 pm)
Re: [PATCH 5/9] PM: suspend_block: Add debugfs file, Randy Dunlap, (Fri Apr 23, 9:24 pm)
Re: [PATCH 5/9] PM: suspend_block: Add debugfs file, Arve Hjønnevåg, (Fri Apr 23, 9:54 pm)
Re: [PATCH 8/9] Input: Block suspend while event queue is ..., Arve Hjønnevåg, (Fri Apr 23, 9:58 pm)
Re: [PATCH 8/9] Input: Block suspend while event queue is ..., Arve Hjønnevåg, (Fri Apr 23, 10:02 pm)
Re: [PATCH 7/9] PM: Add suspend blocking work., Arve Hjønnevåg, (Fri Apr 23, 10:21 pm)
Re: [PATCH 7/9] PM: Add suspend blocking work., Tejun Heo, (Fri Apr 23, 11:33 pm)
Re: [PATCH 7/9] PM: Add suspend blocking work., Arve Hjønnevåg, (Sat Apr 24, 12:21 am)
Re: [PATCH 7/9] PM: Add suspend blocking work., Tejun Heo, (Sat Apr 24, 12:43 am)
Re: [PATCH 5/9] PM: suspend_block: Add debugfs file, Randy Dunlap, (Sun Apr 25, 12:53 pm)
Re: [PATCH 5/9] PM: suspend_block: Add debugfs file, Randy Dunlap, (Sun Apr 25, 5:23 pm)
Re: [PATCH 5/9] PM: suspend_block: Add debugfs file, Randy Dunlap, (Sun Apr 25, 5:50 pm)
Re: [PATCH 5/9] PM: suspend_block: Add debugfs file, Brian Swetland, (Sun Apr 25, 11:24 pm)
Re: [PATCH 5/9] PM: suspend_block: Add debugfs file, Randy Dunlap, (Mon Apr 26, 6:28 am)
Re: [PATCH 7/9] PM: Add suspend blocking work., Oleg Nesterov, (Mon Apr 26, 7:06 am)