summaryrefslogtreecommitdiffstats
path: root/kernel/workqueue.c
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2021-10-18 13:51:43 +0100
committerMark Brown <broonie@kernel.org>2021-10-18 13:51:43 +0100
commited96f35cecb0a7d1d95bbba8b9f212e60d0f7480 (patch)
tree15fe5f3dc395c3b1e713ad52bcd529b1a343cfe2 /kernel/workqueue.c
parent72bf80cf09c4693780ad93a31b48fa5a4e17a946 (diff)
parent519d81956ee277b4419c723adfb154603c2565ba (diff)
downloadlinux-stable-ed96f35cecb0a7d1d95bbba8b9f212e60d0f7480.tar.gz
linux-stable-ed96f35cecb0a7d1d95bbba8b9f212e60d0f7480.tar.bz2
linux-stable-ed96f35cecb0a7d1d95bbba8b9f212e60d0f7480.zip
Merge tag 'v5.15-rc6' into regulator-5.16
Linux 5.15-rc6
Diffstat (limited to 'kernel/workqueue.c')
-rw-r--r--kernel/workqueue.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 33a6b4a2443d..1b3eb1e9531f 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -4830,8 +4830,16 @@ void show_workqueue_state(void)
for_each_pwq(pwq, wq) {
raw_spin_lock_irqsave(&pwq->pool->lock, flags);
- if (pwq->nr_active || !list_empty(&pwq->inactive_works))
+ if (pwq->nr_active || !list_empty(&pwq->inactive_works)) {
+ /*
+ * Defer printing to avoid deadlocks in console
+ * drivers that queue work while holding locks
+ * also taken in their write paths.
+ */
+ printk_deferred_enter();
show_pwq(pwq);
+ printk_deferred_exit();
+ }
raw_spin_unlock_irqrestore(&pwq->pool->lock, flags);
/*
* We could be printing a lot from atomic context, e.g.
@@ -4849,7 +4857,12 @@ void show_workqueue_state(void)
raw_spin_lock_irqsave(&pool->lock, flags);
if (pool->nr_workers == pool->nr_idle)
goto next_pool;
-
+ /*
+ * Defer printing to avoid deadlocks in console drivers that
+ * queue work while holding locks also taken in their write
+ * paths.
+ */
+ printk_deferred_enter();
pr_info("pool %d:", pool->id);
pr_cont_pool_info(pool);
pr_cont(" hung=%us workers=%d",
@@ -4864,6 +4877,7 @@ void show_workqueue_state(void)
first = false;
}
pr_cont("\n");
+ printk_deferred_exit();
next_pool:
raw_spin_unlock_irqrestore(&pool->lock, flags);
/*