提交 2b9ff0db 编写于 作者: I Ingo Molnar

perfcounters: fix non-intel-perfmon CPUs

Do not write MSR_CORE_PERF_GLOBAL_CTRL on CPUs where it does not exist.
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 e06c61a8
......@@ -157,6 +157,9 @@ static int __hw_perf_counter_init(struct perf_counter *counter)
void hw_perf_enable_all(void)
{
if (unlikely(!perf_counters_initialized))
return;
wrmsr(MSR_CORE_PERF_GLOBAL_CTRL, perf_counter_mask, 0);
}
......@@ -164,14 +167,21 @@ u64 hw_perf_save_disable(void)
{
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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册