xtensa: use correct stack pointer for stack traces
Right now, the xtensa stacktrace code reads the _current_ kernel stack pointer if nothing is supplied. With debugging facilities like sysrq this means that the backtrace of the sysrq-handler is printed instead of a trace of the given task's stack. When no stack pointer is specified in show_trace() and show_stack(), use the stack pointer that comes with the handed in task descriptor to make stack traces more useful. Signed-off-by: Johannes Weiner <jw@emlix.com> Signed-off-by: Chris Zankel <chris@zankel.net>
This commit is contained in:
parent
35f9cd083b
commit
28a0ce7f64
|
@ -372,11 +372,10 @@ void show_trace(struct task_struct *task, unsigned long *sp)
|
||||||
unsigned long a0, a1, pc;
|
unsigned long a0, a1, pc;
|
||||||
unsigned long sp_start, sp_end;
|
unsigned long sp_start, sp_end;
|
||||||
|
|
||||||
|
if (sp)
|
||||||
a1 = (unsigned long)sp;
|
a1 = (unsigned long)sp;
|
||||||
|
else
|
||||||
if (a1 == 0)
|
a1 = task->thread.sp;
|
||||||
__asm__ __volatile__ ("mov %0, a1\n" : "=a"(a1));
|
|
||||||
|
|
||||||
|
|
||||||
sp_start = a1 & ~(THREAD_SIZE-1);
|
sp_start = a1 & ~(THREAD_SIZE-1);
|
||||||
sp_end = sp_start + THREAD_SIZE;
|
sp_end = sp_start + THREAD_SIZE;
|
||||||
|
@ -418,9 +417,8 @@ void show_stack(struct task_struct *task, unsigned long *sp)
|
||||||
int i = 0;
|
int i = 0;
|
||||||
unsigned long *stack;
|
unsigned long *stack;
|
||||||
|
|
||||||
if (sp == 0)
|
if (!sp)
|
||||||
__asm__ __volatile__ ("mov %0, a1\n" : "=a"(sp));
|
sp = (unsigned long *)task->thread.sp;
|
||||||
|
|
||||||
stack = sp;
|
stack = sp;
|
||||||
|
|
||||||
printk("\nStack: ");
|
printk("\nStack: ");
|
||||||
|
|
Loading…
Reference in a new issue