perf evsel: Compute is_hybrid from PMU being core

Short-cut when has_hybrid is false, otherwise return if the evsel's
PMU is core. Add a comment for the some what surprising no PMU cases
of hardware and legacy cache events.

Reviewed-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ali Saidi <alisaidi@amazon.com>
Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: Dmitrii Dolgov <9erthalion6@gmail.com>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jing Zhang <renyu.zj@linux.alibaba.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Kajol Jain <kjain@linux.ibm.com>
Cc: Kang Minchul <tegongkang@gmail.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Ming Wang <wangming01@loongson.cn>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: Rob Herring <robh@kernel.org>
Cc: Sandipan Das <sandipan.das@amd.com>
Cc: Sean Christopherson <seanjc@google.com>
Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
Cc: coresight@lists.linaro.org
Cc: linux-arm-kernel@lists.infradead.org
Link: https://lore.kernel.org/r/20230527072210.2900565-20-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Ian Rogers 2023-05-27 00:21:55 -07:00 committed by Arnaldo Carvalho de Melo
parent 1215795ceb
commit 5d9fb66676
2 changed files with 15 additions and 2 deletions

View File

@ -46,8 +46,8 @@
#include "memswap.h" #include "memswap.h"
#include "util.h" #include "util.h"
#include "util/hashmap.h" #include "util/hashmap.h"
#include "pmu-hybrid.h"
#include "off_cpu.h" #include "off_cpu.h"
#include "pmu.h"
#include "../perf-sys.h" #include "../perf-sys.h"
#include "util/parse-branch-options.h" #include "util/parse-branch-options.h"
#include "util/bpf-filter.h" #include "util/bpf-filter.h"
@ -3132,9 +3132,17 @@ void evsel__zero_per_pkg(struct evsel *evsel)
} }
} }
/**
* evsel__is_hybrid - does the evsel have a known PMU that is hybrid. Note, this
* will be false on hybrid systems for hardware and legacy
* cache events.
*/
bool evsel__is_hybrid(const struct evsel *evsel) bool evsel__is_hybrid(const struct evsel *evsel)
{ {
return evsel->pmu_name && perf_pmu__is_hybrid(evsel->pmu_name); if (!perf_pmu__has_hybrid())
return false;
return evsel->core.is_pmu_core;
} }
struct evsel *evsel__leader(const struct evsel *evsel) struct evsel *evsel__leader(const struct evsel *evsel)

View File

@ -102,6 +102,11 @@ int perf_pmu__scan_file(struct perf_pmu *pmu, const char *name, const char *fmt,
return EOF; return EOF;
} }
bool perf_pmu__has_hybrid(void)
{
return false;
}
bool evsel__is_aux_event(const struct evsel *evsel __maybe_unused) bool evsel__is_aux_event(const struct evsel *evsel __maybe_unused)
{ {
return false; return false;