aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorSteven Rostedt <rostedt@goodmis.org>2010-12-23 14:46:06 -0500
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2011-01-20 22:08:33 -0500
commit3cb5f1a3e58c0bd70d47d9907cc5c65192281dee (patch)
tree066e31b7fc67a681ffaa1306df64e7b302744410 /arch
parentc0337288ab165be17081d61d4ef13b79d3ac55d4 (diff)
powerpc/ppc64/tracing: Add stack frame to calls of trace_hardirqs_on/off
When an interrupt occurs in userspace, we can call trace_hardirqs_on/off() With one level stack. But if we have irqsoff tracing enabled, it checks both CALLER_ADDR0 and CALLER_ADDR1. The second call goes two stack frames up. If this is from user space, then there may not exist a second stack. Add a second stack when calling trace_hardirqs_on/off() otherwise the following oops might occur: Oops: Kernel access of bad area, sig: 11 [#1] PREEMPT SMP NR_CPUS=2 PA Semi PWRficient last sysfs file: /sys/block/sda/size Modules linked in: ohci_hcd ehci_hcd usbcore NIP: c0000000000e1c00 LR: c0000000000034d4 CTR: 000000011012c440 REGS: c00000003e2f3af0 TRAP: 0300 Not tainted (2.6.37-rc6+) MSR: 9000000000001032 <ME,IR,DR> CR: 48044444 XER: 20000000 DAR: 00000001ffb9db50, DSISR: 0000000040000000 TASK = c00000003e1a00a0[2088] 'emacs' THREAD: c00000003e2f0000 CPU: 1 GPR00: 0000000000000001 c00000003e2f3d70 c00000000084e0d0 c0000000008816e8 GPR04: 000000001034c678 000000001032e8f9 0000000010336540 0000000040020000 GPR08: 0000000040020000 00000001ffb9db40 c00000003e2f3e30 0000000060000000 GPR12: 100000000000f032 c00000000fff0280 000000001032e8c9 0000000000000008 GPR16: 00000000105be9c0 00000000105be950 00000000105be9b0 00000000105be950 GPR20: 00000000ffb9dc50 00000000ffb9dbf0 00000000102f0000 00000000102f0000 GPR24: 00000000102e0000 00000000102f0000 0000000010336540 c0000000009ded38 GPR28: 00000000102e0000 c0000000000034d4 c0000000007ccb10 c00000003e2f3d70 NIP [c0000000000e1c00] .trace_hardirqs_off+0xb0/0x1d0 LR [c0000000000034d4] decrementer_common+0xd4/0x100 Call Trace: [c00000003e2f3d70] [c00000003e2f3e30] 0xc00000003e2f3e30 (unreliable) [c00000003e2f3e30] [c0000000000034d4] decrementer_common+0xd4/0x100 Instruction dump: 81690000 7f8b0000 419e0018 f84a0028 60000000 60000000 60000000 e95f0000 80030000 e92a0000 eb6301f8 2f800000 <eb890010> 41fe00dc a06d000a eb1e8050 ---[ end trace 4ec7fd2be9240928 ]--- Reported-by: Joerg Sommer <joerg@alea.gnuu.de> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/include/asm/irqflags.h40
1 files changed, 30 insertions, 10 deletions
diff --git a/arch/powerpc/include/asm/irqflags.h b/arch/powerpc/include/asm/irqflags.h
index b85d8ddbb66..b0b06d85788 100644
--- a/arch/powerpc/include/asm/irqflags.h
+++ b/arch/powerpc/include/asm/irqflags.h
@@ -12,24 +12,44 @@
12 12
13#else 13#else
14#ifdef CONFIG_TRACE_IRQFLAGS 14#ifdef CONFIG_TRACE_IRQFLAGS
15#ifdef CONFIG_IRQSOFF_TRACER
16/*
17 * Since the ftrace irqsoff latency trace checks CALLER_ADDR1,
18 * which is the stack frame here, we need to force a stack frame
19 * in case we came from user space.
20 */
21#define TRACE_WITH_FRAME_BUFFER(func) \
22 mflr r0; \
23 stdu r1, -32(r1); \
24 std r0, 16(r1); \
25 stdu r1, -32(r1); \
26 bl func; \
27 ld r1, 0(r1); \
28 ld r1, 0(r1);
29#else
30#define TRACE_WITH_FRAME_BUFFER(func) \
31 bl func;
32#endif
33
15/* 34/*
16 * Most of the CPU's IRQ-state tracing is done from assembly code; we 35 * Most of the CPU's IRQ-state tracing is done from assembly code; we
17 * have to call a C function so call a wrapper that saves all the 36 * have to call a C function so call a wrapper that saves all the
18 * C-clobbered registers. 37 * C-clobbered registers.
19 */ 38 */
20#define TRACE_ENABLE_INTS bl .trace_hardirqs_on 39#define TRACE_ENABLE_INTS TRACE_WITH_FRAME_BUFFER(.trace_hardirqs_on)
21#define TRACE_DISABLE_INTS bl .trace_hardirqs_off 40#define TRACE_DISABLE_INTS TRACE_WITH_FRAME_BUFFER(.trace_hardirqs_off)
22#define TRACE_AND_RESTORE_IRQ_PARTIAL(en,skip) \ 41
23 cmpdi en,0; \ 42#define TRACE_AND_RESTORE_IRQ_PARTIAL(en,skip) \
24 bne 95f; \ 43 cmpdi en,0; \
25 stb en,PACASOFTIRQEN(r13); \ 44 bne 95f; \
26 bl .trace_hardirqs_off; \ 45 stb en,PACASOFTIRQEN(r13); \
27 b skip; \ 46 TRACE_WITH_FRAME_BUFFER(.trace_hardirqs_off) \
2895: bl .trace_hardirqs_on; \ 47 b skip; \
4895: TRACE_WITH_FRAME_BUFFER(.trace_hardirqs_on) \
29 li en,1; 49 li en,1;
30#define TRACE_AND_RESTORE_IRQ(en) \ 50#define TRACE_AND_RESTORE_IRQ(en) \
31 TRACE_AND_RESTORE_IRQ_PARTIAL(en,96f); \ 51 TRACE_AND_RESTORE_IRQ_PARTIAL(en,96f); \
32 stb en,PACASOFTIRQEN(r13); \ 52 stb en,PACASOFTIRQEN(r13); \
3396: 5396:
34#else 54#else
35#define TRACE_ENABLE_INTS 55#define TRACE_ENABLE_INTS