]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.14-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 3 Oct 2014 21:05:36 +0000 (14:05 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 3 Oct 2014 21:05:36 +0000 (14:05 -0700)
added patches:
perf-x86-intel-use-rdmsrl_safe-when-initializing-rapl-pmu.patch

queue-3.14/perf-x86-intel-use-rdmsrl_safe-when-initializing-rapl-pmu.patch [new file with mode: 0644]
queue-3.14/series

diff --git a/queue-3.14/perf-x86-intel-use-rdmsrl_safe-when-initializing-rapl-pmu.patch b/queue-3.14/perf-x86-intel-use-rdmsrl_safe-when-initializing-rapl-pmu.patch
new file mode 100644 (file)
index 0000000..876ea0f
--- /dev/null
@@ -0,0 +1,83 @@
+From 24223657806a0ebd0ae5c9caaf7b021091889cf2 Mon Sep 17 00:00:00 2001
+From: Venkatesh Srinivas <venkateshs@google.com>
+Date: Thu, 13 Mar 2014 12:36:26 -0700
+Subject: perf/x86/intel: Use rdmsrl_safe() when initializing RAPL PMU
+
+From: Venkatesh Srinivas <venkateshs@google.com>
+
+commit 24223657806a0ebd0ae5c9caaf7b021091889cf2 upstream.
+
+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 <venkateshs@google.com>
+Signed-off-by: Peter Zijlstra <peterz@infradead.org>
+Link: http://lkml.kernel.org/r/1394739386-22260-1-git-send-email-venkateshs@google.com
+Cc: zheng.z.yan@intel.com
+Cc: eranian@google.com
+Cc: ak@linux.intel.com
+Cc: linux-kernel@vger.kernel.org
+[ The patch also silently fixes another bug: rapl_pmu_init() didn't handle the memory alloc failure case previously. ]
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+[backport by whissi]
+Cc: Thomas D <whissi@whissi.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+
+---
+ arch/x86/kernel/cpu/perf_event_intel_rapl.c |   12 +++++++++---
+ 1 file changed, 9 insertions(+), 3 deletions(-)
+
+--- a/arch/x86/kernel/cpu/perf_event_intel_rapl.c
++++ b/arch/x86/kernel/cpu/perf_event_intel_rapl.c
+@@ -511,6 +511,7 @@ static int rapl_cpu_prepare(int cpu)
+       struct rapl_pmu *pmu = per_cpu(rapl_pmu, cpu);
+       int phys_id = topology_physical_package_id(cpu);
+       u64 ms;
++      u64 msr_rapl_power_unit_bits;
+       if (pmu)
+               return 0;
+@@ -518,6 +519,9 @@ 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))
++              return -1;
++
+       pmu = kzalloc_node(sizeof(*pmu), GFP_KERNEL, cpu_to_node(cpu));
+       if (!pmu)
+               return -1;
+@@ -531,8 +535,7 @@ static int rapl_cpu_prepare(int cpu)
+        *
+        * we cache in local PMU instance
+        */
+-      rdmsrl(MSR_RAPL_POWER_UNIT, pmu->hw_unit);
+-      pmu->hw_unit = (pmu->hw_unit >> 8) & 0x1FULL;
++      pmu->hw_unit = (msr_rapl_power_unit_bits >> 8) & 0x1FULL;
+       pmu->pmu = &rapl_pmu_class;
+       /*
+@@ -649,7 +652,9 @@ static int __init rapl_pmu_init(void)
+       get_online_cpus();
+       for_each_online_cpu(cpu) {
+-              rapl_cpu_prepare(cpu);
++              ret = rapl_cpu_prepare(cpu);
++              if (ret)
++                      goto out;
+               rapl_cpu_init(cpu);
+       }
+@@ -672,6 +677,7 @@ static int __init rapl_pmu_init(void)
+               hweight32(rapl_cntr_mask),
+               ktime_to_ms(pmu->timer_interval));
++out:
+       put_online_cpus();
+       return 0;
index 983a9c351704996a10ad8603191452e73c231100..4f22ff2e94dd15191b461521a63a8384eef7f5e4 100644 (file)
@@ -230,3 +230,4 @@ serial-8250_dma-check-the-result-of-tx-buffer-mapping.patch
 dmaengine-dw-introduce-dwc_dostart_first_queued-helper.patch
 dmaengine-dw-don-t-perform-dma-when-dmaengine_submit-is-called.patch
 partitions-aix.c-off-by-one-bug.patch
+perf-x86-intel-use-rdmsrl_safe-when-initializing-rapl-pmu.patch