[linux-yocto] [PATCH 2/2] powerpc/perf: run irq-work under softirq context in rt

Xufeng Zhang xufeng.zhang at windriver.com
Wed Apr 24 01:00:31 PDT 2013

irq_work_run() is called to handle the pending perf events under interrupt
context(decrementer overflows exception handler) on powerpc platform,
however, this would trigger the below warning when run 'perf top' command
which is caused by the sleeppable spin_lock in __wake_up() functionin in
preempt_rt kernel:
BUG: sleeping function called from invalid context at linux/kernel/rtmutex.c:658
in_atomic(): 1, irqs_disabled(): 1, pid: 0, name: swapper/0
Call Trace:
[c0c0fd80] [c040a1b4] show_stack+0x10c/0x1c0 (unreliable)
[c0c0fdd0] [c09c3c48] dump_stack+0x24/0x34
[c0c0fde0] [c045f728] __might_sleep+0xd8/0xfc
[c0c0fdf0] [c09bb750] rt_spin_lock+0x34/0x7c
[c0c0fe00] [c0462e44] __wake_up+0x38/0x70
[c0c0fe20] [c04df740] perf_event_wakeup+0x40/0x90
[c0c0fe50] [c04df7d0] perf_pending_event+0x40/0x6c
[c0c0fe60] [c04da4d4] irq_work_run+0x84/0xc4
[c0c0fe80] [c040bd54] timer_interrupt+0x1ec/0x3d0
[c0c0fec0] [c0411728] ret_from_except+0x0/0x18

Inspired by upstream(git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-stable-rt.git)
commit 8baf86762 "x86-no-perf-irq-work-rt.patch", we can run the irq-work under softirq
context in rt kernel to resolve this problem.

Signed-off-by: Xufeng Zhang <xufeng.zhang at windriver.com>
 arch/powerpc/kernel/time.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 31e2c31..9a6b81c 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -452,6 +452,7 @@ DEFINE_PER_CPU(u8, irq_work_pending);
 #endif /* 32 vs 64 bit */
 void arch_irq_work_raise(void)
@@ -459,6 +460,7 @@ void arch_irq_work_raise(void)
 #else  /* CONFIG_IRQ_WORK */

More information about the linux-yocto mailing list