diff options
author | Stephane Eranian <eranian@google.com> | 2014-04-23 19:04:19 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2014-04-24 08:12:41 +0200 |
commit | 9f7ff8931e3c5ddc8535476971ec9501e9555c05 (patch) | |
tree | 9d92eb11e72942ff41a3e603548041c7f3033c89 /arch/x86/kernel | |
parent | 89b90ee37a76a2bb05cc8ced30364b0de001f523 (diff) | |
download | op-kernel-dev-9f7ff8931e3c5ddc8535476971ec9501e9555c05.zip op-kernel-dev-9f7ff8931e3c5ddc8535476971ec9501e9555c05.tar.gz |
perf/x86: Fix RAPL rdmsrl_safe() usage
This patch fixes a bug introduced by:
24223657806a ("perf/x86/intel: Use rdmsrl_safe() when initializing RAPL PMU")
The rdmsrl_safe() function returns 0 on success.
The current code was failing to detect the RAPL PMU
on real hardware (missing /sys/devices/power) because
the return value of rdmsrl_safe() was misinterpreted.
Signed-off-by: Stephane Eranian <eranian@google.com>
Acked-by: Borislav Petkov <bp@suse.de>
Acked-by: Venkatesh Srinivas <venkateshs@google.com>
Cc: peterz@infradead.org
Cc: zheng.z.yan@intel.com
Link: http://lkml.kernel.org/r/20140423170418.GA12767@quad
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r-- | arch/x86/kernel/cpu/perf_event_intel_rapl.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/x86/kernel/cpu/perf_event_intel_rapl.c b/arch/x86/kernel/cpu/perf_event_intel_rapl.c index 7c87424..619f769 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_rapl.c +++ b/arch/x86/kernel/cpu/perf_event_intel_rapl.c @@ -543,7 +543,8 @@ static int rapl_cpu_prepare(int cpu) if (phys_id < 0) return -1; - if (!rdmsrl_safe(MSR_RAPL_POWER_UNIT, &msr_rapl_power_unit_bits)) + /* protect rdmsrl() to handle virtualization */ + if (rdmsrl_safe(MSR_RAPL_POWER_UNIT, &msr_rapl_power_unit_bits)) return -1; pmu = kzalloc_node(sizeof(*pmu), GFP_KERNEL, cpu_to_node(cpu)); |