• Peter Zijlstra's avatar
    perf_counter: Rework the perf counter disable/enable · 9e35ad38
    Peter Zijlstra authored
    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: default avatarPeter 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: default avatarIngo Molnar <mingo@elte.hu>
    9e35ad38
perf_counter.c 80.4 KB