Commit f7400262 authored by Namhyung Kim's avatar Namhyung Kim Committed by Arnaldo Carvalho de Melo

perf tools: Save evsel->pmu in parse_events()

Now evsel has a pmu pointer, let's save the info and use it like in
evsel__find_pmu().  The missing feature check needs to be changed as the
pmu pointer can be set from the beginning.
Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
Acked-by: default avatarIan Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
Link: https://lore.kernel.org/r/20221018020227.85905-2-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent c4f769d4
......@@ -467,6 +467,7 @@ struct evsel *evsel__clone(struct evsel *orig)
evsel->collect_stat = orig->collect_stat;
evsel->weak_group = orig->weak_group;
evsel->use_config_name = orig->use_config_name;
evsel->pmu = orig->pmu;
if (evsel__copy_config_terms(evsel, orig) < 0)
goto out_err;
......@@ -1966,10 +1967,10 @@ bool evsel__detect_missing_features(struct evsel *evsel)
perf_missing_features.mmap2 = true;
pr_debug2_peo("switching off mmap2\n");
return true;
} else if ((evsel->core.attr.exclude_guest || evsel->core.attr.exclude_host) &&
(evsel->pmu == NULL || evsel->pmu->missing_features.exclude_guest)) {
if (evsel->pmu == NULL) {
} else if (evsel->core.attr.exclude_guest || evsel->core.attr.exclude_host) {
if (evsel->pmu == NULL)
evsel->pmu = evsel__find_pmu(evsel);
if (evsel->pmu)
evsel->pmu->missing_features.exclude_guest = true;
else {
......@@ -1977,7 +1978,6 @@ bool evsel__detect_missing_features(struct evsel *evsel)
evsel->core.attr.exclude_host = false;
evsel->core.attr.exclude_guest = false;
}
}
if (evsel->exclude_GH) {
pr_debug2_peo("PMU has no exclude_host/guest support, bailing out\n");
......
......@@ -266,6 +266,7 @@ __add_event(struct list_head *list, int *idx,
evsel->core.own_cpus = perf_cpu_map__get(cpus);
evsel->core.requires_cpu = pmu ? pmu->is_uncore : false;
evsel->auto_merge_stats = auto_merge_stats;
evsel->pmu = pmu;
if (name)
evsel->name = strdup(name);
......
......@@ -1065,11 +1065,15 @@ struct perf_pmu *evsel__find_pmu(struct evsel *evsel)
{
struct perf_pmu *pmu = NULL;
if (evsel->pmu)
return evsel->pmu;
while ((pmu = perf_pmu__scan(pmu)) != NULL) {
if (pmu->type == evsel->core.attr.type)
break;
}
evsel->pmu = pmu;
return pmu;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment