]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
perf tools: Fix missing feature check for inherit + SAMPLE_READ
authorNamhyung Kim <namhyung@kernel.org>
Tue, 11 Nov 2025 07:59:44 +0000 (23:59 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Dec 2025 13:02:57 +0000 (14:02 +0100)
[ Upstream commit 367377f45c0b568882567f797b7b18b263505be7 ]

It should also have PERF_SAMPLE_TID to enable inherit and PERF_SAMPLE_READ
on recent kernels.  Not having _TID makes the feature check wrongly detect
the inherit and _READ support.

It was reported that the following command failed due to the error in
the missing feature check on Intel SPR machines.

  $ perf record -e '{cpu/mem-loads-aux/S,cpu/mem-loads,ldlat=3/PS}' -- ls
  Error:
  Failure to open event 'cpu/mem-loads,ldlat=3/PS' on PMU 'cpu' which will be removed.
  Invalid event (cpu/mem-loads,ldlat=3/PS) in per-thread mode, enable system wide with '-a'.

Reviewed-by: Ian Rogers <irogers@google.com>
Fixes: 3b193a57baf15c468 ("perf tools: Detect missing kernel features properly")
Reported-and-tested-by: Chen, Zide <zide.chen@intel.com>
Closes: https://lore.kernel.org/lkml/20251022220802.1335131-1-zide.chen@intel.com/
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/perf/util/evsel.c

index 56ebefd075f2e35f2d0812994d39182859fd2ceb..9df9818e3701390c7ad1195318bc2d205689d76f 100644 (file)
@@ -2473,7 +2473,7 @@ static bool evsel__detect_missing_features(struct evsel *evsel, struct perf_cpu
        /* Please add new feature detection here. */
 
        attr.inherit = true;
-       attr.sample_type = PERF_SAMPLE_READ;
+       attr.sample_type = PERF_SAMPLE_READ | PERF_SAMPLE_TID;
        if (has_attr_feature(&attr, /*flags=*/0))
                goto found;
        perf_missing_features.inherit_sample_read = true;