]> git.baikalelectronics.ru Git - kernel.git/commit
perf_counter: Rework the perf counter disable/enable
authorPeter Zijlstra <a.p.zijlstra@chello.nl>
Wed, 13 May 2009 14:21:38 +0000 (16:21 +0200)
committerIngo Molnar <mingo@elte.hu>
Fri, 15 May 2009 07:47:02 +0000 (09:47 +0200)
commit3a00654d03023057ec411f45bef678f1c69ae0e0
tree9abbce9f6c9a914b1ea8d8dae82e159366030e4a
parent12b804037fd8c3c93d2cbda696ed2eb9402230ba
perf_counter: Rework the perf counter disable/enable

The current disable/enable mechanism is:

token = hw_perf_save_disable();
...
/* do bits */
...
hw_perf_restore(token);

This works well, provided that the use nests properly. Except we don't.

x86 NMI/INT throttling has non-nested use of this, breaking things. Therefore
provide a reference counter disable/enable interface, where the first disable
disables the hardware, and the last enable enables the hardware again.

[ Impact: refactor, simplify the PMU disable/enable logic ]

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/powerpc/kernel/perf_counter.c
arch/x86/kernel/cpu/perf_counter.c
drivers/acpi/processor_idle.c
include/linux/perf_counter.h
kernel/perf_counter.c