void hw_perf_enable_all(void)
{
+ if (unlikely(!perf_counters_initialized))
+ return;
+
wrmsr(MSR_CORE_PERF_GLOBAL_CTRL, perf_counter_mask, 0);
}
{
u64 ctrl;
+ if (unlikely(!perf_counters_initialized))
+ return 0;
+
rdmsrl(MSR_CORE_PERF_GLOBAL_CTRL, ctrl);
wrmsr(MSR_CORE_PERF_GLOBAL_CTRL, 0, 0);
+
return ctrl;
}
EXPORT_SYMBOL_GPL(hw_perf_save_disable);
void hw_perf_restore(u64 ctrl)
{
+ if (unlikely(!perf_counters_initialized))
+ return;
+
wrmsr(MSR_CORE_PERF_GLOBAL_CTRL, ctrl, 0);
}
EXPORT_SYMBOL_GPL(hw_perf_restore);