perf counters: protect them against CSTATE transitions

Impact: fix rare lost events problem

There are CPUs whose performance counters misbehave on CSTATE transitions,
so provide a way to just disable/enable them around deep idle methods.

(hw_perf_enable_all() is cheap on x86.)

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
Thomas Gleixner
2008-12-09 21:43:39 +01:00
committed by Ingo Molnar
parent 43874d238d
commit 4ac13294e4
3 changed files with 26 additions and 2 deletions

View File

@ -156,6 +156,8 @@ extern void perf_counter_task_tick(struct task_struct *task, int cpu);
extern void perf_counter_init_task(struct task_struct *task);
extern void perf_counter_notify(struct pt_regs *regs);
extern void perf_counter_print_debug(void);
extern void hw_perf_restore_ctrl(u64 ctrl);
extern u64 hw_perf_disable_all(void);
#else
static inline void
perf_counter_task_sched_in(struct task_struct *task, int cpu) { }
@ -166,6 +168,8 @@ perf_counter_task_tick(struct task_struct *task, int cpu) { }
static inline void perf_counter_init_task(struct task_struct *task) { }
static inline void perf_counter_notify(struct pt_regs *regs) { }
static inline void perf_counter_print_debug(void) { }
static inline void hw_perf_restore_ctrl(u64 ctrl) { }
static inline u64 hw_perf_disable_all(void) { return 0; }
#endif
#endif /* _LINUX_PERF_COUNTER_H */