aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/perf_counter.c
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2009-08-13 05:47:54 -0400
committerIngo Molnar <mingo@elte.hu>2009-08-13 06:58:05 -0400
commit970892a9031a5dc7217bd394fb9d89fa75a4a7bc (patch)
treed6d5eee6d24cde67c279d5cc753512fc85cd9e5b /kernel/perf_counter.c
parent3dab77fb1bf89664bb1c9544607159dcab6f7d57 (diff)
perf_counter: Fix an ipi-deadlock
perf_pending_counter() is called from IRQ context and will call perf_counter_disable(), however perf_counter_disable() uses smp_call_function_single() which doesn't fancy being used with IRQs disabled due to IPI deadlocks. Fix this by making it use the local __perf_counter_disable() call and teaching the counter_sched_out() code about pending disables as well. This should cover the case where a counter migrates before the pending queue gets processed. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Corey J Ashford <cjashfor@us.ibm.com> Cc: Paul Mackerras <paulus@samba.org> Cc: stephane eranian <eranian@googlemail.com> LKML-Reference: <20090813103655.244097721@chello.nl> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/perf_counter.c')
-rw-r--r--kernel/perf_counter.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index b8c6b97a20a3..3f841beefc7b 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -307,6 +307,10 @@ counter_sched_out(struct perf_counter *counter,
307 return; 307 return;
308 308
309 counter->state = PERF_COUNTER_STATE_INACTIVE; 309 counter->state = PERF_COUNTER_STATE_INACTIVE;
310 if (counter->pending_disable) {
311 counter->pending_disable = 0;
312 counter->state = PERF_COUNTER_STATE_OFF;
313 }
310 counter->tstamp_stopped = ctx->time; 314 counter->tstamp_stopped = ctx->time;
311 counter->pmu->disable(counter); 315 counter->pmu->disable(counter);
312 counter->oncpu = -1; 316 counter->oncpu = -1;
@@ -2343,7 +2347,7 @@ static void perf_pending_counter(struct perf_pending_entry *entry)
2343 2347
2344 if (counter->pending_disable) { 2348 if (counter->pending_disable) {
2345 counter->pending_disable = 0; 2349 counter->pending_disable = 0;
2346 perf_counter_disable(counter); 2350 __perf_counter_disable(counter);
2347 } 2351 }
2348 2352
2349 if (counter->pending_wakeup) { 2353 if (counter->pending_wakeup) {