Skip to content

Commit

Permalink
perf, x86, Do not user perf_disable from NMI context
Browse files Browse the repository at this point in the history
Explicitly use intel_pmu_{disable,enable}_all() in intel_pmu_handle_irq()
to avoid the NMI race conditions in perf_{disable,enable}

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: paulus@samba.org
Cc: eranian@google.com
Cc: robert.richter@amd.com
Cc: fweisbec@gmail.com
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Mar 10, 2010
1 parent 32975a4 commit 3fb2b8d
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions arch/x86/kernel/cpu/perf_event_intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -745,11 +745,11 @@ static int intel_pmu_handle_irq(struct pt_regs *regs)

cpuc = &__get_cpu_var(cpu_hw_events);

perf_disable();
intel_pmu_disable_all();
intel_pmu_drain_bts_buffer();
status = intel_pmu_get_status();
if (!status) {
perf_enable();
intel_pmu_enable_all();
return 0;
}

Expand All @@ -759,8 +759,7 @@ static int intel_pmu_handle_irq(struct pt_regs *regs)
WARN_ONCE(1, "perfevents: irq loop stuck!\n");
perf_event_print_debug();
intel_pmu_reset();
perf_enable();
return 1;
goto done;
}

inc_irq_stat(apic_perf_irqs);
Expand Down Expand Up @@ -790,8 +789,8 @@ static int intel_pmu_handle_irq(struct pt_regs *regs)
if (status)
goto again;

perf_enable();

done:
intel_pmu_enable_all();
return 1;
}

Expand Down

0 comments on commit 3fb2b8d

Please sign in to comment.