Skip to content

Commit

Permalink
perf,x86: fix wrmsr_on_cpu() warning on suspend/resume
Browse files Browse the repository at this point in the history
Commit 1d9d863 ("perf,x86: fix kernel crash with PEBS/BTS after
suspend/resume") fixed a crash when doing PEBS performance profiling
after resuming, but in using init_debug_store_on_cpu() to restore the
DS_AREA mtrr it also resulted in a new WARN_ON() triggering.

init_debug_store_on_cpu() uses "wrmsr_on_cpu()", which in turn uses CPU
cross-calls to do the MSR update.  Which is not really valid at the
early resume stage, and the warning is quite reasonable.  Now, it all
happens to _work_, for the simple reason that smp_call_function_single()
ends up just doing the call directly on the CPU when the CPU number
matches, but we really should just do the wrmsr() directly instead.

This duplicates the wrmsr() logic, but hopefully we can just remove the
wrmsr_on_cpu() version eventually.

Reported-and-tested-by: Parag Warudkar <[email protected]>
Cc: [email protected]
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
torvalds committed Mar 17, 2013
1 parent 0863702 commit 2a6e06b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion arch/x86/kernel/cpu/perf_event_intel_ds.c
Original file line number Diff line number Diff line change
Expand Up @@ -732,8 +732,10 @@ void intel_ds_init(void)

void perf_restore_debug_store(void)
{
struct debug_store *ds = __this_cpu_read(cpu_hw_events.ds);

if (!x86_pmu.bts && !x86_pmu.pebs)
return;

init_debug_store_on_cpu(smp_processor_id());
wrmsrl(MSR_IA32_DS_AREA, (unsigned long)ds);
}

0 comments on commit 2a6e06b

Please sign in to comment.