Skip to contentSkip to conversation

unicore32: fixed backtrace when task running on another cpu

PATCH New Wang Qing 1 participant 1 message Apr 18, 2020

lore
Share & tools
lore

Wang Qing

author
#0 lore raw

PATCH 1/1 unicore32: fixed backtrace when task running on another cpu

We cannot get FP when the task is currently running on another CPU, in this case, current stack is printed instead of the task. Also, thread_saved_fp() is the last time the task was switched out, we should not use too.

---
 arch/unicore32/kernel/traps.c | 3 +++
 1 file changed, 3 insertions(+)
arch/unicore32/kernel/traps.c +3 -0
index e24f672..3b9472a 100644
@@ -151,6 +151,9 @@ static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
 	} else if (tsk != current) {
 		fp = thread_saved_fp(tsk);
 		mode = 0x10;
+	} else if (task_curr(tsk))
+		printk("tsk is running on another CPU, not trace!\n");
+		fp = 0;
 	} else {
 		asm("mov %0, fp" : "=r" (fp) : : "cc");
 		mode = 0x10;
Signature · 1 line
2.7.4