[2.6.20.21 review 09/35] SPARC64: Fix sparc64 task stack traces.

Willy Tarreau
2007-10-13T14:43:46Z

[-- Attachment #1: 0036-SPARC64-Fix-sparc64-task-stack-traces.patch --]
[-- Type: text/plain, Size: 2095 bytes --]

It didn't handle that case at all, and now dump_stack()
can be implemented directly as show_stack(current, NULL)

Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
arch/sparc64/kernel/traps.c | 18 +++++++++++-------
arch/sparc64/mm/fault.c | 5 +----
2 files changed, 12 insertions(+), 11 deletions(-)

Index: 2.6/arch/sparc64/kernel/traps.c
===================================================================
--- 2.6.orig/arch/sparc64/kernel/traps.c
+++ 2.6/arch/sparc64/kernel/traps.c
@@ -2146,12 +2146,20 @@ static void user_instruction_dump (unsig
void show_stack(struct task_struct *tsk, unsigned long *_ksp)
{
unsigned long pc, fp, thread_base, ksp;
- void *tp = task_stack_page(tsk);
+ struct thread_info *tp;
struct reg_window *rw;
int count = 0;

ksp = (unsigned long) _ksp;
-
+ if (!tsk)
+ tsk = current;
+ tp = task_thread_info(tsk);
+ if (ksp == 0UL) {
+ if (tsk == current)
+ asm("mov %%fp, %0" : "=r" (ksp));
+ else
+ ksp = tp->ksp;
+ }
if (tp == current_thread_info())
flushw_all();

@@ -2180,11 +2188,7 @@ void show_stack(struct task_struct *tsk,

void dump_stack(void)
{
- unsigned long *ksp;
-
- __asm__ __volatile__("mov %%fp, %0"
- : "=r" (ksp));
- show_stack(current, ksp);
+ show_stack(current, NULL);
}

EXPORT_SYMBOL(dump_stack);
Index: 2.6/arch/sparc64/mm/fault.c
===================================================================
--- 2.6.orig/arch/sparc64/mm/fault.c
+++ 2.6/arch/sparc64/mm/fault.c
@@ -129,15 +129,12 @@ static void __kprobes unhandled_fault(un

static void bad_kernel_pc(struct pt_regs *regs, unsigned long vaddr)
{
- unsigned long *ksp;
-
printk(KERN_CRIT "OOPS: Bogus kernel PC [%016lx] in fault handler
",
regs->tpc);
printk(KERN_CRIT "OOPS: RPC [%016lx]
", regs->u_regs[15]);
print_symbol("RPC: <%s>
", regs->u_regs[15]);
printk(KERN_CRIT "OOPS: Fault was to vaddr[%lx]
", vaddr);
- __asm__("mov %%sp, %0" : "=r" (ksp));
- show_stack(current, ksp);
+ dump_stack();
unhandled_fault(regs->tpc, current, regs);
}

--