diff options
Diffstat (limited to 'recipes-kernel/linux/files/perf-x86-fix-RAPL-rdmsrl_safe-usage.patch')
-rw-r--r-- | recipes-kernel/linux/files/perf-x86-fix-RAPL-rdmsrl_safe-usage.patch | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/recipes-kernel/linux/files/perf-x86-fix-RAPL-rdmsrl_safe-usage.patch b/recipes-kernel/linux/files/perf-x86-fix-RAPL-rdmsrl_safe-usage.patch new file mode 100644 index 0000000..058e676 --- /dev/null +++ b/recipes-kernel/linux/files/perf-x86-fix-RAPL-rdmsrl_safe-usage.patch | |||
@@ -0,0 +1,29 @@ | |||
1 | From: Stephane Eranian | ||
2 | Date: Wed Apr 23 2014 - 13:04:31 EST | ||
3 | This patch fixes a bug introduced by commit 24223657. | ||
4 | |||
5 | perf/x86: fix RAPL rdmsrl_safe() usage | ||
6 | |||
7 | The rdmsrl_safe() function returns 0 on success. | ||
8 | The current code was failing to detect the RAPL PMU | ||
9 | on real hardware (missing /sys/devices/power) because | ||
10 | the return value of rdmsrl_safe() was misinterpreted. | ||
11 | |||
12 | Signed-off-by: Stephane Eranian <eranian@xxxxxxxxxx> | ||
13 | Upstream-Status: Backport [http://lkml.iu.edu/hypermail/linux/kernel/1404.2/05008.html] | ||
14 | |||
15 | diff --git a/arch/x86/kernel/cpu/perf_event_intel_rapl.c b/arch/x86/kernel/cpu/perf_event_intel_rapl.c | ||
16 | index 7c87424..619f769 100644 | ||
17 | --- a/arch/x86/kernel/cpu/perf_event_intel_rapl.c | ||
18 | +++ b/arch/x86/kernel/cpu/perf_event_intel_rapl.c | ||
19 | @@ -543,7 +543,8 @@ static int rapl_cpu_prepare(int cpu) | ||
20 | if (phys_id < 0) | ||
21 | return -1; | ||
22 | |||
23 | - if (!rdmsrl_safe(MSR_RAPL_POWER_UNIT, &msr_rapl_power_unit_bits)) | ||
24 | + /* protect rdmsrl() to handle virtualization */ | ||
25 | + if (rdmsrl_safe(MSR_RAPL_POWER_UNIT, &msr_rapl_power_unit_bits)) | ||
26 | return -1; | ||
27 | |||
28 | pmu = kzalloc_node(sizeof(*pmu), GFP_KERNEL, cpu_to_node(cpu)); | ||
29 | -- | ||