perf/x86/intel: Use rdmsrl_safe() when initializing RAPL PMU
authorVenkatesh Srinivas <[email protected]>
Thu, 13 Mar 2014 19:36:26 +0000 (12:36 -0700)
committerIngo Molnar <[email protected]>
Fri, 18 Apr 2014 10:14:26 +0000 (12:14 +0200)
commit24223657806a0ebd0ae5c9caaf7b021091889cf2
tree46f5e36797458f19f0fd1f53f6e0ac00de82f00a
parent6381c24cd6d5d6373620426ab0a96c80ed953e20
perf/x86/intel: Use rdmsrl_safe() when initializing RAPL PMU

CPUs which should support the RAPL counters according to
Family/Model/Stepping may still issue #GP when attempting to access
the RAPL MSRs. This may happen when Linux is running under KVM and
we are passing-through host F/M/S data, for example. Use rdmsrl_safe
to first access the RAPL_POWER_UNIT MSR; if this fails, do not
attempt to use this PMU.

Signed-off-by: Venkatesh Srinivas <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
[ The patch also silently fixes another bug: rapl_pmu_init() didn't handle the memory alloc failure case previously. ]
Signed-off-by: Ingo Molnar <[email protected]>
arch/x86/kernel/cpu/perf_event_intel_rapl.c