public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] ARM64: fixed dump_backtrace() when task running on another cpu
@ 2020-04-09  9:38 Wang Qing
  2020-04-09 10:40 ` Mark Rutland
  2020-04-13  9:23 ` Wang Qing
  0 siblings, 2 replies; 4+ messages in thread
From: Wang Qing @ 2020-04-09  9:38 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Mark Rutland, James Morse,
	Eric W. Biederman, Thomas Gleixner, Wang Qing, jinho lim,
	Dave Martin, linux-arm-kernel, linux-kernel
  Cc: opensource.kernel

We cannot get FP and PC when the task is running on another CPU,
task->thread.cpu_context is the last time the task was switched out,
it's better to give a reminder than to provide wrong information.

Signed-off-by: Wang Qing <wangqing@vivo.com>
---
 arch/arm64/kernel/traps.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
index cf402be..c04e3e8 100644
--- a/arch/arm64/kernel/traps.c
+++ b/arch/arm64/kernel/traps.c
@@ -106,6 +106,14 @@ void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
 		start_backtrace(&frame,
 				(unsigned long)__builtin_frame_address(0),
 				(unsigned long)dump_backtrace);
+	} else if (tsk->on_cpu) {
+		/*
+		 * The task is running in another cpu, so the call stack
+		 * is changing and we cannot get it.
+		 */
+		pr_warn("tsk: %s is running in CPU%d, Don't call trace!\n",
+			tsk->comm, tsk->cpu);
+		return;
 	} else {
 		/*
 		 * task blocked in __switch_to
-- 
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2020-04-14 12:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-09  9:38 [PATCH] ARM64: fixed dump_backtrace() when task running on another cpu Wang Qing
2020-04-09 10:40 ` Mark Rutland
2020-04-13  9:23 ` Wang Qing
2020-04-14 12:54   ` [PATCH] " Mark Rutland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox