From 93dae5b70e7c1c8e927d22e1c20a941ca376906a Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Mon, 19 May 2008 23:46:00 -0700 Subject: sparc64: Add global register dumping facility. When a cpu really is stuck in the kernel, it can be often impossible to figure out which cpu is stuck where. The worst case is when the stuck cpu has interrupts disabled. Therefore, implement a global cpu state capture that uses SMP message interrupts which are not disabled by the normal IRQ enable/disable APIs of the kernel. As long as we can get a sysrq 'y' to the kernel, we can get a dump. Even if the console interrupt cpu is wedged, we can trigger it from userspace using /proc/sysrq-trigger The output is made compact so that this facility is more useful on high cpu count systems, which is where this facility will likely find itself the most useful :) Signed-off-by: David S. Miller --- include/asm-sparc64/ptrace.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'include/asm-sparc64/ptrace.h') diff --git a/include/asm-sparc64/ptrace.h b/include/asm-sparc64/ptrace.h index 90972a5ada59..d8a56cddf7f2 100644 --- a/include/asm-sparc64/ptrace.h +++ b/include/asm-sparc64/ptrace.h @@ -126,6 +126,17 @@ struct sparc_trapf { #define TRACEREG32_SZ sizeof(struct pt_regs32) #define STACKFRAME32_SZ sizeof(struct sparc_stackf32) +struct global_reg_snapshot { + unsigned long tstate; + unsigned long tpc; + unsigned long tnpc; + unsigned long o7; + unsigned long i7; + struct thread_info *thread; + unsigned long pad1; + unsigned long pad2; +}; + #ifdef __KERNEL__ #define __ARCH_WANT_COMPAT_SYS_PTRACE @@ -295,6 +306,16 @@ extern void __show_regs(struct pt_regs *); #define SF_XARG5 0x58 #define SF_XXARG 0x5c +/* global_reg_snapshot offsets */ +#define GR_SNAP_TSTATE 0x00 +#define GR_SNAP_TPC 0x08 +#define GR_SNAP_TNPC 0x10 +#define GR_SNAP_O7 0x18 +#define GR_SNAP_I7 0x20 +#define GR_SNAP_THREAD 0x28 +#define GR_SNAP_PAD1 0x30 +#define GR_SNAP_PAD2 0x38 + /* Stuff for the ptrace system call */ #define PTRACE_SPARC_DETACH 11 #define PTRACE_GETREGS 12 -- cgit v1.2.3 From 551dec47bb5964478db594385a896eb0d4ab2b0a Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Sun, 25 May 2008 22:50:16 -0700 Subject: sparc64: global_reg_snapshot is not for userspace global_reg_snapshot shouldn't be visible in our userspace headers. Signed-off-by: Adrian Bunk Signed-off-by: David S. Miller --- include/asm-sparc64/ptrace.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'include/asm-sparc64/ptrace.h') diff --git a/include/asm-sparc64/ptrace.h b/include/asm-sparc64/ptrace.h index d8a56cddf7f2..b163da79bb6d 100644 --- a/include/asm-sparc64/ptrace.h +++ b/include/asm-sparc64/ptrace.h @@ -126,6 +126,8 @@ struct sparc_trapf { #define TRACEREG32_SZ sizeof(struct pt_regs32) #define STACKFRAME32_SZ sizeof(struct sparc_stackf32) +#ifdef __KERNEL__ + struct global_reg_snapshot { unsigned long tstate; unsigned long tpc; @@ -137,8 +139,6 @@ struct global_reg_snapshot { unsigned long pad2; }; -#ifdef __KERNEL__ - #define __ARCH_WANT_COMPAT_SYS_PTRACE #define force_successful_syscall_return() \ @@ -306,6 +306,8 @@ extern void __show_regs(struct pt_regs *); #define SF_XARG5 0x58 #define SF_XXARG 0x5c +#ifdef __KERNEL__ + /* global_reg_snapshot offsets */ #define GR_SNAP_TSTATE 0x00 #define GR_SNAP_TPC 0x08 @@ -316,6 +318,8 @@ extern void __show_regs(struct pt_regs *); #define GR_SNAP_PAD1 0x30 #define GR_SNAP_PAD2 0x38 +#endif /* __KERNEL__ */ + /* Stuff for the ptrace system call */ #define PTRACE_SPARC_DETACH 11 #define PTRACE_GETREGS 12 -- cgit v1.2.3