Skip to contentSkip to conversation

perf, x86: Use extended offcore mask on Haswell

PATCH In review Andi Kleen 3 participants 4 messages Aug 12, 2014

Subsystems (2)
lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

PATCH 1/1 perf, x86: Use extended offcore mask on Haswell

From: Andi Kleen <[email protected]>

HSW-EP has a larger offcore mask than the client Haswell CPUs. It is the same mask as on Sandy/IvyBridge-EP. All of Haswell was using the client mask, so some bits were missing.

On the client parts some bits were also missing compared to Sandy/IvyBridge, in particular the bits to match on a L4 cache hit.

The Haswell core in both client and server incarnations accepts the same bits (but some are nops), so we can use the same mask.

So use the snbep extended mask, which is a superset of the client and the server, for all of Haswell.

This allows specifying a number of extra offcore events, like for example for HSW-EP.

% perf stat -e cpu/event=0xb7,umask=0x1,offcore_rsp=0x3fffc00100,name=offcore_response_pf_l3_rfo_l3_miss_any_response/ true

which were <not supported> before.

v2: Post correct patch.

---
 arch/x86/kernel/cpu/perf_event_intel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/perf_event_intel.c +1 -1
index 2502d0d..4648a1b 100644
@@ -2552,7 +2552,7 @@ __init int intel_pmu_init(void)
 
 		x86_pmu.event_constraints = intel_hsw_event_constraints;
 		x86_pmu.pebs_constraints = intel_hsw_pebs_event_constraints;
-		x86_pmu.extra_regs = intel_snb_extra_regs;
+		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;
Signature · 1 line
1.9.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 17 lines · Andi Kleen

From: Andi Kleen <[email protected]>

HSW-EP has a larger offcore mask than the client Haswell CPUs. It is the same mask as on Sandy/IvyBridge-EP. All of Haswell was using the client mask, so some bits were missing.

On the client parts some bits were also missing compared to Sandy/IvyBridge, in particular the bits to match on a L4 cache hit.

The Haswell core in both client and server incarnations accepts the same bits (but some are nops), so we can use the same mask.

So use the snbep extended mask, which is a superset of the client and the server, for all of Haswell.

Quoted 7 lines

This allows specifying a number of extra offcore events, like for example for HSW-EP.

% perf stat -e cpu/event=0xb7,umask=0x1,offcore_rsp=0x3fffc00100,name=offcore_response_pf_l3_rfo_l3_miss_any_response/ true

which were <not supported> before.

I tested this on my HSW desktop including the bits only defined for servers and everything is fine.
It does simplify the code,though desktop parts always come first, so there will always be patching.
Also if this works on HSW/HSX, I wonder if we could not simplify the same code for IVB/IVT and SNB/SNBEP.

Quoted 22 lines

v2: Post correct patch.

---
 arch/x86/kernel/cpu/perf_event_intel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/perf_event_intel.c +1 -2
index 2502d0d..4648a1b 100644
@@ -2552,7 +2552,7 @@ __init int intel_pmu_init(void)
 
                x86_pmu.event_constraints = intel_hsw_event_constraints;
                x86_pmu.pebs_constraints = intel_hsw_pebs_event_constraints;
-               x86_pmu.extra_regs = intel_snb_extra_regs;
+               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;
--

1.9.3

maintainer
#2 lore raw
In reply to Andi Kleen
Quoted 20 lines · Andi Kleen

From: Andi Kleen <[email protected]>

HSW-EP has a larger offcore mask than the client Haswell CPUs. It is the same mask as on Sandy/IvyBridge-EP. All of Haswell was using the client mask, so some bits were missing.

On the client parts some bits were also missing compared to Sandy/IvyBridge, in particular the bits to match on a L4 cache hit.

The Haswell core in both client and server incarnations accepts the same bits (but some are nops), so we can use the same mask.

So use the snbep extended mask, which is a superset of the client and the server, for all of Haswell.

This allows specifying a number of extra offcore events, like for example for HSW-EP.

Quoted 6 lines

% perf stat -e cpu/event=0xb7,umask=0x1,offcore_rsp=0x3fffc00100,name=offcore_response_pf_l3_rfo_l3_miss_any_response/ true

which were <not supported> before.

v2: Post correct patch.

I seem to have this patch; so that means this is a repost right?

#3 lore raw
Quoted 21 lines · Peter Zijlstra
Quoted 20 lines · Andi Kleen

From: Andi Kleen <[email protected]>

HSW-EP has a larger offcore mask than the client Haswell CPUs. It is the same mask as on Sandy/IvyBridge-EP. All of Haswell was using the client mask, so some bits were missing.

On the client parts some bits were also missing compared to Sandy/IvyBridge, in particular the bits to match on a L4 cache hit.

The Haswell core in both client and server incarnations accepts the same bits (but some are nops), so we can use the same mask.

So use the snbep extended mask, which is a superset of the client and the server, for all of Haswell.

This allows specifying a number of extra offcore events, like for example for HSW-EP.

Quoted 9 lines
Quoted 6 lines

% perf stat -e cpu/event=0xb7,umask=0x1,offcore_rsp=0x3fffc00100,name=offcore_response_pf_l3_rfo_l3_miss_any_response/ true

which were <not supported> before.

v2: Post correct patch.

I seem to have this patch; so that means this is a repost right?

Think Andi said, it was a rebase. Just found time today to test it.