All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched: Dump stacktrace when some task failed to stop
@ 2022-05-19 16:11 Schspa Shi
  2022-05-19 16:29 ` Valentin Schneider
  0 siblings, 1 reply; 3+ messages in thread
From: Schspa Shi @ 2022-05-19 16:11 UTC (permalink / raw)
  To: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
	rostedt, bsegall, mgorman, bristot, vschneid
  Cc: linux-kernel, Schspa Shi

Some processes may not be stopped, such as workqueue workers.

Add this dump_stack to easily figure out which process caused the problems.

Before this change:

<4>[  517.545889] ------------[ cut here ]------------
<4>[  517.545901] Dying CPU not properly vacated!
<4>[  517.546366] ---[ end trace 0000000000000002 ]---
<4>[  518.546831] CPU6 enqueued tasks (2 total):
<4>[  518.546855] 	pid: 49, name: migration/6
<4>[  518.547010] 	pid: 6231, name: kworker/6:0

Signed-off-by: Schspa Shi <schspa@gmail.com>
---
 kernel/sched/core.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 53596842f0d8..de6b5320e4d7 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -9416,7 +9416,14 @@ static void dump_rq_tasks(struct rq *rq, const char *loglvl)
 			continue;
 
 		printk("%s\tpid: %d, name: %s\n", loglvl, p->pid, p->comm);
+		if (p != current)
+			sched_show_task(p);
 	}
+	/*
+	 * We need the stack of each cpu to analyze who is blocking the
+	 * current cpu scheduling
+	 */
+	trigger_all_cpu_backtrace();
 }
 
 int sched_cpu_dying(unsigned int cpu)
-- 
2.24.3 (Apple Git-128)


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

end of thread, other threads:[~2022-05-19 16:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-19 16:11 [PATCH] sched: Dump stacktrace when some task failed to stop Schspa Shi
2022-05-19 16:29 ` Valentin Schneider
2022-05-19 16:46   ` Schspa Shi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.