perf, x86: Add INTEL_FLAGS_UEVENT_CONSTRAINT
Subsystems (2)
PATCH 1/3 perf, x86: Add INTEL_FLAGS_UEVENT_CONSTRAINT
From: Andi Kleen <[email protected]>
Add a FLAGS_UEVENT_CONSTRAINT macro that allows us to match on event+umask, and in additional all flags.
This is needed to ensure the INV and CMASK fields are zero for specific events, as this can cause undefined behavior.
--- arch/x86/kernel/cpu/perf_event.h | 4 ++++ 1 file changed, 4 insertions(+)
arch/x86/kernel/cpu/perf_event.h +4 -0
@@ -253,6 +253,10 @@ struct cpu_hw_events {#define INTEL_UEVENT_CONSTRAINT (c, n) \ EVENT_CONSTRAINT(c, n, INTEL_ARCH_EVENT_MASK) +/* Like UEVENT_CONSTRAINT, but match flags too */ +#define INTEL_FLAGS_UEVENT_CONSTRAINT (c, n) \ + EVENT_CONSTRAINT(c, n, INTEL_ARCH_EVENT_MASK|X86_ALL_EVENT_FLAGS) +#define INTEL_PLD_CONSTRAINT (c, n) \ __EVENT_CONSTRAINT(c, n, INTEL_ARCH_EVENT_MASK|X86_ALL_EVENT_FLAGS, \ HWEIGHT(n), 0, PERF_X86_EVENT_PEBS_LDLAT)
Signature · 1 line
1.9.3
PATCH 2/3 perf, x86: Use INTEL_FLAGS_UEVENT_CONSTRAINT for PRECDIST
From: Andi Kleen <[email protected]>
The earlier commit 86a04461a made near all PEBS on Sandy/IvyBridge/Haswell to reject non zero flags.
However this wasn't done for the INST_RETIRED.PREC_DIST event because no suitable macro existed. Now that we have INTEL_FLAGS_UEVENT_CONSTRAINT enforce zero flags for INST_RETIRED.PREC_DIST too.
--- arch/x86/kernel/cpu/perf_event_intel_ds.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/kernel/cpu/perf_event_intel_ds.c +3 -3
@@ -606,7 +606,7 @@ struct event_constraint intel_westmere_pebs_event_constraints[] = { };struct event_constraint intel_snb_pebs_event_constraints[] = { -INTEL_UEVENT_CONSTRAINT (0x01c0 ,0x2 ),/* INST_RETIRED.PRECDIST */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0x01c0 ,0x2 ),/* INST_RETIRED.PRECDIST */ INTEL_PLD_CONSTRAINT (0x01cd ,0x8 ),/* MEM_TRANS_RETIRED.LAT_ABOVE_THR */ INTEL_PST_CONSTRAINT (0x02cd ,0x8 ),/* MEM_TRANS_RETIRED.PRECISE_STORES */ /* UOPS_RETIRED.ALL, inv=1, cmask=16 (cycles:p). */
@@ -617,7 +617,7 @@ struct event_constraint intel_snb_pebs_event_constraints[] = { };struct event_constraint intel_ivb_pebs_event_constraints[] = { -INTEL_UEVENT_CONSTRAINT (0x01c0 ,0x2 ),/* INST_RETIRED.PRECDIST */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0x01c0 ,0x2 ),/* INST_RETIRED.PRECDIST */ INTEL_PLD_CONSTRAINT (0x01cd ,0x8 ),/* MEM_TRANS_RETIRED.LAT_ABOVE_THR */ INTEL_PST_CONSTRAINT (0x02cd ,0x8 ),/* MEM_TRANS_RETIRED.PRECISE_STORES */ /* UOPS_RETIRED.ALL, inv=1, cmask=16 (cycles:p). */
@@ -628,7 +628,7 @@ struct event_constraint intel_ivb_pebs_event_constraints[] = { };struct event_constraint intel_hsw_pebs_event_constraints[] = { -INTEL_UEVENT_CONSTRAINT (0x01c0 ,0x2 ),/* INST_RETIRED.PRECDIST */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0x01c0 ,0x2 ),/* INST_RETIRED.PRECDIST */ INTEL_PLD_CONSTRAINT (0x01cd ,0xf ),/* MEM_TRANS_RETIRED.* */ /* UOPS_RETIRED.ALL, inv=1, cmask=16 (cycles:p). */ INTEL_FLAGS_EVENT_CONSTRAINT (0x108001c2 ,0xf ),
Signature · 1 line
1.9.3
tip-bot for Andi Kleen
merge bot[tip:perf/core] perf/x86/intel: Use INTEL_FLAGS_UEVENT_CONSTRAINT for PRECDIST
perf/x86/intel: Use INTEL_FLAGS_UEVENT_CONSTRAINT for PRECDIST
Commit-ID: 0dbc94796d8714f78446245ef0f080d2c0b7ff0e Gitweb: http://git.kernel.org/tip/0dbc94796d8714f78446245ef0f080d2c0b7ff0e Author: Andi Kleen <[email protected]> AuthorDate: Wed, 24 Sep 2014 07:34:47 -0700 Committer: Ingo Molnar <[email protected]> CommitDate: Sun, 16 Nov 2014 11:41:55 +0100
perf/x86/intel: Use INTEL_FLAGS_UEVENT_CONSTRAINT for PRECDIST
My earlier commit:
86a04461a99f ("perf/x86: Revamp PEBS event selection")
made nearly all PEBS on Sandy/IvyBridge/Haswell to reject non zero flags.
However this wasn't done for the INST_RETIRED.PREC_DIST event because no suitable macro existed. Now that we have INTEL_FLAGS_UEVENT_CONSTRAINT enforce zero flags for INST_RETIRED.PREC_DIST too.
--- arch/x86/kernel/cpu/perf_event_intel_ds.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/kernel/cpu/perf_event_intel_ds.c +3 -3
@@ -606,7 +606,7 @@ struct event_constraint intel_westmere_pebs_event_constraints[] = { };struct event_constraint intel_snb_pebs_event_constraints[] = { -INTEL_UEVENT_CONSTRAINT (0x01c0 ,0x2 ),/* INST_RETIRED.PRECDIST */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0x01c0 ,0x2 ),/* INST_RETIRED.PRECDIST */ INTEL_PLD_CONSTRAINT (0x01cd ,0x8 ),/* MEM_TRANS_RETIRED.LAT_ABOVE_THR */ INTEL_PST_CONSTRAINT (0x02cd ,0x8 ),/* MEM_TRANS_RETIRED.PRECISE_STORES */ /* UOPS_RETIRED.ALL, inv=1, cmask=16 (cycles:p). */
@@ -617,7 +617,7 @@ struct event_constraint intel_snb_pebs_event_constraints[] = { };struct event_constraint intel_ivb_pebs_event_constraints[] = { -INTEL_UEVENT_CONSTRAINT (0x01c0 ,0x2 ),/* INST_RETIRED.PRECDIST */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0x01c0 ,0x2 ),/* INST_RETIRED.PRECDIST */ INTEL_PLD_CONSTRAINT (0x01cd ,0x8 ),/* MEM_TRANS_RETIRED.LAT_ABOVE_THR */ INTEL_PST_CONSTRAINT (0x02cd ,0x8 ),/* MEM_TRANS_RETIRED.PRECISE_STORES */ /* UOPS_RETIRED.ALL, inv=1, cmask=16 (cycles:p). */
@@ -628,7 +628,7 @@ struct event_constraint intel_ivb_pebs_event_constraints[] = { };struct event_constraint intel_hsw_pebs_event_constraints[] = { -INTEL_UEVENT_CONSTRAINT (0x01c0 ,0x2 ),/* INST_RETIRED.PRECDIST */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0x01c0 ,0x2 ),/* INST_RETIRED.PRECDIST */ INTEL_PLD_CONSTRAINT (0x01cd ,0xf ),/* MEM_TRANS_RETIRED.* */ /* UOPS_RETIRED.ALL, inv=1, cmask=16 (cycles:p). */ INTEL_FLAGS_EVENT_CONSTRAINT (0x108001c2 ,0xf ),
PATCH 3/3 perf, x86: Disallow flags for most Core2/Atom/Nehalem/Westmere events
In reply to Andi KleenFrom: Andi Kleen <[email protected]>
Disallow setting inv/cmask/etc. flags for all PEBS events
on these CPUs, except for the UOPS_RETIRED.* events on Nehalem/Westmere, which are needed for cycles:p. This avoids an undefined situation strongly discouraged by the Intle SDM. The PLD_* events were already covered. This follows the earlier changes for Sandy Bridge and alter.
--- arch/x86/kernel/cpu/perf_event_intel_ds.c | 52 +++++++++++++++---------------- 1 file changed, 26 insertions(+), 26 deletions(-)
arch/x86/kernel/cpu/perf_event_intel_ds.c +26 -26
@@ -552,18 +552,18 @@ int intel_pmu_drain_bts_buffer(void)* PEBS */ struct event_constraint intel_core2_pebs_event_constraints[] = { -INTEL_UEVENT_CONSTRAINT (0x00c0 ,0x1 ),/* INST_RETIRED.ANY */ -INTEL_UEVENT_CONSTRAINT (0xfec1 ,0x1 ),/* X87_OPS_RETIRED.ANY */ -INTEL_UEVENT_CONSTRAINT (0x00c5 ,0x1 ),/* BR_INST_RETIRED.MISPRED */ -INTEL_UEVENT_CONSTRAINT (0x1fc7 ,0x1 ),/* SIMD_INST_RETURED.ANY */ -INTEL_EVENT_CONSTRAINT (0xcb ,0x1 ),/* MEM_LOAD_RETIRED.* */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0x00c0 ,0x1 ),/* INST_RETIRED.ANY */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0xfec1 ,0x1 ),/* X87_OPS_RETIRED.ANY */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0x00c5 ,0x1 ),/* BR_INST_RETIRED.MISPRED */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0x1fc7 ,0x1 ),/* SIMD_INST_RETURED.ANY */ +INTEL_FLAGS_EVENT_CONSTRAINT (0xcb ,0x1 ),/* MEM_LOAD_RETIRED.* */ EVENT_CONSTRAINT_END };struct event_constraint intel_atom_pebs_event_constraints[] = { -INTEL_UEVENT_CONSTRAINT (0x00c0 ,0x1 ),/* INST_RETIRED.ANY */ -INTEL_UEVENT_CONSTRAINT (0x00c5 ,0x1 ),/* MISPREDICTED_BRANCH_RETIRED */ -INTEL_EVENT_CONSTRAINT (0xcb ,0x1 ),/* MEM_LOAD_RETIRED.* */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0x00c0 ,0x1 ),/* INST_RETIRED.ANY */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0x00c5 ,0x1 ),/* MISPREDICTED_BRANCH_RETIRED */ +INTEL_FLAGS_EVENT_CONSTRAINT (0xcb ,0x1 ),/* MEM_LOAD_RETIRED.* */ EVENT_CONSTRAINT_END };
@@ -577,31 +577,31 @@ struct event_constraint intel_slm_pebs_event_constraints[] = {struct event_constraint intel_nehalem_pebs_event_constraints[] = {INTEL_PLD_CONSTRAINT (0x100b ,0xf ),/* MEM_INST_RETIRED.* */ -INTEL_EVENT_CONSTRAINT (0x0f ,0xf ),/* MEM_UNCORE_RETIRED.* */ -INTEL_UEVENT_CONSTRAINT (0x010c ,0xf ),/* MEM_STORE_RETIRED.DTLB_MISS */ -INTEL_EVENT_CONSTRAINT (0xc0 ,0xf ),/* INST_RETIRED.ANY */ +INTEL_FLAGS_EVENT_CONSTRAINT (0x0f ,0xf ),/* MEM_UNCORE_RETIRED.* */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0x010c ,0xf ),/* MEM_STORE_RETIRED.DTLB_MISS */ +INTEL_FLAGS_EVENT_CONSTRAINT (0xc0 ,0xf ),/* INST_RETIRED.ANY */ INTEL_EVENT_CONSTRAINT (0xc2 ,0xf ),/* UOPS_RETIRED.* */ -INTEL_EVENT_CONSTRAINT (0xc4 ,0xf ),/* BR_INST_RETIRED.* */ -INTEL_UEVENT_CONSTRAINT (0x02c5 ,0xf ),/* BR_MISP_RETIRED.NEAR_CALL */ -INTEL_EVENT_CONSTRAINT (0xc7 ,0xf ),/* SSEX_UOPS_RETIRED.* */ -INTEL_UEVENT_CONSTRAINT (0x20c8 ,0xf ),/* ITLB_MISS_RETIRED */ -INTEL_EVENT_CONSTRAINT (0xcb ,0xf ),/* MEM_LOAD_RETIRED.* */ -INTEL_EVENT_CONSTRAINT (0xf7 ,0xf ),/* FP_ASSIST.* */ +INTEL_FLAGS_EVENT_CONSTRAINT (0xc4 ,0xf ),/* BR_INST_RETIRED.* */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0x02c5 ,0xf ),/* BR_MISP_RETIRED.NEAR_CALL */ +INTEL_FLAGS_EVENT_CONSTRAINT (0xc7 ,0xf ),/* SSEX_UOPS_RETIRED.* */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0x20c8 ,0xf ),/* ITLB_MISS_RETIRED */ +INTEL_FLAGS_EVENT_CONSTRAINT (0xcb ,0xf ),/* MEM_LOAD_RETIRED.* */ +INTEL_FLAGS_EVENT_CONSTRAINT (0xf7 ,0xf ),/* FP_ASSIST.* */ EVENT_CONSTRAINT_END };struct event_constraint intel_westmere_pebs_event_constraints[] = {INTEL_PLD_CONSTRAINT (0x100b ,0xf ),/* MEM_INST_RETIRED.* */ -INTEL_EVENT_CONSTRAINT (0x0f ,0xf ),/* MEM_UNCORE_RETIRED.* */ -INTEL_UEVENT_CONSTRAINT (0x010c ,0xf ),/* MEM_STORE_RETIRED.DTLB_MISS */ -INTEL_EVENT_CONSTRAINT (0xc0 ,0xf ),/* INSTR_RETIRED.* */ +INTEL_FLAGS_EVENT_CONSTRAINT (0x0f ,0xf ),/* MEM_UNCORE_RETIRED.* */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0x010c ,0xf ),/* MEM_STORE_RETIRED.DTLB_MISS */ +INTEL_FLAGS_EVENT_CONSTRAINT (0xc0 ,0xf ),/* INSTR_RETIRED.* */ INTEL_EVENT_CONSTRAINT (0xc2 ,0xf ),/* UOPS_RETIRED.* */ -INTEL_EVENT_CONSTRAINT (0xc4 ,0xf ),/* BR_INST_RETIRED.* */ -INTEL_EVENT_CONSTRAINT (0xc5 ,0xf ),/* BR_MISP_RETIRED.* */ -INTEL_EVENT_CONSTRAINT (0xc7 ,0xf ),/* SSEX_UOPS_RETIRED.* */ -INTEL_UEVENT_CONSTRAINT (0x20c8 ,0xf ),/* ITLB_MISS_RETIRED */ -INTEL_EVENT_CONSTRAINT (0xcb ,0xf ),/* MEM_LOAD_RETIRED.* */ -INTEL_EVENT_CONSTRAINT (0xf7 ,0xf ),/* FP_ASSIST.* */ +INTEL_FLAGS_EVENT_CONSTRAINT (0xc4 ,0xf ),/* BR_INST_RETIRED.* */ +INTEL_FLAGS_EVENT_CONSTRAINT (0xc5 ,0xf ),/* BR_MISP_RETIRED.* */ +INTEL_FLAGS_EVENT_CONSTRAINT (0xc7 ,0xf ),/* SSEX_UOPS_RETIRED.* */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0x20c8 ,0xf ),/* ITLB_MISS_RETIRED */ +INTEL_FLAGS_EVENT_CONSTRAINT (0xcb ,0xf ),/* MEM_LOAD_RETIRED.* */ +INTEL_FLAGS_EVENT_CONSTRAINT (0xf7 ,0xf ),/* FP_ASSIST.* */ EVENT_CONSTRAINT_END };
Signature · 1 line
1.9.3
tip-bot for Andi Kleen
merge bot[tip:perf/core] perf/x86/intel: Disallow flags for most Core2/ Atom/Nehalem/Westmere events
perf/x86/intel: Disallow flags for most Core2/Atom/Nehalem/Westmere events
Commit-ID: af4bdcf675cf768dc3558682fc178e0e3e70bb52 Gitweb: http://git.kernel.org/tip/af4bdcf675cf768dc3558682fc178e0e3e70bb52 Author: Andi Kleen <[email protected]> AuthorDate: Wed, 24 Sep 2014 07:34:48 -0700 Committer: Ingo Molnar <[email protected]> CommitDate: Sun, 16 Nov 2014 11:41:56 +0100
perf/x86/intel: Disallow flags for most Core2/Atom/Nehalem/Westmere events
Disallow setting inv/cmask/etc. flags for all PEBS events
on these CPUs, except for the UOPS_RETIRED.* events on Nehalem/Westmere, which are needed for cycles:p. This avoids an undefined situation strongly discouraged by the Intle SDM. The PLD_* events were already covered. This follows the earlier changes for Sandy Bridge and alter.
--- arch/x86/kernel/cpu/perf_event_intel_ds.c | 52 +++++++++++++++---------------- 1 file changed, 26 insertions(+), 26 deletions(-)
arch/x86/kernel/cpu/perf_event_intel_ds.c +26 -26
@@ -552,18 +552,18 @@ int intel_pmu_drain_bts_buffer(void)* PEBS */ struct event_constraint intel_core2_pebs_event_constraints[] = { -INTEL_UEVENT_CONSTRAINT (0x00c0 ,0x1 ),/* INST_RETIRED.ANY */ -INTEL_UEVENT_CONSTRAINT (0xfec1 ,0x1 ),/* X87_OPS_RETIRED.ANY */ -INTEL_UEVENT_CONSTRAINT (0x00c5 ,0x1 ),/* BR_INST_RETIRED.MISPRED */ -INTEL_UEVENT_CONSTRAINT (0x1fc7 ,0x1 ),/* SIMD_INST_RETURED.ANY */ -INTEL_EVENT_CONSTRAINT (0xcb ,0x1 ),/* MEM_LOAD_RETIRED.* */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0x00c0 ,0x1 ),/* INST_RETIRED.ANY */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0xfec1 ,0x1 ),/* X87_OPS_RETIRED.ANY */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0x00c5 ,0x1 ),/* BR_INST_RETIRED.MISPRED */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0x1fc7 ,0x1 ),/* SIMD_INST_RETURED.ANY */ +INTEL_FLAGS_EVENT_CONSTRAINT (0xcb ,0x1 ),/* MEM_LOAD_RETIRED.* */ EVENT_CONSTRAINT_END };struct event_constraint intel_atom_pebs_event_constraints[] = { -INTEL_UEVENT_CONSTRAINT (0x00c0 ,0x1 ),/* INST_RETIRED.ANY */ -INTEL_UEVENT_CONSTRAINT (0x00c5 ,0x1 ),/* MISPREDICTED_BRANCH_RETIRED */ -INTEL_EVENT_CONSTRAINT (0xcb ,0x1 ),/* MEM_LOAD_RETIRED.* */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0x00c0 ,0x1 ),/* INST_RETIRED.ANY */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0x00c5 ,0x1 ),/* MISPREDICTED_BRANCH_RETIRED */ +INTEL_FLAGS_EVENT_CONSTRAINT (0xcb ,0x1 ),/* MEM_LOAD_RETIRED.* */ EVENT_CONSTRAINT_END };
@@ -577,31 +577,31 @@ struct event_constraint intel_slm_pebs_event_constraints[] = {struct event_constraint intel_nehalem_pebs_event_constraints[] = {INTEL_PLD_CONSTRAINT (0x100b ,0xf ),/* MEM_INST_RETIRED.* */ -INTEL_EVENT_CONSTRAINT (0x0f ,0xf ),/* MEM_UNCORE_RETIRED.* */ -INTEL_UEVENT_CONSTRAINT (0x010c ,0xf ),/* MEM_STORE_RETIRED.DTLB_MISS */ -INTEL_EVENT_CONSTRAINT (0xc0 ,0xf ),/* INST_RETIRED.ANY */ +INTEL_FLAGS_EVENT_CONSTRAINT (0x0f ,0xf ),/* MEM_UNCORE_RETIRED.* */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0x010c ,0xf ),/* MEM_STORE_RETIRED.DTLB_MISS */ +INTEL_FLAGS_EVENT_CONSTRAINT (0xc0 ,0xf ),/* INST_RETIRED.ANY */ INTEL_EVENT_CONSTRAINT (0xc2 ,0xf ),/* UOPS_RETIRED.* */ -INTEL_EVENT_CONSTRAINT (0xc4 ,0xf ),/* BR_INST_RETIRED.* */ -INTEL_UEVENT_CONSTRAINT (0x02c5 ,0xf ),/* BR_MISP_RETIRED.NEAR_CALL */ -INTEL_EVENT_CONSTRAINT (0xc7 ,0xf ),/* SSEX_UOPS_RETIRED.* */ -INTEL_UEVENT_CONSTRAINT (0x20c8 ,0xf ),/* ITLB_MISS_RETIRED */ -INTEL_EVENT_CONSTRAINT (0xcb ,0xf ),/* MEM_LOAD_RETIRED.* */ -INTEL_EVENT_CONSTRAINT (0xf7 ,0xf ),/* FP_ASSIST.* */ +INTEL_FLAGS_EVENT_CONSTRAINT (0xc4 ,0xf ),/* BR_INST_RETIRED.* */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0x02c5 ,0xf ),/* BR_MISP_RETIRED.NEAR_CALL */ +INTEL_FLAGS_EVENT_CONSTRAINT (0xc7 ,0xf ),/* SSEX_UOPS_RETIRED.* */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0x20c8 ,0xf ),/* ITLB_MISS_RETIRED */ +INTEL_FLAGS_EVENT_CONSTRAINT (0xcb ,0xf ),/* MEM_LOAD_RETIRED.* */ +INTEL_FLAGS_EVENT_CONSTRAINT (0xf7 ,0xf ),/* FP_ASSIST.* */ EVENT_CONSTRAINT_END };struct event_constraint intel_westmere_pebs_event_constraints[] = {INTEL_PLD_CONSTRAINT (0x100b ,0xf ),/* MEM_INST_RETIRED.* */ -INTEL_EVENT_CONSTRAINT (0x0f ,0xf ),/* MEM_UNCORE_RETIRED.* */ -INTEL_UEVENT_CONSTRAINT (0x010c ,0xf ),/* MEM_STORE_RETIRED.DTLB_MISS */ -INTEL_EVENT_CONSTRAINT (0xc0 ,0xf ),/* INSTR_RETIRED.* */ +INTEL_FLAGS_EVENT_CONSTRAINT (0x0f ,0xf ),/* MEM_UNCORE_RETIRED.* */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0x010c ,0xf ),/* MEM_STORE_RETIRED.DTLB_MISS */ +INTEL_FLAGS_EVENT_CONSTRAINT (0xc0 ,0xf ),/* INSTR_RETIRED.* */ INTEL_EVENT_CONSTRAINT (0xc2 ,0xf ),/* UOPS_RETIRED.* */ -INTEL_EVENT_CONSTRAINT (0xc4 ,0xf ),/* BR_INST_RETIRED.* */ -INTEL_EVENT_CONSTRAINT (0xc5 ,0xf ),/* BR_MISP_RETIRED.* */ -INTEL_EVENT_CONSTRAINT (0xc7 ,0xf ),/* SSEX_UOPS_RETIRED.* */ -INTEL_UEVENT_CONSTRAINT (0x20c8 ,0xf ),/* ITLB_MISS_RETIRED */ -INTEL_EVENT_CONSTRAINT (0xcb ,0xf ),/* MEM_LOAD_RETIRED.* */ -INTEL_EVENT_CONSTRAINT (0xf7 ,0xf ),/* FP_ASSIST.* */ +INTEL_FLAGS_EVENT_CONSTRAINT (0xc4 ,0xf ),/* BR_INST_RETIRED.* */ +INTEL_FLAGS_EVENT_CONSTRAINT (0xc5 ,0xf ),/* BR_MISP_RETIRED.* */ +INTEL_FLAGS_EVENT_CONSTRAINT (0xc7 ,0xf ),/* SSEX_UOPS_RETIRED.* */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0x20c8 ,0xf ),/* ITLB_MISS_RETIRED */ +INTEL_FLAGS_EVENT_CONSTRAINT (0xcb ,0xf ),/* MEM_LOAD_RETIRED.* */ +INTEL_FLAGS_EVENT_CONSTRAINT (0xf7 ,0xf ),/* FP_ASSIST.* */ EVENT_CONSTRAINT_END };
Peter Zijlstra
maintainerYes, these compile just fine. Thanks!
tip-bot for Andi Kleen
merge bot[tip:perf/core] perf/x86: Add INTEL_FLAGS_UEVENT_CONSTRAINT
In reply to Andi Kleenperf/x86: Add INTEL_FLAGS_UEVENT_CONSTRAINT
Commit-ID: 7550ddffe4c8040db31c66e5bd64531e2916bbf1 Gitweb: http://git.kernel.org/tip/7550ddffe4c8040db31c66e5bd64531e2916bbf1 Author: Andi Kleen <[email protected]> AuthorDate: Wed, 24 Sep 2014 07:34:46 -0700 Committer: Ingo Molnar <[email protected]> CommitDate: Sun, 16 Nov 2014 11:41:54 +0100
perf/x86: Add INTEL_FLAGS_UEVENT_CONSTRAINT
Add a FLAGS_UEVENT_CONSTRAINT macro that allows us to match on event+umask, and in additional all flags.
This is needed to ensure the INV and CMASK fields are zero for specific events, as this can cause undefined behavior.
--- arch/x86/kernel/cpu/perf_event.h | 4 ++++ 1 file changed, 4 insertions(+)
arch/x86/kernel/cpu/perf_event.h +4 -0
@@ -253,6 +253,10 @@ struct cpu_hw_events {#define INTEL_UEVENT_CONSTRAINT (c, n) \ EVENT_CONSTRAINT(c, n, INTEL_ARCH_EVENT_MASK) +/* Like UEVENT_CONSTRAINT, but match flags too */ +#define INTEL_FLAGS_UEVENT_CONSTRAINT (c, n) \ + EVENT_CONSTRAINT(c, n, INTEL_ARCH_EVENT_MASK|X86_ALL_EVENT_FLAGS) +#define INTEL_PLD_CONSTRAINT (c, n) \ __EVENT_CONSTRAINT(c, n, INTEL_ARCH_EVENT_MASK|X86_ALL_EVENT_FLAGS, \ HWEIGHT(n), 0, PERF_X86_EVENT_PEBS_LDLAT)