[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1392687834.10088.17.camel@deadeye.wl.decadent.org.uk>
Date: Tue, 18 Feb 2014 01:43:54 +0000
From: Ben Hutchings <ben@...adent.org.uk>
To: Peter Hurley <peter@...leysoftware.com>, Tejun Heo <tj@...nel.org>
Cc: linux-kernel@...r.kernel.org,
Stefan Richter <stefanr@...6.in-berlin.de>,
stable@...r.kernel.org
Subject: Re: [PATCH] workqueue: Document exceptions to work item
non-reentrancy guarantee
On Sat, 2014-02-15 at 14:38 -0500, Peter Hurley wrote:
> Since commit a2c1c57be8d9fd5b716113c8991d3d702eeacf77,
> workqueue: consider work function when searching for busy work items
> work items whose work functions are re-assigned are no longer guaranteed
> non-reentrancy with the previously assigned work function. For example,
>
> PREPARE_WORK(&work, funcA)
> schedule_work(&work)
> .
> < funcA starts >
> .
> PREPARE_WORK(&work, funcB)
> schedule_work(&work)
>
> funcA() may run concurrently with funcB().
>
> The work item non-reentrancy guarantee is a crucial design guarantee
> which, if violated, may not have obvious consequences. For example,
> the entire firewire subsystem expects the as-documented per-work item
> non-reentrancy guarantee, which was the behavior prior to the above
> commit, not the per-work function + per-work item behavior since.
>
> Document the known exceptions to this guarantee.
[...]
It never would have occurred to me that you could safely change the
function for a work item that is already scheduled or running.
Especially given that PREPARE_WORK() is just a simple assignment (i.e.
no serialisation).
Perhaps there is a need to document more generally how PREPARE_WORK()
can be used, not just this quirk of reentrancy.
Ben.
--
Ben Hutchings
Nothing is ever a complete failure; it can always serve as a bad example.
Download attachment "signature.asc" of type "application/pgp-signature" (812 bytes)
Powered by blists - more mailing lists