mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
perf tests mmap-basic: Only test userspace reading on supported platforms
mmap_user_read_instr() and mmap_user_read_instr_disabled() are the same
test for platforms that libperf doesn't support userspace counter
reading for. Only run the 'enabled' test for platforms that do support
it in order to simplify it in the next commit and not run the same test
twice.
The test can then assert stronger guarantees and have fewer edge cases
to handle as we know it only runs in places where 'rdmpc_supported' will
be true.
"unsupported" hasn't been a relevant skip reason since
commit 588d22b404 ("perf test: Expand user space event reading (rdpmc)
tests") added the UNKNOWN fallback for unsupported platforms. Remove it
and leave only "permissions".
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>
Cc: Qiao Zhao <qzhao@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
1e826983ce
commit
e793b6a4be
|
|
@ -378,13 +378,13 @@ static int test_stat_user_read(u64 event, enum user_read_state enabled)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int test__mmap_user_read_instr(struct test_suite *test __maybe_unused,
|
||||
static int __maybe_unused test__mmap_user_read_instr(struct test_suite *test __maybe_unused,
|
||||
int subtest __maybe_unused)
|
||||
{
|
||||
return test_stat_user_read(PERF_COUNT_HW_INSTRUCTIONS, USER_READ_ENABLED);
|
||||
}
|
||||
|
||||
static int test__mmap_user_read_cycles(struct test_suite *test __maybe_unused,
|
||||
static int __maybe_unused test__mmap_user_read_cycles(struct test_suite *test __maybe_unused,
|
||||
int subtest __maybe_unused)
|
||||
{
|
||||
return test_stat_user_read(PERF_COUNT_HW_CPU_CYCLES, USER_READ_ENABLED);
|
||||
|
|
@ -406,42 +406,29 @@ static struct test_case tests__basic_mmap[] = {
|
|||
TEST_CASE_REASON("Read samples using the mmap interface",
|
||||
basic_mmap,
|
||||
"permissions"),
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__) || \
|
||||
(defined(__riscv) && __riscv_xlen == 64)
|
||||
/*
|
||||
* libperf only supports userspace read for these platforms, see
|
||||
* tools/lib/perf/mmap.c
|
||||
*/
|
||||
TEST_CASE_REASON_EXCLUSIVE("User space counter reading of instructions",
|
||||
mmap_user_read_instr,
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__) || \
|
||||
(defined(__riscv) && __riscv_xlen == 64)
|
||||
"permissions"
|
||||
#else
|
||||
"unsupported"
|
||||
#endif
|
||||
),
|
||||
mmap_user_read_instr,
|
||||
"permissions"),
|
||||
TEST_CASE_REASON_EXCLUSIVE("User space counter reading of cycles",
|
||||
mmap_user_read_cycles,
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__) || \
|
||||
(defined(__riscv) && __riscv_xlen == 64)
|
||||
"permissions"
|
||||
#else
|
||||
"unsupported"
|
||||
mmap_user_read_cycles,
|
||||
"permissions"),
|
||||
#endif
|
||||
),
|
||||
|
||||
/* Counter read via userpage fallback is supported on all platforms */
|
||||
TEST_CASE_REASON_EXCLUSIVE("User space counter disabling instructions",
|
||||
mmap_user_read_instr_disabled,
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__) || \
|
||||
(defined(__riscv) && __riscv_xlen == 64)
|
||||
"permissions"
|
||||
#else
|
||||
"unsupported"
|
||||
#endif
|
||||
),
|
||||
mmap_user_read_instr_disabled,
|
||||
"permissions"),
|
||||
TEST_CASE_REASON_EXCLUSIVE("User space counter disabling cycles",
|
||||
mmap_user_read_cycles_disabled,
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__) || \
|
||||
(defined(__riscv) && __riscv_xlen == 64)
|
||||
"permissions"
|
||||
#else
|
||||
"unsupported"
|
||||
#endif
|
||||
),
|
||||
mmap_user_read_cycles_disabled,
|
||||
"permissions"),
|
||||
|
||||
{ .name = NULL, }
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user