summaryrefslogtreecommitdiff
path: root/scripts/basic/split-include.c
diff options
context:
space:
mode:
authorJames Clark <james.clark@linaro.org>2026-10-07 11:52:13 +0100
committerArnaldo Carvalho de Melo <acme@redhat.com>2026-10-27 17:40:24 -0300
commitfe7b73c293f1a5b0b7d8a4748b4c076fa7db852c (patch)
tree9c47a74041df06934d021db214593bf5d6904d5b /scripts/basic/split-include.c
parente793b6a4be3c7810c92eeeb21bfd0f03c22fcbcb (diff)
downloadlinux-fe7b73c293f1a5b0b7d8a4748b4c076fa7db852c.tar.gz
linux-fe7b73c293f1a5b0b7d8a4748b4c076fa7db852c.zip
perf tests mmap-basic: Fix user rdpmc detection logic
RISC-V and Arm control userspace counter access through /proc/sys/kernel/perf_user_access. Add that as a fallback to set_user_read() so the test can exercise both enabled and disabled states on those platforms. Document disabled, enabled and legacy states in user_read_state and fail on values outside the known 0-2 range. Preserve and restore any value in this range, rather than just 0 or 1. Skip when the control files exist but can't be written to (USER_READ_ERR_PERM). We can't rely on always being able to write to them when an exclude_kernel=0 event can be opened because opening events might succeed for non-root users when perf_event_paranoid=-1. This test isn't run on unsupported platforms since the previous commit, so we can simplify the following things: * Test that cap_user_rdpmc is always equal to the requested state rather than checking it only when disabled. As long as we stop setting the cap in the attr unconditionally on Arm, this is ok. * Remove the USER_READ_UNKNOWN/rdpmc_supported fallback in the checks. Now the expected state is always the one requested. USER_READ_UNKNOWN only controls whether to skip restoration of the state on unsupported platforms, so call it USER_READ_ERR_NO_FILE. Signed-off-by: James Clark <james.clark@linaro.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Albert Ou <aou@eecs.berkeley.edu> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Alexandre Ghiti <alex@ghiti.fr> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Leo Yan <leo.yan@arm.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Michael Petlan <mpetlan@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Palmer Dabbelt <palmer@dabbelt.com> Cc: Paul Walmsley <pjw@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Assisted-by: Codex:GPT-6.1-Sol [Re-write: [Re-write to fix bugs in set_user_read() and simplify tests] Signed-off-by: Qiao Zhao <qzhao@redhat.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'scripts/basic/split-include.c')
0 files changed, 0 insertions, 0 deletions