aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-06-14 20:00:13 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-06-14 20:00:13 -0400
commitd37479aac53d9e3d6e4b628a727a84021cbb4bd5 (patch)
treefdc0432a3d25fb105ce5fe79ab799f8945f961cf /arch
parent2fbbada1e1f321a0d525eae77d45acb56e7e9b52 (diff)
parent15c1247953e8a45232ed5a5540f291d2d0a77665 (diff)
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf fixes from Ingo Molnar: "A regression fix for a crash, and a Intel HSW uncore PMU driver fix" * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: Revert "perf/x86/intel/uncore: Move uncore_box_init() out of driver initialization" perf/x86/intel/uncore: Fix CBOX bit wide and UBOX reg on Haswell-EP
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_uncore.c9
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_uncore.h18
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c6
3 files changed, 18 insertions, 15 deletions
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
index dd319e59246b..90b7c501c95b 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
@@ -839,6 +839,7 @@ static int uncore_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id
839 box->phys_id = phys_id; 839 box->phys_id = phys_id;
840 box->pci_dev = pdev; 840 box->pci_dev = pdev;
841 box->pmu = pmu; 841 box->pmu = pmu;
842 uncore_box_init(box);
842 pci_set_drvdata(pdev, box); 843 pci_set_drvdata(pdev, box);
843 844
844 raw_spin_lock(&uncore_box_lock); 845 raw_spin_lock(&uncore_box_lock);
@@ -1002,8 +1003,10 @@ static int uncore_cpu_starting(int cpu)
1002 pmu = &type->pmus[j]; 1003 pmu = &type->pmus[j];
1003 box = *per_cpu_ptr(pmu->box, cpu); 1004 box = *per_cpu_ptr(pmu->box, cpu);
1004 /* called by uncore_cpu_init? */ 1005 /* called by uncore_cpu_init? */
1005 if (box && box->phys_id >= 0) 1006 if (box && box->phys_id >= 0) {
1007 uncore_box_init(box);
1006 continue; 1008 continue;
1009 }
1007 1010
1008 for_each_online_cpu(k) { 1011 for_each_online_cpu(k) {
1009 exist = *per_cpu_ptr(pmu->box, k); 1012 exist = *per_cpu_ptr(pmu->box, k);
@@ -1019,8 +1022,10 @@ static int uncore_cpu_starting(int cpu)
1019 } 1022 }
1020 } 1023 }
1021 1024
1022 if (box) 1025 if (box) {
1023 box->phys_id = phys_id; 1026 box->phys_id = phys_id;
1027 uncore_box_init(box);
1028 }
1024 } 1029 }
1025 } 1030 }
1026 return 0; 1031 return 0;
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.h b/arch/x86/kernel/cpu/perf_event_intel_uncore.h
index f789ec9a0133..ceac8f5dc018 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.h
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.h
@@ -258,14 +258,6 @@ static inline int uncore_num_counters(struct intel_uncore_box *box)
258 return box->pmu->type->num_counters; 258 return box->pmu->type->num_counters;
259} 259}
260 260
261static inline void uncore_box_init(struct intel_uncore_box *box)
262{
263 if (!test_and_set_bit(UNCORE_BOX_FLAG_INITIATED, &box->flags)) {
264 if (box->pmu->type->ops->init_box)
265 box->pmu->type->ops->init_box(box);
266 }
267}
268
269static inline void uncore_disable_box(struct intel_uncore_box *box) 261static inline void uncore_disable_box(struct intel_uncore_box *box)
270{ 262{
271 if (box->pmu->type->ops->disable_box) 263 if (box->pmu->type->ops->disable_box)
@@ -274,8 +266,6 @@ static inline void uncore_disable_box(struct intel_uncore_box *box)
274 266
275static inline void uncore_enable_box(struct intel_uncore_box *box) 267static inline void uncore_enable_box(struct intel_uncore_box *box)
276{ 268{
277 uncore_box_init(box);
278
279 if (box->pmu->type->ops->enable_box) 269 if (box->pmu->type->ops->enable_box)
280 box->pmu->type->ops->enable_box(box); 270 box->pmu->type->ops->enable_box(box);
281} 271}
@@ -298,6 +288,14 @@ static inline u64 uncore_read_counter(struct intel_uncore_box *box,
298 return box->pmu->type->ops->read_counter(box, event); 288 return box->pmu->type->ops->read_counter(box, event);
299} 289}
300 290
291static inline void uncore_box_init(struct intel_uncore_box *box)
292{
293 if (!test_and_set_bit(UNCORE_BOX_FLAG_INITIATED, &box->flags)) {
294 if (box->pmu->type->ops->init_box)
295 box->pmu->type->ops->init_box(box);
296 }
297}
298
301static inline bool uncore_box_is_fake(struct intel_uncore_box *box) 299static inline bool uncore_box_is_fake(struct intel_uncore_box *box)
302{ 300{
303 return (box->phys_id < 0); 301 return (box->phys_id < 0);
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c b/arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c
index 12d9548457e7..6d6e85dd5849 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c
@@ -164,8 +164,8 @@
164 ((1ULL << (n)) - 1))) 164 ((1ULL << (n)) - 1)))
165 165
166/* Haswell-EP Ubox */ 166/* Haswell-EP Ubox */
167#define HSWEP_U_MSR_PMON_CTR0 0x705 167#define HSWEP_U_MSR_PMON_CTR0 0x709
168#define HSWEP_U_MSR_PMON_CTL0 0x709 168#define HSWEP_U_MSR_PMON_CTL0 0x705
169#define HSWEP_U_MSR_PMON_FILTER 0x707 169#define HSWEP_U_MSR_PMON_FILTER 0x707
170 170
171#define HSWEP_U_MSR_PMON_UCLK_FIXED_CTL 0x703 171#define HSWEP_U_MSR_PMON_UCLK_FIXED_CTL 0x703
@@ -1914,7 +1914,7 @@ static struct intel_uncore_type hswep_uncore_cbox = {
1914 .name = "cbox", 1914 .name = "cbox",
1915 .num_counters = 4, 1915 .num_counters = 4,
1916 .num_boxes = 18, 1916 .num_boxes = 18,
1917 .perf_ctr_bits = 44, 1917 .perf_ctr_bits = 48,
1918 .event_ctl = HSWEP_C0_MSR_PMON_CTL0, 1918 .event_ctl = HSWEP_C0_MSR_PMON_CTL0,
1919 .perf_ctr = HSWEP_C0_MSR_PMON_CTR0, 1919 .perf_ctr = HSWEP_C0_MSR_PMON_CTR0,
1920 .event_mask = SNBEP_CBO_MSR_PMON_RAW_EVENT_MASK, 1920 .event_mask = SNBEP_CBO_MSR_PMON_RAW_EVENT_MASK,