Skip to content

Commit

Permalink
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
torvalds committed Jun 15, 2015
2 parents 2fbbada + 15c1247 commit d37479a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
9 changes: 7 additions & 2 deletions arch/x86/kernel/cpu/perf_event_intel_uncore.c
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,7 @@ static int uncore_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id
box->phys_id = phys_id;
box->pci_dev = pdev;
box->pmu = pmu;
uncore_box_init(box);
pci_set_drvdata(pdev, box);

raw_spin_lock(&uncore_box_lock);
Expand Down Expand Up @@ -1002,8 +1003,10 @@ static int uncore_cpu_starting(int cpu)
pmu = &type->pmus[j];
box = *per_cpu_ptr(pmu->box, cpu);
/* called by uncore_cpu_init? */
if (box && box->phys_id >= 0)
if (box && box->phys_id >= 0) {
uncore_box_init(box);
continue;
}

for_each_online_cpu(k) {
exist = *per_cpu_ptr(pmu->box, k);
Expand All @@ -1019,8 +1022,10 @@ static int uncore_cpu_starting(int cpu)
}
}

if (box)
if (box) {
box->phys_id = phys_id;
uncore_box_init(box);
}
}
}
return 0;
Expand Down
18 changes: 8 additions & 10 deletions arch/x86/kernel/cpu/perf_event_intel_uncore.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,14 +258,6 @@ static inline int uncore_num_counters(struct intel_uncore_box *box)
return box->pmu->type->num_counters;
}

static inline void uncore_box_init(struct intel_uncore_box *box)
{
if (!test_and_set_bit(UNCORE_BOX_FLAG_INITIATED, &box->flags)) {
if (box->pmu->type->ops->init_box)
box->pmu->type->ops->init_box(box);
}
}

static inline void uncore_disable_box(struct intel_uncore_box *box)
{
if (box->pmu->type->ops->disable_box)
Expand All @@ -274,8 +266,6 @@ static inline void uncore_disable_box(struct intel_uncore_box *box)

static inline void uncore_enable_box(struct intel_uncore_box *box)
{
uncore_box_init(box);

if (box->pmu->type->ops->enable_box)
box->pmu->type->ops->enable_box(box);
}
Expand All @@ -298,6 +288,14 @@ static inline u64 uncore_read_counter(struct intel_uncore_box *box,
return box->pmu->type->ops->read_counter(box, event);
}

static inline void uncore_box_init(struct intel_uncore_box *box)
{
if (!test_and_set_bit(UNCORE_BOX_FLAG_INITIATED, &box->flags)) {
if (box->pmu->type->ops->init_box)
box->pmu->type->ops->init_box(box);
}
}

static inline bool uncore_box_is_fake(struct intel_uncore_box *box)
{
return (box->phys_id < 0);
Expand Down
6 changes: 3 additions & 3 deletions arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@
((1ULL << (n)) - 1)))

/* Haswell-EP Ubox */
#define HSWEP_U_MSR_PMON_CTR0 0x705
#define HSWEP_U_MSR_PMON_CTL0 0x709
#define HSWEP_U_MSR_PMON_CTR0 0x709
#define HSWEP_U_MSR_PMON_CTL0 0x705
#define HSWEP_U_MSR_PMON_FILTER 0x707

#define HSWEP_U_MSR_PMON_UCLK_FIXED_CTL 0x703
Expand Down Expand Up @@ -1914,7 +1914,7 @@ static struct intel_uncore_type hswep_uncore_cbox = {
.name = "cbox",
.num_counters = 4,
.num_boxes = 18,
.perf_ctr_bits = 44,
.perf_ctr_bits = 48,
.event_ctl = HSWEP_C0_MSR_PMON_CTL0,
.perf_ctr = HSWEP_C0_MSR_PMON_CTR0,
.event_mask = SNBEP_CBO_MSR_PMON_RAW_EVENT_MASK,
Expand Down

0 comments on commit d37479a

Please sign in to comment.