linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] workqueue: Add RCU annotation for pwq list walk
@ 2019-11-15 18:01 Sebastian Andrzej Siewior
  2019-11-15 19:53 ` Tejun Heo
  0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Andrzej Siewior @ 2019-11-15 18:01 UTC (permalink / raw)
  To: Joel Fernandes, Paul E. McKenney
  Cc: Tejun Heo, Lai Jiangshan, linux-kernel, Thomas Gleixner

An additional check has been recently added to ensure that a RCU related lock
is held while the RCU list is iterated.
The `pwqs' are sometimes iterated without a RCU lock but with the &wq->mutex
acquired leading to a warning.

Teach list_for_each_entry_rcu() that the RCU usage is okay if &wq->mutex
is acquired during the list traversal.

Fixes: 28875945ba98d ("rcu: Add support for consolidated-RCU reader checking")
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 kernel/workqueue.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index bc2e09a8ea61d..0a1d2f4289178 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -425,7 +425,8 @@ static void workqueue_sysfs_unregister(struct workqueue_struct *wq);
  * ignored.
  */
 #define for_each_pwq(pwq, wq)						\
-	list_for_each_entry_rcu((pwq), &(wq)->pwqs, pwqs_node)		\
+	list_for_each_entry_rcu((pwq), &(wq)->pwqs, pwqs_node,		\
+				lockdep_is_held(&wq->mutex))		\
 		if (({ assert_rcu_or_wq_mutex(wq); false; })) { }	\
 		else
 
-- 
2.24.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] workqueue: Add RCU annotation for pwq list walk
  2019-11-15 18:01 [PATCH] workqueue: Add RCU annotation for pwq list walk Sebastian Andrzej Siewior
@ 2019-11-15 19:53 ` Tejun Heo
  0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2019-11-15 19:53 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: Joel Fernandes, Paul E. McKenney, Lai Jiangshan, linux-kernel,
	Thomas Gleixner

On Fri, Nov 15, 2019 at 07:01:25PM +0100, Sebastian Andrzej Siewior wrote:
> An additional check has been recently added to ensure that a RCU related lock
> is held while the RCU list is iterated.
> The `pwqs' are sometimes iterated without a RCU lock but with the &wq->mutex
> acquired leading to a warning.
> 
> Teach list_for_each_entry_rcu() that the RCU usage is okay if &wq->mutex
> is acquired during the list traversal.
> 
> Fixes: 28875945ba98d ("rcu: Add support for consolidated-RCU reader checking")
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

Applied to wq/for-5.5.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-15 19:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-15 18:01 [PATCH] workqueue: Add RCU annotation for pwq list walk Sebastian Andrzej Siewior
2019-11-15 19:53 ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).