| From 2d0bbb7a096022c9bdbd05cafac3585fd26c33f5 Mon Sep 17 00:00:00 2001 |
| From: Sebastian Andrzej Siewior <bigeasy@linutronix.de> |
| Date: Fri, 15 Nov 2019 19:01:25 +0100 |
| Subject: [PATCH] workqueue: Add RCU annotation for pwq list walk |
| |
| commit 49e9d1a9faf2f71fdfd80a30697ee9a15070626d upstream. |
| |
| 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> |
| Signed-off-by: Tejun Heo <tj@kernel.org> |
| Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> |
| |
| diff --git a/kernel/workqueue.c b/kernel/workqueue.c |
| index aabfeeff1180..b30d5416ba2d 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.7.4 |
| |