perf, x86: Enable PEBS mode automatically for mem-{loads,stores} v2
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 10 lines · Andi Kleen
From: Andi Kleen <[email protected]>
With the earlier patches to automatically try cpu// and add a precise sys attribute, we can now enable PEBS for the mem-loads, mem-stores events everywhere.
This allows to use
perf record -e mem-loads ...
Quoted 8 lines
instead of
perf record -e cpu/mem-loads/p ...
Nehalem and Sandy Bridge only use precise mode == 1 as the off-by-one IP correction is quite expensive here (user can still override) On Haswell as it's basically free always use precise=2
I think overhead should not guide the choice here. You want to expose a uniform behavior across CPUs as much as possible. I suggest you use precise=2 whenever it is available. In other words, try to return the load/store instruction address each time you can.
Quoted 42 lines
Cc: [email protected]
v2: Different white spaceSigned-off-by Andi Kleen <[email protected]>--- arch/x86/kernel/cpu/perf_event_intel.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)arch/x86/kernel/cpu/perf_event_intel.c +9
-6@@ -176,9 +176,12 @@ static struct extra_reg intel_snbep_extra_regs[] __read_mostly = {EVENT_EXTRA_END }; -EVENT_ATTR_STR (mem-loads, mem_ld_nhm,"event=0x0b,umask=0x10,ldlat=3" ); -EVENT_ATTR_STR (mem-loads, mem_ld_snb,"event=0xcd,umask=0x1,ldlat=3" ); -EVENT_ATTR_STR (mem-stores, mem_st_snb,"event=0xcd,umask=0x2" ); +EVENT_ATTR_STR (mem-loads, mem_ld_nhm, +"event=0x0b,umask=0x10,ldlat=3,precise=1" ); +EVENT_ATTR_STR (mem-loads, mem_ld_snb, +"event=0xcd,umask=0x1,ldlat=3,precise=1" ); +EVENT_ATTR_STR (mem-stores, mem_st_snb, +"event=0xcd,umask=0x2,precise=1" );struct attribute *nhm_events_attrs[] = {EVENT_PTR (mem_ld_nhm),@@ -2033,8 +2036,9 @@ static __init void intel_nehalem_quirk(void) } } -EVENT_ATTR_STR (mem-loads, mem_ld_hsw,"event=0xcd,umask=0x1,ldlat=3" ); -EVENT_ATTR_STR(mem-stores, mem_st_hsw, "event=0xd0,umask=0x82") +EVENT_ATTR_STR (mem-loads, mem_ld_hsw, +"event=0xcd,umask=0x1,ldlat=3,precise=2" ); +EVENT_ATTR_STR(mem-stores, mem_st_hsw, "event=0xd0,umask=0x82,precise=2")static struct attribute *hsw_events_attrs[] = {EVENT_PTR (mem_ld_hsw), --1.8.1.4