Commit 31fa8532 authored by Anton Blanchard's avatar Anton Blanchard

ppc64: clean up show_regs and remove print_backtrace

parent b4bf25f2
...@@ -11,9 +11,10 @@ ...@@ -11,9 +11,10 @@
#include <linux/config.h> #include <linux/config.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/smp.h>
#include <linux/interrupt.h>
#include <asm/ptrace.h> #include <asm/ptrace.h>
#include <asm/signal.h> #include <asm/signal.h>
#include <asm/io.h> #include <asm/io.h>
...@@ -114,11 +115,11 @@ extern unsigned long* _get_SP(void); ...@@ -114,11 +115,11 @@ extern unsigned long* _get_SP(void);
#define check_arg_irq(irq) \ #define check_arg_irq(irq) \
if (irq < open_pic_irq_offset || irq >= (NumSources+open_pic_irq_offset)){ \ if (irq < open_pic_irq_offset || irq >= (NumSources+open_pic_irq_offset)){ \
printk(KERN_ERR "open_pic.c:%d: illegal irq %d\n", __LINE__, irq); \ printk(KERN_ERR "open_pic.c:%d: illegal irq %d\n", __LINE__, irq); \
print_backtrace(_get_SP()); } dump_stack(); }
#define check_arg_cpu(cpu) \ #define check_arg_cpu(cpu) \
if (cpu < 0 || cpu >= OPENPIC_MAX_PROCESSORS){ \ if (cpu < 0 || cpu >= OPENPIC_MAX_PROCESSORS){ \
printk(KERN_ERR "open_pic.c:%d: illegal cpu %d\n", __LINE__, cpu); \ printk(KERN_ERR "open_pic.c:%d: illegal cpu %d\n", __LINE__, cpu); \
print_backtrace(_get_SP()); } dump_stack(); }
#else #else
#define check_arg_ipi(ipi) do {} while (0) #define check_arg_ipi(ipi) do {} while (0)
#define check_arg_timer(timer) do {} while (0) #define check_arg_timer(timer) do {} while (0)
......
...@@ -103,6 +103,8 @@ __switch_to(struct task_struct *prev, struct task_struct *new) ...@@ -103,6 +103,8 @@ __switch_to(struct task_struct *prev, struct task_struct *new)
local_irq_restore(flags); local_irq_restore(flags);
} }
static void show_tsk_stack(struct task_struct *p, unsigned long sp);
void show_regs(struct pt_regs * regs) void show_regs(struct pt_regs * regs)
{ {
int i; int i;
...@@ -114,32 +116,26 @@ void show_regs(struct pt_regs * regs) ...@@ -114,32 +116,26 @@ void show_regs(struct pt_regs * regs)
regs->msr & MSR_FP ? 1 : 0,regs->msr&MSR_ME ? 1 : 0, regs->msr & MSR_FP ? 1 : 0,regs->msr&MSR_ME ? 1 : 0,
regs->msr&MSR_IR ? 1 : 0, regs->msr&MSR_IR ? 1 : 0,
regs->msr&MSR_DR ? 1 : 0); regs->msr&MSR_DR ? 1 : 0);
if (regs->trap == 0x300 || regs->trap == 0x380 || regs->trap == 0x600)
printk("DAR: %016lx, DSISR: %016lx\n", regs->dar, regs->dsisr);
printk("TASK = %p[%d] '%s' ", printk("TASK = %p[%d] '%s' ",
current, current->pid, current->comm); current, current->pid, current->comm);
printk("\nlast math %p ", last_task_used_math);
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
/* printk(" CPU: %d last CPU: %d", current->processor,current->last_processor); */ printk(" CPU: %d", smp_processor_id());
#endif /* CONFIG_SMP */ #endif /* CONFIG_SMP */
printk("\n"); for (i = 0; i < 32; i++) {
for (i = 0; i < 32; i++)
{
long r; long r;
if ((i % 4) == 0) if ((i % 4) == 0) {
{ printk("\n" KERN_INFO "GPR%02d: ", i);
printk("GPR%02d: ", i);
} }
if (__get_user(r, &(regs->gpr[i])))
if ( __get_user(r, &(regs->gpr[i])) )
return; return;
printk("%016lX ", r); printk("%016lX ", r);
if ((i % 4) == 3)
{
printk("\n");
}
} }
printk("\n");
show_tsk_stack(current, regs->gpr[1]);
} }
void exit_thread(void) void exit_thread(void)
...@@ -338,7 +334,7 @@ void initialize_paca_hardware_interrupt_stack(void) ...@@ -338,7 +334,7 @@ void initialize_paca_hardware_interrupt_stack(void)
if (!cpu_possible(i)) if (!cpu_possible(i))
continue; continue;
/* Carve out storage for the hardware interrupt stack */ /* Carve out storage for the hardware interrupt stack */
stack = __get_free_pages(GFP_KERNEL, get_order(8*PAGE_SIZE)); stack = __get_free_pages(GFP_ATOMIC, get_order(8*PAGE_SIZE));
if ( !stack ) { if ( !stack ) {
printk("ERROR, cannot find space for hardware stack.\n"); printk("ERROR, cannot find space for hardware stack.\n");
...@@ -413,26 +409,6 @@ char * ppc_find_proc_name( unsigned * p, char * buf, unsigned buflen ) ...@@ -413,26 +409,6 @@ char * ppc_find_proc_name( unsigned * p, char * buf, unsigned buflen )
return buf; return buf;
} }
void
print_backtrace(unsigned long *sp)
{
int cnt = 0;
unsigned long i;
char name_buf[256];
printk("Call backtrace: \n");
while (sp) {
if (__get_user( i, &sp[2] ))
break;
printk("%016lX ", i);
printk("%s\n", ppc_find_proc_name( (unsigned *)i, name_buf, 256 ));
if (cnt > 32) break;
if (__get_user(sp, (unsigned long **)sp))
break;
}
printk("\n");
}
/* /*
* These bracket the sleeping functions.. * These bracket the sleeping functions..
*/ */
...@@ -467,31 +443,41 @@ unsigned long get_wchan(struct task_struct *p) ...@@ -467,31 +443,41 @@ unsigned long get_wchan(struct task_struct *p)
return 0; return 0;
} }
void show_trace_task(struct task_struct *p) static void show_tsk_stack(struct task_struct *p, unsigned long sp)
{ {
unsigned long ip, sp; unsigned long ip;
unsigned long stack_page = (unsigned long)p->thread_info; unsigned long stack_page = (unsigned long)p->thread_info;
int count = 0; int count = 0;
char name_buf[256];
if (!p) if (!p)
return; return;
printk("Call Trace: "); printk("Call Trace: ");
sp = p->thread.ksp;
do { do {
sp = *(unsigned long *)sp; if (__get_user(sp, (unsigned long *)sp))
break;
if (sp < (stack_page + sizeof(struct thread_struct)) || if (sp < (stack_page + sizeof(struct thread_struct)) ||
sp >= (stack_page + THREAD_SIZE)) sp >= (stack_page + THREAD_SIZE))
break; break;
if (count > 0) { if (count > 0) {
ip = *(unsigned long *)(sp + 16); if (__get_user(ip, (unsigned long *)(sp + 16)))
break;
printk("[%016lx] ", ip); printk("[%016lx] ", ip);
printk("%s\n", ppc_find_proc_name((unsigned *)ip,
name_buf, 256 ));
} }
} while (count++ < 16); } while (count++ < 32);
printk("\n");
} }
extern unsigned long *_get_SP(void);
void dump_stack(void) void dump_stack(void)
{ {
show_stack(NULL); show_tsk_stack(current, (unsigned long)_get_SP());
}
void show_trace_task(struct task_struct *tsk)
{
show_tsk_stack(tsk, tsk->thread.ksp);
} }
...@@ -67,7 +67,6 @@ void die(const char *str, struct pt_regs *regs, long err) ...@@ -67,7 +67,6 @@ void die(const char *str, struct pt_regs *regs, long err)
bust_spinlocks(1); bust_spinlocks(1);
printk("Oops: %s, sig: %ld\n", str, err); printk("Oops: %s, sig: %ld\n", str, err);
show_regs(regs); show_regs(regs);
print_backtrace((unsigned long *)regs->gpr[1]);
bust_spinlocks(0); bust_spinlocks(0);
spin_unlock_irq(&die_lock); spin_unlock_irq(&die_lock);
...@@ -188,7 +187,6 @@ MachineCheckException(struct pt_regs *regs) ...@@ -188,7 +187,6 @@ MachineCheckException(struct pt_regs *regs)
printk("Machine check in kernel mode.\n"); printk("Machine check in kernel mode.\n");
printk("Caused by (from SRR1=%lx): ", regs->msr); printk("Caused by (from SRR1=%lx): ", regs->msr);
show_regs(regs); show_regs(regs);
print_backtrace((unsigned long *)regs->gpr[1]);
bust_spinlocks(0); bust_spinlocks(0);
spin_unlock_irq(&die_lock); spin_unlock_irq(&die_lock);
panic("Unrecoverable Machine Check"); panic("Unrecoverable Machine Check");
......
...@@ -12,8 +12,9 @@ ...@@ -12,8 +12,9 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/threads.h> #include <linux/threads.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/smp.h>
#include <linux/interrupt.h>
#include <asm/prom.h> #include <asm/prom.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
*/ */
#include <linux/config.h> #include <linux/config.h>
#include <linux/cache.h>
#include <linux/preempt.h> #include <linux/preempt.h>
typedef struct { typedef struct {
...@@ -104,12 +105,4 @@ do { \ ...@@ -104,12 +105,4 @@ do { \
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#define show_stack(SP) \
do { \
if (SP) \
print_backtrace(SP); \
else \
print_backtrace(_get_SP()); \
} while (0)
#endif /* __ASM_HARDIRQ_H */ #endif /* __ASM_HARDIRQ_H */
...@@ -79,7 +79,6 @@ extern int xmon_dabr_match(struct pt_regs *regs); ...@@ -79,7 +79,6 @@ extern int xmon_dabr_match(struct pt_regs *regs);
extern void (*xmon_fault_handler)(struct pt_regs *regs); extern void (*xmon_fault_handler)(struct pt_regs *regs);
#endif #endif
extern void print_backtrace(unsigned long *);
extern void show_regs(struct pt_regs * regs); extern void show_regs(struct pt_regs * regs);
extern void flush_instruction_cache(void); extern void flush_instruction_cache(void);
extern int _get_PVR(void); extern int _get_PVR(void);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment