Linux/linux 16f4641arch/x86/events/amd uncore.c

perf/x86/amd/uncore: Do not set 'ThreadMask' and 'SliceMask' for non-L3 PMCs

The following commit:

  d7cbbe49a930 ("perf/x86/amd/uncore: Set ThreadMask and SliceMask for L3 Cache perf events")

enables L3 PMC events for all threads and slices by writing 1's in
'ChL3PmcCfg' (L3 PMC PERF_CTL) register fields.

Those bitfields overlap with high order event select bits in the Data
Fabric PMC control register, however.

So when a user requests raw Data Fabric events (-e amd_df/event=0xYYY/),
the two highest order bits get inadvertently set, changing the counter
select to events that don't exist, and for which no counts are read.

This patch changes the logic to write the L3 masks only when dealing
with L3 PMC counters.

AMD Family 16h and below Northbridge (NB) counters were not affected.

Signed-off-by: Kim Phillips <kim.phillips at amd.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz at infradead.org>
Cc: <stable at vger.kernel.org>
Cc: Alexander Shishkin <alexander.shishkin at linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme at redhat.com>
Cc: Borislav Petkov <bp at alien8.de>
Cc: Gary Hook <Gary.Hook at amd.com>
Cc: H. Peter Anvin <hpa at zytor.com>
Cc: Janakarajan Natarajan <Janakarajan.Natarajan at amd.com>
Cc: Jiri Olsa <jolsa at redhat.com>
Cc: Linus Torvalds <torvalds at linux-foundation.org>
Cc: Martin Liska <mliska at suse.cz>
Cc: Namhyung Kim <namhyung at kernel.org>
Cc: Peter Zijlstra <peterz at infradead.org>
Cc: Pu Wen <puwen at hygon.cn>
Cc: Stephane Eranian <eranian at google.com>
Cc: Suravee Suthikulpanit <Suravee.Suthikulpanit at amd.com>
Cc: Thomas Gleixner <tglx at linutronix.de>
Cc: Vince Weaver <vincent.weaver at maine.edu>
Fixes: d7cbbe49a930 ("perf/x86/amd/uncore: Set ThreadMask and SliceMask for L3 Cache perf events")
Link: https://lkml.kernel.org/r/20190628215906.4276-1-kim.phillips@amd.com
Signed-off-by: Ingo Molnar <mingo at kernel.org>
DeltaFile
+1-1arch/x86/events/amd/uncore.c
+1-11 files

UnifiedSplitRaw