]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
perf x86/topdown: Complete topdown slots/metrics events check
authorDapeng Mi <dapeng1.mi@linux.intel.com>
Fri, 13 Sep 2024 08:47:07 +0000 (08:47 +0000)
committerNamhyung Kim <namhyung@kernel.org>
Mon, 30 Sep 2024 22:23:43 +0000 (15:23 -0700)
commit39820ced2aa1fb2453294909651dfc7dd6e6e028
treeb37192b518703d14da5523377d9df7fe96004e4d
parent4d1b305dc8d74114abd544b0c11397ceb9ded528
perf x86/topdown: Complete topdown slots/metrics events check

It's not complete to check whether an event is a topdown slots or
topdown metrics event by only comparing the event name since user
may assign the event by RAW format, e.g.

perf stat -e '{instructions,cpu/r400/,cpu/r8300/}' sleep 1

 Performance counter stats for 'sleep 1':

     <not counted>      instructions
     <not counted>      cpu/r400/
   <not supported>      cpu/r8300/

       1.002917796 seconds time elapsed

       0.002955000 seconds user
       0.000000000 seconds sys

The RAW format slots and topdown-be-bound events are not recognized and
not regroup the events, and eventually cause error.

Thus add two helpers arch_is_topdown_slots()/arch_is_topdown_metrics()
to detect whether an event is topdown slots/metrics event by comparing
the event config directly, and use these two helpers to replace the
original event name comparisons.

Reviewed-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
Cc: Yongwei Ma <yongwei.ma@intel.com>
Link: https://lore.kernel.org/r/20240913084712.13861-2-dapeng1.mi@linux.intel.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/arch/x86/util/evlist.c
tools/perf/arch/x86/util/evsel.c
tools/perf/arch/x86/util/topdown.c
tools/perf/arch/x86/util/topdown.h