diff options
author | Peter Zijlstra <peterz@infradead.org> | 2015-02-19 12:03:11 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-03-23 05:46:32 -0400 |
commit | d525211f9d1be8b523ec7633f080f2116f5ea536 (patch) | |
tree | d6283ad53d521696e1a6fd32f2cca1b63fe82355 /kernel/events | |
parent | bc465aa9d045feb0e13b4a8f32cc33c1943f62d6 (diff) |
perf: Fix irq_work 'tail' recursion
Vince reported a watchdog lockup like:
[<ffffffff8115e114>] perf_tp_event+0xc4/0x210
[<ffffffff810b4f8a>] perf_trace_lock+0x12a/0x160
[<ffffffff810b7f10>] lock_release+0x130/0x260
[<ffffffff816c7474>] _raw_spin_unlock_irqrestore+0x24/0x40
[<ffffffff8107bb4d>] do_send_sig_info+0x5d/0x80
[<ffffffff811f69df>] send_sigio_to_task+0x12f/0x1a0
[<ffffffff811f71ce>] send_sigio+0xae/0x100
[<ffffffff811f72b7>] kill_fasync+0x97/0xf0
[<ffffffff8115d0b4>] perf_event_wakeup+0xd4/0xf0
[<ffffffff8115d103>] perf_pending_event+0x33/0x60
[<ffffffff8114e3fc>] irq_work_run_list+0x4c/0x80
[<ffffffff8114e448>] irq_work_run+0x18/0x40
[<ffffffff810196af>] smp_trace_irq_work_interrupt+0x3f/0xc0
[<ffffffff816c99bd>] trace_irq_work_interrupt+0x6d/0x80
Which is caused by an irq_work generating new irq_work and therefore
not allowing forward progress.
This happens because processing the perf irq_work triggers another
perf event (tracepoint stuff) which in turn generates an irq_work ad
infinitum.
Avoid this by raising the recursion counter in the irq_work -- which
effectively disables all software events (including tracepoints) from
actually triggering again.
Reported-by: Vince Weaver <vincent.weaver@maine.edu>
Tested-by: Vince Weaver <vincent.weaver@maine.edu>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: <stable@vger.kernel.org>
Link: http://lkml.kernel.org/r/20150219170311.GH21418@twins.programming.kicks-ass.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/events')
-rw-r--r-- | kernel/events/core.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/kernel/events/core.c b/kernel/events/core.c index 453ef61311d4..2fabc0627165 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
@@ -4574,6 +4574,13 @@ static void perf_pending_event(struct irq_work *entry) | |||
4574 | { | 4574 | { |
4575 | struct perf_event *event = container_of(entry, | 4575 | struct perf_event *event = container_of(entry, |
4576 | struct perf_event, pending); | 4576 | struct perf_event, pending); |
4577 | int rctx; | ||
4578 | |||
4579 | rctx = perf_swevent_get_recursion_context(); | ||
4580 | /* | ||
4581 | * If we 'fail' here, that's OK, it means recursion is already disabled | ||
4582 | * and we won't recurse 'further'. | ||
4583 | */ | ||
4577 | 4584 | ||
4578 | if (event->pending_disable) { | 4585 | if (event->pending_disable) { |
4579 | event->pending_disable = 0; | 4586 | event->pending_disable = 0; |
@@ -4584,6 +4591,9 @@ static void perf_pending_event(struct irq_work *entry) | |||
4584 | event->pending_wakeup = 0; | 4591 | event->pending_wakeup = 0; |
4585 | perf_event_wakeup(event); | 4592 | perf_event_wakeup(event); |
4586 | } | 4593 | } |
4594 | |||
4595 | if (rctx >= 0) | ||
4596 | perf_swevent_put_recursion_context(rctx); | ||
4587 | } | 4597 | } |
4588 | 4598 | ||
4589 | /* | 4599 | /* |