Skip to contentSkip to conversation

Broadwell perf support

PATCH In review Andi Kleen 4 participants 18 messages Aug 25, 2014 – Nov 4, 2014

Subsystems (2)
lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

Updated version of the perf Broadwell patchkit. This also has some fixes for Haswell.

This addresses all earlier feedback. Too low user specified periods on INST_RETIRED.ALL are now rejected with an error. The Haswell models are documented. The event matches use the perf macros.

-Andi

author
#1 lore raw

PATCH 1/5 perf, x86: Remove incorrect model number from Haswell perf

From: Andi Kleen <[email protected]>

---
 arch/x86/kernel/cpu/perf_event_intel.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/kernel/cpu/perf_event_intel.c +1 -2
index 89bc750..e280a86 100644
@@ -2541,10 +2541,9 @@ __init int intel_pmu_init(void)
 
 
 	case 60: /* 22nm Haswell */
+	case 70:
 	case 63:
 	case 69:
-	case 70:
-	case 71:
 		x86_pmu.late_ack = true;
 		memcpy(hw_cache_event_ids, snb_hw_cache_event_ids, sizeof(hw_cache_event_ids));
 		memcpy(hw_cache_extra_regs, snb_hw_cache_extra_regs, sizeof(hw_cache_extra_regs));
Signature · 1 line
1.9.3
#2 lore raw

Re: [PATCH 1/5] perf, x86: Remove incorrect model number from Haswell perf

Quoted 12 lines · Andi Kleen

From: Andi Kleen <[email protected]>

---
 arch/x86/kernel/cpu/perf_event_intel.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/kernel/cpu/perf_event_intel.c +0 -0
index 89bc750..e280a86 100644

arch/x86/kernel/cpu/perf_event_intel.c __init int intel_pmu_init(void) · line 2547

Quoted 8 lines
arch/x86/kernel/cpu/perf_event_intel.c +1 -2
@@ -2541,10 +2541,9 @@ __init int intel_pmu_init(void)
 
 
 	case 60: /* 22nm Haswell */
+	case 70:
 	case 63:
 	case 69:
-	case 70:
-	case 71:

So what's the point of making the obvious onliner patch

- case 71:

into something which reorders the sorted case numbers?

And of course, this patch is missing any explanation WHY 71 is incorrect and how it got there in the first place.

Thanks,

tglx

author
#3 lore raw

Re: [PATCH 1/5] perf, x86: Remove incorrect model number from Haswell perf

Quoted 5 lines

So what's the point of making the obvious onliner patch

arch/x86/kernel/cpu/perf_event_intel.c +0 -1
-	case 71:

into something which reorders the sorted case numbers?

This was a merging mistake. I'll fix it to be a one liner.

Quoted 2 lines

And of course, this patch is missing any explanation WHY 71 is incorrect and how it got there in the first place.

71 is a Broadwell, as you would know if you had read the next patch.

-Andi

#4 lore raw

Re: [PATCH 1/5] perf, x86: Remove incorrect model number from Haswell perf

Quoted 4 lines · Andi Kleen
Quoted 4 lines

So what's the point of making the obvious onliner patch

arch/x86/kernel/cpu/perf_event_intel.c +0 -1
-	case 71:
Quoted 8 lines
Quoted 1 line

into something which reorders the sorted case numbers?

This was a merging mistake. I'll fix it to be a one liner.

Quoted 2 lines

And of course, this patch is missing any explanation WHY 71 is incorrect and how it got there in the first place.

71 is a Broadwell, as you would know if you had read the next patch.

And why on earth do I need to read the next patch to figure out what the heck this patch is doing?

Just because it's written by someone who gives a shit?

Your unwillingness to cooperate and your advisory resistance are slowly approaching the Krause level...

Thanks,

tglx

#5 lore raw

Re: [PATCH 1/5] perf, x86: Remove incorrect model number from Haswell perf

Quoted 15 lines · Thomas Gleixner
Quoted 4 lines · Andi Kleen
Quoted 4 lines

So what's the point of making the obvious onliner patch

arch/x86/kernel/cpu/perf_event_intel.c +0 -1
-	case 71:
Quoted 8 lines
Quoted 1 line

into something which reorders the sorted case numbers?

This was a merging mistake. I'll fix it to be a one liner.

Quoted 2 lines

And of course, this patch is missing any explanation WHY 71 is incorrect and how it got there in the first place.

71 is a Broadwell, as you would know if you had read the next patch.

Quoted 7 lines

And why on earth do I need to read the next patch to figure out what the heck this patch is doing?

Just because it's written by someone who gives a shit?

Your unwillingness to cooperate and your advisory resistance are slowly approaching the Krause level...

And after reading the next patch I still can't see that 71 is a broadwell, because the next patch merily adds haswell names to the numbers. Neither of the following patches has the magic 71 incorporated. The only model number related to broadwell is 61 in patch 3/5.

Try again when you figured yourself out what number means what and why 71 is bogus.

Thanks,

tglx

author
#6 lore raw

Re: [PATCH 1/5] perf, x86: Remove incorrect model number from Haswell perf

Quoted 22 lines · Thomas Gleixner
Quoted 20 lines · Thomas Gleixner
Quoted 4 lines · Andi Kleen
Quoted 4 lines

So what's the point of making the obvious onliner patch

arch/x86/kernel/cpu/perf_event_intel.c +0 -1
-	case 71:
Quoted 8 lines
Quoted 1 line

into something which reorders the sorted case numbers?

This was a merging mistake. I'll fix it to be a one liner.

Quoted 2 lines

And of course, this patch is missing any explanation WHY 71 is incorrect and how it got there in the first place.

71 is a Broadwell, as you would know if you had read the next patch.

And why on earth do I need to read the next patch to figure out what the heck this patch is doing?

Just because it's written by someone who gives a shit?

Quoted 8 lines
Quoted 2 lines

Your unwillingness to cooperate and your advisory resistance are slowly approaching the Krause level...

And after reading the next patch I still can't see that 71 is a broadwell, because the next patch merily adds haswell names to the numbers. Neither of the following patches has the magic 71 incorporated. The only model number related to broadwell is 61 in patch 3/5.

Ok fair enough.

It was true for v1, but not for v2.

Quoted 2 lines

Try again when you figured yourself out what number means what and why 71 is bogus.

71 is definitely not a Haswell, but a Broadwell.

However it was removed from the Broadwell patch based on Peter's feedback.

So technically the patch is not needed right now because there would be no duplicates (unless 71 was readded), so the compiler would not complain.

However it's still incorrect for Haswell, so I maintain removing it is the right thing to do.

-Andi

#7 lore raw

Re: [PATCH 1/5] perf, x86: Remove incorrect model number from Haswell perf

Quoted 5 lines · Andi Kleen
Quoted 2 lines · Thomas Gleixner

Try again when you figured yourself out what number means what and why 71 is bogus.

71 is definitely not a Haswell, but a Broadwell.

Fine. So the changelog should tell so.

Quoted 6 lines

However it was removed from the Broadwell patch based on Peter's feedback.

So technically the patch is not needed right now because there would be no duplicates (unless 71 was readded), so the compiler would not complain.

It's very well technically needed simply because its not a haswell and if it's run on real model 71 hardware we'll get some interesting stuff to debug.

Quoted 2 lines

However it's still incorrect for Haswell, so I maintain removing it is the right thing to do.

I did not argue against the removal itself. That's fine and obviously correct if model 71 is not a haswell. All I want is a proper patch (1 line) and a proper changelog explaining WHY this is the right thing to do.

Thanks,

tglx

author
#8 lore raw

PATCH 2/5 perf, x86: Document all Haswell models

In reply to Andi Kleen

From: Andi Kleen <[email protected]>

Add names for each Haswell model as requested by Peter.

v2: Remove Crystall Well name.

---
 arch/x86/kernel/cpu/perf_event_intel.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/x86/kernel/cpu/perf_event_intel.c +4 -4
index e280a86..0e9c272 100644
@@ -2540,10 +2540,10 @@ __init int intel_pmu_init(void)
 		break;
 
 
-	case 60: /* 22nm Haswell */
-	case 70:
-	case 63:
-	case 69:
+	case 60: /* 22nm Haswell Client */
+	case 70: /* 22nm Haswell Client */
+	case 63: /* 22nm Haswell Server */
+	case 69: /* 22nm Haswell ULT */
 		x86_pmu.late_ack = true;
 		memcpy(hw_cache_event_ids, snb_hw_cache_event_ids, sizeof(hw_cache_event_ids));
 		memcpy(hw_cache_extra_regs, snb_hw_cache_extra_regs, sizeof(hw_cache_extra_regs));
Signature · 1 line
1.9.3
maintainer
#9 lore raw

Re: [PATCH 2/5] perf, x86: Document all Haswell models

arch/x86/kernel/cpu/perf_event_intel.c __init int intel_pmu_init(void) · line 2546

Quoted 11 lines · Andi Kleen

From: Andi Kleen <[email protected]>

Add names for each Haswell model as requested by Peter.

v2: Remove Crystall Well name.

arch/x86/kernel/cpu/perf_event_intel.c +4 -0
+	case 60: /* 22nm Haswell Client */
+	case 70: /* 22nm Haswell Client */
+	case 63: /* 22nm Haswell Server */
+	case 69: /* 22nm Haswell ULT */

That's inconsistent with all the others. I gave you one that makes sense, why not use it?

author
#10 lore raw

PATCH 3/5 perf, x86: Add Broadwell core support

In reply to Andi Kleen

From: Andi Kleen <[email protected]>

Add Broadwell support for Broadwell Client to perf. This is very similar to Haswell. It uses a new cache event table, because there were various changes there.

The constraint list has one new event that needs to be handled over Haswell.

The PEBS event list is the same, so we reuse Haswell's.

v2: Remove unnamed model numbers.

---
 arch/x86/kernel/cpu/perf_event_intel.c | 150 +++++++++++++++++++++++++++++++++
 1 file changed, 150 insertions(+)
arch/x86/kernel/cpu/perf_event_intel.c +150 -0
index 0e9c272..1cca4ae 100644
@@ -220,6 +220,15 @@ static struct event_constraint intel_hsw_event_constraints[] = {
 	EVENT_CONSTRAINT_END
 };
 
+struct event_constraint intel_bdw_event_constraints[] = {
+	FIXED_EVENT_CONSTRAINT(0x00c0, 0),	/* INST_RETIRED.ANY */
+	FIXED_EVENT_CONSTRAINT(0x003c, 1),	/* CPU_CLK_UNHALTED.CORE */
+	FIXED_EVENT_CONSTRAINT(0x0300, 2),	/* CPU_CLK_UNHALTED.REF */
+	INTEL_UEVENT_CONSTRAINT(0x148, 0x4),	/* L1D_PEND_MISS.PENDING */
+	INTEL_EVENT_CONSTRAINT(0xa3, 0x4),	/* CYCLE_ACTIVITY.* */
+	EVENT_CONSTRAINT_END
+};
+
 static u64 intel_pmu_event_map(int hw_event)
 {
 	return intel_perfmon_event_map[hw_event];
@@ -415,6 +424,126 @@ static __initconst const u64 snb_hw_cache_event_ids
 
 };
 
+static __initconst const u64 bdw_hw_cache_event_ids
+				[PERF_COUNT_HW_CACHE_MAX]
+				[PERF_COUNT_HW_CACHE_OP_MAX]
+				[PERF_COUNT_HW_CACHE_RESULT_MAX] =
+{
+ [ C(L1D ) ] = {
+	[ C(OP_READ) ] = {
+		[ C(RESULT_ACCESS) ] = 0x81d0, 	/* MEM_UOPS_RETIRED.ALL_LOADS */
+		[ C(RESULT_MISS)   ] = 0x151, 	/* L1D.REPLACEMENT */
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = 0x82d0, 	/* MEM_UOPS_RETIRED.ALL_STORES */
+		[ C(RESULT_MISS)   ] = 0x0,
+	},
+	[ C(OP_PREFETCH) ] = {
+		[ C(RESULT_ACCESS) ] = 0x0,
+		[ C(RESULT_MISS)   ] = 0x0,
+	},
+ },
+ [ C(L1I ) ] = {
+	[ C(OP_READ) ] = {
+		[ C(RESULT_ACCESS) ] = 0x0,
+		[ C(RESULT_MISS)   ] = 0x280, 	/* ICACHE.MISSES */
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = -1,
+		[ C(RESULT_MISS)   ] = -1,
+	},
+	[ C(OP_PREFETCH) ] = {
+		[ C(RESULT_ACCESS) ] = 0x0,
+		[ C(RESULT_MISS)   ] = 0x0,
+	},
+ },
+ [ C(LL  ) ] = {
+	[ C(OP_READ) ] = {
+		/* OFFCORE_RESPONSE:ALL_DATA_RD|ALL_CODE_RD */
+		[ C(RESULT_ACCESS) ] = 0x1b7,
+		/* OFFCORE_RESPONSE:ALL_DATA_RD|ALL_CODE_RD|SUPPLIER_NONE|
+                   L3_MISS|ANY_SNOOP */
+		[ C(RESULT_MISS)   ] = 0x1b7,
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = 0x1b7, 	/* OFFCORE_RESPONSE:ALL_RFO */
+		/* OFFCORE_RESPONSE:ALL_RFO|SUPPLIER_NONE|L3_MISS|ANY_SNOOP */
+		[ C(RESULT_MISS)   ] = 0x1b7,
+	},
+	[ C(OP_PREFETCH) ] = {
+		[ C(RESULT_ACCESS) ] = 0x0,
+		[ C(RESULT_MISS)   ] = 0x0,
+	},
+ },
+ [ C(DTLB) ] = {
+	[ C(OP_READ) ] = {
+		[ C(RESULT_ACCESS) ] = 0x81d0, 	/* MEM_UOPS_RETIRED.ALL_LOADS */
+		[ C(RESULT_MISS)   ] = 0x108, 	/* DTLB_LOAD_MISSES.MISS_CAUSES_A_WALK */
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = 0x82d0, 	/* MEM_UOPS_RETIRED.ALL_STORES */
+		[ C(RESULT_MISS)   ] = 0x149, 	/* DTLB_STORE_MISSES.MISS_CAUSES_A_WALK */
+	},
+	[ C(OP_PREFETCH) ] = {
+		[ C(RESULT_ACCESS) ] = 0x0,
+		[ C(RESULT_MISS)   ] = 0x0,
+	},
+ },
+ [ C(ITLB) ] = {
+	[ C(OP_READ) ] = {
+		[ C(RESULT_ACCESS) ] = 0x6085, 	/* ITLB_MISSES.STLB_HIT */
+		[ C(RESULT_MISS)   ] = 0x185, 	/* ITLB_MISSES.MISS_CAUSES_A_WALK */
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = -1,
+		[ C(RESULT_MISS)   ] = -1,
+	},
+	[ C(OP_PREFETCH) ] = {
+		[ C(RESULT_ACCESS) ] = -1,
+		[ C(RESULT_MISS)   ] = -1,
+	},
+ },
+ [ C(BPU ) ] = {
+	[ C(OP_READ) ] = {
+		[ C(RESULT_ACCESS) ] = 0xc4, 	/* BR_INST_RETIRED.ALL_BRANCHES */
+		[ C(RESULT_MISS)   ] = 0xc5, 	/* BR_MISP_RETIRED.ALL_BRANCHES */
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = -1,
+		[ C(RESULT_MISS)   ] = -1,
+	},
+	[ C(OP_PREFETCH) ] = {
+		[ C(RESULT_ACCESS) ] = -1,
+		[ C(RESULT_MISS)   ] = -1,
+	},
+ },
+};
+
+static __initconst const u64 bdw_hw_cache_extra_regs
+				[PERF_COUNT_HW_CACHE_MAX]
+				[PERF_COUNT_HW_CACHE_OP_MAX]
+				[PERF_COUNT_HW_CACHE_RESULT_MAX] =
+{
+ [ C(LL  ) ] = {
+	[ C(OP_READ) ] = {
+		/* OFFCORE_RESPONSE:ALL_DATA_RD|ALL_CODE_RD */
+		[ C(RESULT_ACCESS) ] = 0x2d5,
+		/* OFFCORE_RESPONSE:ALL_DATA_RD|ALL_CODE_RD|SUPPLIER_NONE|
+                   L3_MISS|ANY_SNOOP */
+		[ C(RESULT_MISS)   ] = 0x3fbc0202d5,
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = 0x122, 	/* OFFCORE_RESPONSE:ALL_RFO */
+		/* OFFCORE_RESPONSE:ALL_RFO|SUPPLIER_NONE|L3_MISS|ANY_SNOOP */
+		[ C(RESULT_MISS)   ] = 0x3fbc020122,
+	},
+	[ C(OP_PREFETCH) ] = {
+		[ C(RESULT_ACCESS) ] = 0x0,
+		[ C(RESULT_MISS)   ] = 0x0,
+	},
+ },
+};
+
 static __initconst const u64 westmere_hw_cache_event_ids
 				[PERF_COUNT_HW_CACHE_MAX]
 				[PERF_COUNT_HW_CACHE_OP_MAX]
@@ -2565,6 +2694,27 @@ __init int intel_pmu_init(void)
 		pr_cont("Haswell events, ");
 		break;
 
+	case 61: /* Broadwell Client */
+		x86_pmu.late_ack = true;
+		memcpy(hw_cache_event_ids, bdw_hw_cache_event_ids, sizeof(hw_cache_event_ids));
+		memcpy(hw_cache_extra_regs, bdw_hw_cache_extra_regs, sizeof(hw_cache_extra_regs));
+
+		intel_pmu_lbr_init_snb();
+
+		x86_pmu.event_constraints = intel_bdw_event_constraints;
+		x86_pmu.pebs_constraints = intel_hsw_pebs_event_constraints;
+		x86_pmu.extra_regs = intel_snbep_extra_regs;
+		x86_pmu.pebs_aliases = intel_pebs_aliases_snb;
+		/* all extra regs are per-cpu when HT is on */
+		x86_pmu.er_flags |= ERF_HAS_RSP_1;
+		x86_pmu.er_flags |= ERF_NO_HT_SHARING;
+
+		x86_pmu.hw_config = hsw_hw_config;
+		x86_pmu.get_event_constraints = hsw_get_event_constraints;
+		x86_pmu.cpu_events = hsw_events_attrs;
+		pr_cont("Broadwell events, ");
+		break;
+
 	default:
 		switch (x86_pmu.version) {
 		case 1:
Signature · 1 line
1.9.3
maintainer
#11 lore raw

Re: [PATCH 3/5] perf, x86: Add Broadwell core support

arch/x86/kernel/cpu/perf_event_intel.c __init int intel_pmu_init(void) · line 2697

Quoted 1 line · Andi Kleen
arch/x86/kernel/cpu/perf_event_intel.c +1 -0
+	case 61: /* Broadwell Client */

Again, no other description has "Client" in.

#12 lore raw

Re: [PATCH 3/5] perf, x86: Add Broadwell core support

Hi,

What's happening with Broadwell support?
I don't see any support in 3.18-rc2. We need
this ASAP now.

Quoted 5 lines · Peter Zijlstra
Quoted 1 line · Andi Kleen

+ case 61: /* Broadwell Client */

Again, no other description has "Client" in.

maintainer
#13 lore raw

Re: [PATCH 3/5] perf, x86: Add Broadwell core support

Quoted 3 lines · Stephane Eranian

What's happening with Broadwell support?
I don't see any support in 3.18-rc2. We need
this ASAP now.

lkml.kernel.org/r/[email protected]

author
#14 lore raw

PATCH 4/5 perf, x86: Add INST_RETIRED.ALL workarounds

In reply to Andi Kleen

From: Andi Kleen <[email protected]>

On Broadwell INST_RETIRED.ALL cannot be used with any period that doesn't have the lowest 6 bits cleared. And the period should not be smaller than 128.

Add a new callback to enforce this, and set it for Broadwell.

This is erratum BDM57 and BDM11.

v2: Use correct event name in description. Use EVENT() macro.
v3: Use INTEL_ARCH_EVENT_MASK. Error out for events with too small period.

---
 arch/x86/kernel/cpu/perf_event.c       |  9 +++++++++
 arch/x86/kernel/cpu/perf_event.h       |  1 +
 arch/x86/kernel/cpu/perf_event_intel.c | 19 +++++++++++++++++++
 3 files changed, 29 insertions(+)
arch/x86/kernel/cpu/perf_event.c +9 -0
index 0adc5e3..a6e4724 100644
@@ -443,6 +443,12 @@ int x86_pmu_hw_config(struct perf_event *event)
 	if (event->attr.type == PERF_TYPE_RAW)
 		event->hw.config |= event->attr.config & X86_RAW_EVENT_MASK;
 
+	if (event->attr.sample_period && x86_pmu.limit_period) {
+		if (x86_pmu.limit_period(event, event->attr.sample_period) >
+				event->attr.sample_period)
+			return -EINVAL;
+	}
+
 	return x86_setup_perfctr(event);
 }
 
@@ -980,6 +986,9 @@ int x86_perf_event_set_period(struct perf_event *event)
 	if (left > x86_pmu.max_period)
 		left = x86_pmu.max_period;
 
+	if (x86_pmu.limit_period)
+		left = x86_pmu.limit_period(event, left);
+
 	per_cpu(pmc_prev_left[idx], smp_processor_id()) = left;
 
 	/*
arch/x86/kernel/cpu/perf_event.h +1 -0
index de81627..a46e391 100644
@@ -456,6 +456,7 @@ struct x86_pmu {
 	struct x86_pmu_quirk *quirks;
 	int		perfctr_second_write;
 	bool		late_ack;
+	unsigned	(*limit_period)(struct perf_event *event, unsigned l);
 
 	/*
 	 * sysfs attrs
arch/x86/kernel/cpu/perf_event_intel.c +19 -0
index 1cca4ae..53bd98d 100644
@@ -2034,6 +2034,24 @@ hsw_get_event_constraints(struct cpu_hw_events *cpuc, struct perf_event *event)
 	return c;
 }
 
+/*
+ * Broadwell:
+ * The INST_RETIRED.ALL period always needs to have lowest
+ * 6bits cleared (BDM57). It shall not use a period smaller
+ * than 100 (BDM11). We combine the two to enforce
+ * a min-period of 128.
+ */
+static unsigned bdw_limit_period(struct perf_event *event, unsigned left)
+{
+	if ((event->hw.config & INTEL_ARCH_EVENT_MASK) ==
+			X86_CONFIG(.event=0xc0, .umask=0x01)) {
+		if (left < 128)
+			left = 128;
+		left &= ~0x3fu;
+	}
+	return left;
+}
+
 PMU_FORMAT_ATTR(event,	"config:0-7"	);
 PMU_FORMAT_ATTR(umask,	"config:8-15"	);
 PMU_FORMAT_ATTR(edge,	"config:18"	);
@@ -2712,6 +2730,7 @@ __init int intel_pmu_init(void)
 		x86_pmu.hw_config = hsw_hw_config;
 		x86_pmu.get_event_constraints = hsw_get_event_constraints;
 		x86_pmu.cpu_events = hsw_events_attrs;
+		x86_pmu.limit_period = bdw_limit_period;
 		pr_cont("Broadwell events, ");
 		break;
 
Signature · 1 line
1.9.3
maintainer
#15 lore raw

Re: [PATCH 4/5] perf, x86: Add INST_RETIRED.ALL workarounds

Quoted 9 lines · Andi Kleen

From: Andi Kleen <[email protected]>

On Broadwell INST_RETIRED.ALL cannot be used with any period that doesn't have the lowest 6 bits cleared. And the period should not be smaller than 128.

Add a new callback to enforce this, and set it for Broadwell.

This is erratum BDM57 and BDM11.

This changelog could do with more words on the solution, esp. such that you answer Stephanes question.

author
#16 lore raw

PATCH 5/5 perf, x86: Use Broadwell cache event list for Haswell

In reply to Andi Kleen

From: Andi Kleen <[email protected]>

Use the newly added Broadwell cache event list for Haswell too. They are identical, but Haswell is very different from the Sandy Bridge list that was used previously. That fixes a wide range of mis-counting cache events.

The node events are now only for retired memory events.

The prefetch events are gone now. They way the hardware counts them is very misleading (some prefetches included, others not), so it seemed best to leave them out.

---
 arch/x86/kernel/cpu/perf_event_intel.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/cpu/perf_event_intel.c +2 -2
index 53bd98d..190b29e 100644
@@ -2692,8 +2692,8 @@ __init int intel_pmu_init(void)
 	case 63: /* 22nm Haswell Server */
 	case 69: /* 22nm Haswell ULT */
 		x86_pmu.late_ack = true;
-		memcpy(hw_cache_event_ids, snb_hw_cache_event_ids, sizeof(hw_cache_event_ids));
-		memcpy(hw_cache_extra_regs, snb_hw_cache_extra_regs, sizeof(hw_cache_extra_regs));
+		memcpy(hw_cache_event_ids, bdw_hw_cache_event_ids, sizeof(hw_cache_event_ids));
+		memcpy(hw_cache_extra_regs, bdw_hw_cache_extra_regs, sizeof(hw_cache_extra_regs));
 
 		intel_pmu_lbr_init_snb();
 
Signature · 1 line
1.9.3
maintainer
#17 lore raw

Re: [PATCH 5/5] perf, x86: Use Broadwell cache event list for Haswell

Quoted 23 lines · Andi Kleen

From: Andi Kleen <[email protected]>

Use the newly added Broadwell cache event list for Haswell too. They are identical, but Haswell is very different from the Sandy Bridge list that was used previously. That fixes a wide range of mis-counting cache events.

The node events are now only for retired memory events.

The prefetch events are gone now. They way the hardware counts them is very misleading (some prefetches included, others not), so it seemed best to leave them out.

---
 arch/x86/kernel/cpu/perf_event_intel.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/cpu/perf_event_intel.c +0 -0
index 53bd98d..190b29e 100644

arch/x86/kernel/cpu/perf_event_intel.c __init int intel_pmu_init(void) · line 2696

Quoted 7 lines
arch/x86/kernel/cpu/perf_event_intel.c +2 -2
@@ -2692,8 +2692,8 @@ __init int intel_pmu_init(void)
 	case 63: /* 22nm Haswell Server */
 	case 69: /* 22nm Haswell ULT */
 		x86_pmu.late_ack = true;
-		memcpy(hw_cache_event_ids, snb_hw_cache_event_ids, sizeof(hw_cache_event_ids));
-		memcpy(hw_cache_extra_regs, snb_hw_cache_extra_regs, sizeof(hw_cache_extra_regs));
+		memcpy(hw_cache_event_ids, bdw_hw_cache_event_ids, sizeof(hw_cache_event_ids));
+		memcpy(hw_cache_extra_regs, bdw_hw_cache_extra_regs, sizeof(hw_cache_extra_regs));

We name things for the earliest chip they're valid for. This means this is inconsistent and 'wrong'. These tables should be called after haswell not broadwell.