perf tools: Check mem-loads auxiliary event
authorJin Yao <yao.jin@linux.intel.com>
Thu, 27 May 2021 00:16:03 +0000 (08:16 +0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 1 Jun 2021 14:02:56 +0000 (11:02 -0300)
For some platforms, an auxiliary event has to be enabled
simultaneously with the load latency event.

For Alderlake, the auxiliary event is created in "cpu_core" pmu.

So first we need to check the existing of "cpu_core" pmu
and then check if this pmu has auxiliary event.

Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20210527001610.10553-2-yao.jin@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/arch/x86/util/mem-events.c

index 588110f..e79232e 100644 (file)
@@ -11,8 +11,13 @@ static bool mem_loads_name__init;
 
 bool is_mem_loads_aux_event(struct evsel *leader)
 {
-       if (!pmu_have_event("cpu", "mem-loads-aux"))
-               return false;
+       if (perf_pmu__find("cpu")) {
+               if (!pmu_have_event("cpu", "mem-loads-aux"))
+                       return false;
+       } else if (perf_pmu__find("cpu_core")) {
+               if (!pmu_have_event("cpu_core", "mem-loads-aux"))
+                       return false;
+       }
 
        return leader->core.attr.config == MEM_LOADS_AUX;
 }