From: Namhyung Kim Date: Wed, 9 Oct 2024 06:22:50 +0000 (-0700) Subject: perf evsel: Fix missing inherit + sample read check X-Git-Tag: v6.13-rc1~68^2~161 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1afe05b0cf183035a77fdda1bc633aa5fb9daa43;p=thirdparty%2Flinux.git 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 Link: https://lore.kernel.org/r/20241009062250.730192-1-namhyung@kernel.org Signed-off-by: Namhyung Kim --- diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index ed0d4d20e3576..e9e1f576d34dd 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;