summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2024-10-09 08:22:50 +0200
committerNamhyung Kim <namhyung@kernel.org>2024-10-14 21:04:31 +0200
commit1afe05b0cf183035a77fdda1bc633aa5fb9daa43 (patch)
tree18e7b46a13fa0d74e9e29c1c4daf429dd32f1ab7
parentperf sched timehist: Add pre-migration wait time option (diff)
downloadlinux-1afe05b0cf183035a77fdda1bc633aa5fb9daa43.tar.xz
linux-1afe05b0cf183035a77fdda1bc633aa5fb9daa43.zip
perf evsel: Fix missing inherit + sample read check
It should not clear the inherit bit simply because the kernel doesn't support the sample read with it. IOW the inherit bit should be kept when the sample read is not requested for the event. Fixes: 90035d3cd876cb71 ("tools/perf: Allow inherit + PERF_SAMPLE_READ when opening events") Acked-by: Ben Gainey <ben.gainey@arm.com> Link: https://lore.kernel.org/r/20241009062250.730192-1-namhyung@kernel.org Signed-off-by: Namhyung Kim <namhyung@kernel.org>
-rw-r--r--tools/perf/util/evsel.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index ed0d4d20e357..e9e1f576d34d 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1915,7 +1915,8 @@ static int __evsel__prepare_open(struct evsel *evsel, struct perf_cpu_map *cpus,
static void evsel__disable_missing_features(struct evsel *evsel)
{
- if (perf_missing_features.inherit_sample_read)
+ if (perf_missing_features.inherit_sample_read && evsel->core.attr.inherit &&
+ (evsel->core.attr.sample_type & PERF_SAMPLE_READ))
evsel->core.attr.inherit = 0;
if (perf_missing_features.branch_counters)
evsel->core.attr.branch_sample_type &= ~PERF_SAMPLE_BRANCH_COUNTERS;