* [PATCH] workqueue: avoid hard lockups in show_workqueue_state()
@ 2018-01-11 0:53 Sergey Senozhatsky
2018-01-12 19:40 ` Tejun Heo
0 siblings, 1 reply; 2+ messages in thread
From: Sergey Senozhatsky @ 2018-01-11 0:53 UTC (permalink / raw)
To: Tejun Heo; +Cc: Lai Jiangshan, linux-kernel, Sergey Senozhatsky
show_workqueue_state() can print out a lot of messages while being in
atomic context, e.g. sysrq-t -> show_workqueue_state(). If the console
device is slow it may end up triggering NMI hard lockup watchdog.
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
---
kernel/workqueue.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 9960f8842b31..8dd2e66e8383 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -48,6 +48,7 @@
#include <linux/moduleparam.h>
#include <linux/uaccess.h>
#include <linux/sched/isolation.h>
+#include <linux/nmi.h>
#include "workqueue_internal.h"
@@ -4473,6 +4474,12 @@ void show_workqueue_state(void)
if (pwq->nr_active || !list_empty(&pwq->delayed_works))
show_pwq(pwq);
spin_unlock_irqrestore(&pwq->pool->lock, flags);
+ /*
+ * We could be printing a lot from atomic context, e.g.
+ * sysrq-t -> show_workqueue_state(). Avoid triggering
+ * hard lockup.
+ */
+ touch_nmi_watchdog();
}
}
@@ -4500,6 +4507,12 @@ void show_workqueue_state(void)
pr_cont("\n");
next_pool:
spin_unlock_irqrestore(&pool->lock, flags);
+ /*
+ * We could be printing a lot from atomic context, e.g.
+ * sysrq-t -> show_workqueue_state(). Avoid triggering
+ * hard lockup.
+ */
+ touch_nmi_watchdog();
}
rcu_read_unlock_sched();
--
2.15.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] workqueue: avoid hard lockups in show_workqueue_state()
2018-01-11 0:53 [PATCH] workqueue: avoid hard lockups in show_workqueue_state() Sergey Senozhatsky
@ 2018-01-12 19:40 ` Tejun Heo
0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2018-01-12 19:40 UTC (permalink / raw)
To: Sergey Senozhatsky; +Cc: Lai Jiangshan, linux-kernel, Sergey Senozhatsky
On Thu, Jan 11, 2018 at 09:53:35AM +0900, Sergey Senozhatsky wrote:
> show_workqueue_state() can print out a lot of messages while being in
> atomic context, e.g. sysrq-t -> show_workqueue_state(). If the console
> device is slow it may end up triggering NMI hard lockup watchdog.
>
> Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Applied to wq/for-4.15-fixes.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-01-12 19:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-11 0:53 [PATCH] workqueue: avoid hard lockups in show_workqueue_state() Sergey Senozhatsky
2018-01-12 19:40 ` 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).