The PMU of armv7_a9 machine does not have the capability to exclude
counting events that occur in specific contexts such as guest, so
sys_perf_event_open() syscall returned with -EINVAL.
See following code:
static int perf_try_init_event(struct pmu *pmu, struct perf_event *event)
{
...
if (pmu->capabilities & PERF_PMU_CAP_NO_EXCLUDE &&
event_has_any_exclude_flag(event))
ret = -EINVAL;
...
}
Then evsel__open_cpu will use perf_missing_features.mmap2 to fallback to
not using .mmap2 and fail to re-execute sys_perf_event_open. Next,
evsel__open_cpu use perf_missing_features.exclude_guest to fallback to
not using .exclude_guest and finally success to re-execute
sys_perf_event_open.
When .mmap2 is not used, the input parameter flag of map__new is 0,
perf will not find the perf-%d.map to resolve.
Therefore, in this submission, the disabling order of .mmap2 and
exclude_guest is reversed to fix the failure to resolve symbols with JIT.
Fixes: cc6795aeffe ("perf/core: Add PERF_PMU_CAP_NO_EXCLUDE for exclusion incapable PMUs")
Signed-off-by: Jiangfeng Xiao <[email protected]>
---
tools/perf/util/evsel.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index dbfeceb..d6bf15b 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1896,15 +1896,15 @@ bool evsel__detect_missing_features(struct evsel *evsel)
perf_missing_features.cloexec = true;
pr_debug2_peo("switching off cloexec flag\n");
return true;
- } else if (!perf_missing_features.mmap2 && evsel->core.attr.mmap2) {
- perf_missing_features.mmap2 = true;
- pr_debug2_peo("switching off mmap2\n");
- return true;
} else if (!perf_missing_features.exclude_guest &&
(evsel->core.attr.exclude_guest || evsel->core.attr.exclude_host)) {
perf_missing_features.exclude_guest = true;
pr_debug2_peo("switching off exclude_guest, exclude_host\n");
return true;
+ } else if (!perf_missing_features.mmap2 && evsel->core.attr.mmap2) {
+ perf_missing_features.mmap2 = true;
+ pr_debug2_peo("switching off mmap2\n");
+ return true;
} else if (!perf_missing_features.sample_id_all) {
perf_missing_features.sample_id_all = true;
pr_debug2_peo("switching off sample_id_all\n");
--
1.8.5.6