Commit 1afe05b0 authored by Namhyung Kim's avatar Namhyung Kim
Browse files

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: 90035d3c ("tools/perf: Allow inherit + PERF_SAMPLE_READ when opening events")
Acked-by: default avatarBen Gainey <ben.gainey@arm.com>
Link: https://lore.kernel.org/r/20241009062250.730192-1-namhyung@kernel.org


Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
parent cd912ab3
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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;