Add group constraints and event code test as part of selftest
v3 cover Add group constraints and event code test as part of selftest
Patch series extends the perf interface selftests to cover scenarios for event code checking, group constraints, and also thresholding/branch related interface tests in sampling area.
In this series, patches 1 to 14 adds additional tests under "powerpc/sampling_tests". These adds support for handling sample type PERF_SAMPLE_BRANCH_STACK along with interrupt regs. It adds utility functions and test for thresh_cmp and branch filters programmed in control register. Some of the tests needs to be skipped for "Generic Compat PMU" environment. Hence utility functions are added in "include/utils.c" and "sampling_tests/misc.h" to detect platform based on "auxv" entries.
Currently in other architectures (like x86), the pmu_name is exposed via sysfs caps folder ie:
"sys/bus/event_source/devices/<pmu>/caps". But in powerpc, "caps" is not supported. So, though the approach for detecting compat mode currently uses auxv, patchset adds an utility function considering a possibility of getting "caps" added for powerpc.
Link to the patch to add support for caps under sysfs in powerpc:
http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=301270
Patches 15 to 35 covers test related to group constraints and event codes. These new set of changes are added under new folder:
"selftests/powerpc/pmu/event_code_tests"
Patch 15 covers changes required for new folder with Makefile changes. The other patches add tests for perf interface to check the event group constraints, valid/invalid event codes, blacklisted events etc. Also add required utility functions under header file "misc.h" in sampling_tests folder.
Patch 13 of the patchset add selftest for mmcr1 pmcxsel/unit/cache fields, which was initially dropeed from sampling test patchset (patch number: 16)
Link to the patch:
http://patchwork.ozlabs.org/project/linuxppc-dev/patch/[email protected]/
Changelog:
v2 -> v3:
Changed name for generic compat PMU to ISAv3 in Patch2. This is based on recent patch sent by Joel Stanley to change name for generic_compat_pmu to ISAv3.
http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=304131
v1 -> v2:
Patch 12: Fixed bhrb_filter_map testcase to address build failure in distro like Ubuntu 16.04. This testcase uses perf branch sample types from include/uapi/linux/perf_event.h and three of the sample types are not defined in Ubuntu 16.04. Hence changed the logic to loop over values from PERF_SAMPLE_BRANCH_USER_SHIFT to PERF_SAMPLE_BRANCH_MAX_SHIFT as suggested by Michael Ellerman.
Patch 2: The sampling_tests/misc.c used pmu_name for generic compat pmu as generic_compat_pmu. But latest version of patch to expose caps in powerpc will use power_pmu->name. So change the pmu name in misc code as GENERIC_COMPAT ( which is what pmu->name uses in driver code).
Link to linuxppc-ci:
https://github.com/athira-rajeev/linux-ci/actions?query=branch%3Aselftest_v5_set2
Athira Rajeev (20):
testing/selftests/powerpc: Add support to fetch "platform" and "base
platform" from auxv to detect platform.
selftest/powerpc/pmu: Refactor the platform check and add macros to
find array size/PVR
selftest/powerpc/pmu: Add selftest to check branch stack enablement
will not crash on any platforms
selftest/powerpc/pmu: Add selftest to check PERF_SAMPLE_REGS_INTR
option will not crash on any platforms
selftest/powerpc/pmu: Add selftest for checking valid and invalid bhrb
filter maps
selftest/powerpc/pmu: Add selftest for mmcr1 pmcxsel/unit/cache fields selftest/powerpc/pmu: Add support for perf event code tests selftest/powerpc/pmu: Add selftest for group constraint check for PMC5
and PMC6
selftest/powerpc/pmu: Add selftest to check PMC5/6 is excluded from
some constraint checks
selftest/powerpc/pmu: Add selftest to check constraint for number of
counters in use.
selftest/powerpc/pmu: Add selftest for group constraint check when
using same PMC
selftest/powerpc/pmu: Add selftest for group constraint check for
radix_scope_qual field
selftest/powerpc/pmu: Add selftest for group constraint for MMCRA
Sampling Mode field
selftest/powerpc/pmu: Add selftest for group constraint check MMCRA
sample bits
selftest/powerpc/pmu: Add selftest for checking invalid bits in event
code
selftest/powerpc/pmu: Add selftest for reserved bit check for MMCRA
thresh_ctl field
selftest/powerpc/pmu: Add selftest for blacklist events check in
power9
selftest/powerpc/pmu: Add selftest for event alternatives for power9 selftest/powerpc/pmu: Add selftest for event alternatives for power10 selftest/powerpc/pmu: Add selftest for PERF_TYPE_HARDWARE events valid
check
Kajol Jain (15):
selftest/powerpc/pmu: Add mask/shift bits for extracting threshold
compare field
selftest/powerpc/pmu: Add interface test for mmcra_thresh_cmp fields selftest/powerpc/pmu: Add support for branch sampling in get_intr_regs
function
selftest/powerpc/pmu: Add interface test for mmcra_ifm field of
indirect call type
selftest/powerpc/pmu: Add interface test for mmcra_ifm field for any
branch type
selftest/powerpc/pmu: Add interface test for mmcra_ifm field for
conditional branch type
selftest/powerpc/pmu: Add interface test for bhrb disable field selftest/powerpc/pmu: Add interface test for bhrb disable field for
non-branch samples
selftest/powerpc/pmu: Add selftest for group constraint check for
MMCR0 l2l3_sel bits
selftest/powerpc/pmu: Add selftest for group constraint check for
MMCR1 cache bits
selftest/powerpc/pmu: Add selftest for group constraint check for
MMCRA thresh_cmp field
selftest/powerpc/pmu: Add selftest for group constraint for unit and
pmc field in p9
selftest/powerpc/pmu: Add selftest for group constraint check for
MMCRA thresh_ctl field
selftest/powerpc/pmu: Add selftest for group constraint check for
MMCRA thresh_sel field
selftest/powerpc/pmu: Add test for hardware cache events
tools/testing/selftests/powerpc/include/reg.h | 4 + .../testing/selftests/powerpc/include/utils.h | 10 ++ tools/testing/selftests/powerpc/pmu/Makefile | 11 +- .../selftests/powerpc/pmu/branch_loops.S | 28 ++++ .../powerpc/pmu/event_code_tests/Makefile | 15 ++ .../blacklisted_events_test.c | 132 +++++++++++++++++ .../event_alternatives_tests_p10.c | 109 ++++++++++++++ .../event_alternatives_tests_p9.c | 116 +++++++++++++++ .../generic_events_valid_test.c | 130 +++++++++++++++++ .../group_constraint_cache_test.c | 60 ++++++++ .../group_constraint_l2l3_sel_test.c | 64 +++++++++ .../group_constraint_mmcra_sample_test.c | 54 +++++++ .../group_constraint_pmc56_test.c | 63 ++++++++ .../group_constraint_pmc_count_test.c | 70 +++++++++ .../group_constraint_radix_scope_qual_test.c | 56 ++++++++ .../group_constraint_repeat_test.c | 56 ++++++++ .../group_constraint_thresh_cmp_test.c | 96 +++++++++++++ .../group_constraint_thresh_ctl_test.c | 64 +++++++++ .../group_constraint_thresh_sel_test.c | 63 ++++++++ .../group_constraint_unit_test.c | 74 ++++++++++ .../group_pmc56_exclude_constraints_test.c | 64 +++++++++ .../hw_cache_event_type_test.c | 88 ++++++++++++ .../invalid_event_code_test.c | 67 +++++++++ ...eserved_bits_mmcra_sample_elig_mode_test.c | 77 ++++++++++ .../reserved_bits_mmcra_thresh_ctl_test.c | 44 ++++++ .../powerpc/pmu/sampling_tests/Makefile | 7 +- .../pmu/sampling_tests/bhrb_filter_map_test.c | 105 ++++++++++++++ .../bhrb_no_crash_wo_pmu_test.c | 59 ++++++++ .../intr_regs_no_crash_wo_pmu_test.c | 57 ++++++++ .../powerpc/pmu/sampling_tests/misc.c | 135 +++++++++++++++++- .../powerpc/pmu/sampling_tests/misc.h | 9 +- .../mmcr1_sel_unit_cache_test.c | 77 ++++++++++ .../pmu/sampling_tests/mmcra_bhrb_any_test.c | 65 +++++++++ .../pmu/sampling_tests/mmcra_bhrb_cond_test.c | 69 +++++++++ .../mmcra_bhrb_disable_no_branch_test.c | 64 +++++++++ .../sampling_tests/mmcra_bhrb_disable_test.c | 66 +++++++++ .../sampling_tests/mmcra_bhrb_ind_call_test.c | 69 +++++++++ .../sampling_tests/mmcra_thresh_cmp_test.c | 74 ++++++++++ 38 files changed, 2461 insertions(+), 10 deletions(-) create mode 100644 tools/testing/selftests/powerpc/pmu/branch_loops.S create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/Makefile create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/blacklisted_events_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/event_alternatives_tests_p10.c create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/event_alternatives_tests_p9.c create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/generic_events_valid_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_cache_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_l2l3_sel_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_mmcra_sample_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_pmc56_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_pmc_count_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_radix_scope_qual_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_repeat_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_thresh_cmp_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_thresh_ctl_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_thresh_sel_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_unit_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/group_pmc56_exclude_constraints_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/hw_cache_event_type_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/invalid_event_code_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/reserved_bits_mmcra_sample_elig_mode_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/reserved_bits_mmcra_thresh_ctl_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/sampling_tests/bhrb_filter_map_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/sampling_tests/bhrb_no_crash_wo_pmu_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/sampling_tests/intr_regs_no_crash_wo_pmu_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/sampling_tests/mmcr1_sel_unit_cache_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/sampling_tests/mmcra_bhrb_any_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/sampling_tests/mmcra_bhrb_cond_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/sampling_tests/mmcra_bhrb_disable_no_branch_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/sampling_tests/mmcra_bhrb_disable_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/sampling_tests/mmcra_bhrb_ind_call_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/sampling_tests/mmcra_thresh_cmp_test.c
Signature · 1 line
2.35.1
PATCH v3 1/35 selftest/powerpc/pmu: Add mask/shift bits for extracting threshold compare field
From: Kajol Jain <[email protected]>
In power10, threshold compare field is not part of the raw event code and provided via event attribute config1. Hence add the mask and shift bits based on event attribute config1, to extract the threshold compare value for power10
Also add a new function called get_thresh_cmp_val to compute and return the threshold compare field for a given platform, since incase of power10, threshold compare value provided is decimal.
--- .../powerpc/pmu/sampling_tests/misc.c | 44 +++++++++++++++++++ .../powerpc/pmu/sampling_tests/misc.h | 1 + 2 files changed, 45 insertions(+)
tools/testing/selftests/powerpc/pmu/sampling_tests/misc.c +44 -0
@@ -60,6 +60,8 @@ static void init_ev_encodes(void)switch (pvr) {case POWER10 : + ev_mask_thd_cmp =0x3ffff ; + ev_shift_thd_cmp =0 ; ev_mask_rsq =1 ; ev_shift_rsq =9 ; ev_mask_comb =3 ;
@@ -410,3 +412,45 @@ u64 get_reg_value(u64 *intr_regs, char *register_name)return *(intr_regs + register_bit_position); } + +int get_thresh_cmp_val (struct event event) +{ +int exp =0 ; +u64 result =0 ; +u64 value; + +if (!have_hwcap2 (PPC_FEATURE2_ARCH_3_1 )) +return EV_CODE_EXTRACT (event.attr.config, thd_cmp); + + value =EV_CODE_EXTRACT (event.attr.config1, thd_cmp); + +if (!value) +return value; + +/* +* Incase of P10, thresh_cmp value is not part of raw event code +* and provided via attr.config1 parameter. To program threshold in MMCRA, +* take a 18 bit number N and shift right 2 places and increment +* the exponent E by 1 until the upper 10 bits of N are zero. +* Write E to the threshold exponent and write the lower 8 bits of N +* to the threshold mantissa. +* The max threshold that can be written is 261120. +*/ +if (value >261120 ) + value =261120 ; +while ((64 -__builtin_clzl (value)) >8 ) { + exp++; + value >>=2 ; + } + +/* +* Note that it is invalid to write a mantissa with the +* upper 2 bits of mantissa being zero, unless the +* exponent is also zero. +*/ +if (!(value &0xC0 ) && exp) + result =-1 ; +else + result = (exp <<8 ) | value; +return result; +}
tools/testing/selftests/powerpc/pmu/sampling_tests/misc.h +1 -0
@@ -52,6 +52,7 @@ void *__event_read_samples(void *sample_buff, size_t *size, u64 *sample_count);int collect_samples (void *sample_buff);u64 *get_intr_regs (struct event *event,void *sample_buff);u64 get_reg_value (u64 *intr_regs,char *register_name); +int get_thresh_cmp_val (struct event event);static inline int get_mmcr0_fc56 (u64 mmcr0,int pmc) {
Signature · 1 line
2.35.1
PATCH v3 2/35 testing/selftests/powerpc: Add support to fetch "platform" and "base platform" from auxv to detect platform.
In reply to Athira RajeevThe /proc/self/auxv contains information about "platform" on any system. Also "base platform" which is an indication about platform string corresponding to the real PVR. When systems are booted in compat mode, say, power10 booted in power9 mode, "platform" will point to power9 whereas base platform will point to power10. Incase, if the distro doesn't support platform indicated by real PVR, base platform will have a default value.
The mismatch of platform/base platform is an indication of system booted in compat mode. In such cases, distro will have a Generic Compat registered which supports basic features for performance monitoring.
Some of the selftest needs to be handled differently ( ex: generic events, alternative events, bhrb filter map) in Generic Compat PMU. Hence selftest framework needs utility functions to identify such cases. One way is make sure of auxv information. Below condition can be used to detect if Generic Compat PMU is registered. ie:
<<>>
if ((AT_PLATFORM != AT_BASE_PLATFORM) && (AT_BASE_PLATFORM != PVR)) <<>>
this indicates Generic Compat PMU.
Add utility function in "include/utils.h" to return:AT_PLATFORM and AT_BASE_PLATFORM from auxv. Also update misc.c in "sampling_tests" folder to add function to use above check to determine presence of generic compat pmu.
In other architecture ( like x86 ), pmu_name is exposed via "/sys/bus/event_source/devices/cpu/caps". The same could be used in powerpc in future. Since currently we don't have the "caps" support in powerpc, patch uses auxv information to detect platform type and compat mode. But as placeholder utility function is added considering possiblity of getting "caps" information via sysfs. If that doesn't exist, fallback to using auxv information.
--- .../testing/selftests/powerpc/include/utils.h | 10 ++++ .../powerpc/pmu/sampling_tests/misc.c | 50 +++++++++++++++++++ .../powerpc/pmu/sampling_tests/misc.h | 3 ++ 3 files changed, 63 insertions(+)
tools/testing/selftests/powerpc/include/utils.h +10 -0
@@ -74,6 +74,16 @@ static inline bool have_hwcap2(unsigned long ftr2) }#endif +static inline char *auxv_base_platform (void ) +{ +return ((char *)get_auxv_entry (AT_BASE_PLATFORM )); +} + +static inline char *auxv_platform (void ) +{ +return ((char *)get_auxv_entry (AT_PLATFORM )); +} +bool is_ppc64le (void );int using_hash_mmu (bool *using_hash);
tools/testing/selftests/powerpc/pmu/sampling_tests/misc.c +50 -0
53 lines not on this page · raw message
tools/testing/selftests/powerpc/pmu/sampling_tests/misc.h +3 -0
@@ -5,6 +5,7 @@* Copyright 2022, Kajol Jain, IBM Corp. */ +#include <sys/stat.h> #include "../event.h" #define POWER10 0x80
@@ -53,6 +54,8 @@ int collect_samples(void *sample_buff);u64 *get_intr_regs (struct event *event,void *sample_buff);u64 get_reg_value (u64 *intr_regs,char *register_name);int get_thresh_cmp_val (struct event event); +bool check_for_generic_compat_pmu (void ); +bool check_for_compat_mode (void );static inline int get_mmcr0_fc56 (u64 mmcr0,int pmc) {
Signature · 1 line
2.35.1
PATCH v3 3/35 selftest/powerpc/pmu: Add interface test for mmcra_thresh_cmp fields
In reply to Athira RajeevFrom: Kajol Jain <[email protected]>
The testcase uses event code 0x35340401e0 for load
only sampling, to verify the settings of thresh compare field in Monitor Mode Control Register A (MMCRA: 9-18 bits for power9 and MMCRA: 8-18 bits for power10). Testcase checks if the thresh compare field is programmed correctly via perf interface to MMCRA register.
--- .../powerpc/pmu/sampling_tests/Makefile | 2 +- .../sampling_tests/mmcra_thresh_cmp_test.c | 74 +++++++++++++++++++ 2 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/powerpc/pmu/sampling_tests/mmcra_thresh_cmp_test.c
tools/testing/selftests/powerpc/pmu/sampling_tests/Makefile +1 -1
@@ -4,7 +4,7 @@ CFLAGS += -m64 TEST_GEN_PROGS := mmcr0_exceptionbits_test mmcr0_cc56run_test mmcr0_pmccext_test \ mmcr0_pmcjce_test mmcr0_fc56_pmc1ce_test mmcr0_fc56_pmc56_test \ mmcr1_comb_test mmcr2_l2l3_test mmcr2_fcs_fch_test \ - mmcr3_src_test mmcra_thresh_marked_sample_test + mmcr3_src_test mmcra_thresh_marked_sample_test mmcra_thresh_cmp_test top_srcdir = ../../../../../.. include ../../../lib.mk
tools/testing/selftests/powerpc/pmu/sampling_tests/mmcra_thresh_cmp_test.c new file +74 -0
74 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH v3 4/35 selftest/powerpc/pmu: Add support for branch sampling in get_intr_regs function
In reply to Athira RajeevFrom: Kajol Jain <[email protected]>
Add support for sample type as PERF_SAMPLE_BRANCH_STACK in sampling tests. This change is a precursor/helper for sampling testcases, that test branck stack feature in perf interface.
--- .../powerpc/pmu/sampling_tests/misc.c | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)
tools/testing/selftests/powerpc/pmu/sampling_tests/misc.c +20 -1
@@ -259,13 +259,32 @@ u64 *get_intr_regs(struct event *event, void *sample_buff)u64 *intr_regs;size_t size =0 ; -if ((type ^PERF_SAMPLE_REGS_INTR )) +if ((type ^ (PERF_SAMPLE_REGS_INTR |PERF_SAMPLE_BRANCH_STACK )) && + (type ^PERF_SAMPLE_REGS_INTR ))return NULL ; intr_regs = (u64 *)perf_read_first_sample (sample_buff, &size);if (!intr_regs)return NULL ; +if (type &PERF_SAMPLE_BRANCH_STACK ) { +/* +* PERF_RECORD_SAMPLE and PERF_SAMPLE_BRANCH_STACK: +* struct { +* struct perf_event_header hdr; +* u64 number_of_branches; +* struct perf_branch_entry[number_of_branches]; +* u64 data[]; +* }; +* struct perf_branch_entry { +* u64 from; +* u64 to; +* u64 misc; +* }; +*/ + intr_regs += ((*intr_regs) *3 ) +1 ; + } +/* * First entry in the sample buffer used to specify * PERF_SAMPLE_REGS_ABI_64, skip perf regs abi to access
Signature · 1 line
2.35.1
PATCH v3 5/35 selftest/powerpc/pmu: Add interface test for mmcra_ifm field of indirect call type
In reply to Athira RajeevFrom: Kajol Jain <[email protected]>
The testcase uses "instructions" event to check if the Instruction filtering mode(IFM) bits are programmed correctly for indirect branch type. Testcase checks if IFM bits are programmed correctly to Monitor Mode Control Register A (MMCRA) via perf interface for ISA v3.1 platform.
--- .../selftests/powerpc/pmu/branch_loops.S | 28 ++++++++ .../powerpc/pmu/sampling_tests/Makefile | 5 +- .../sampling_tests/mmcra_bhrb_ind_call_test.c | 69 +++++++++++++++++++ 3 files changed, 100 insertions(+), 2 deletions(-) create mode 100644 tools/testing/selftests/powerpc/pmu/branch_loops.S create mode 100644 tools/testing/selftests/powerpc/pmu/sampling_tests/mmcra_bhrb_ind_call_test.c
tools/testing/selftests/powerpc/pmu/branch_loops.S new file +28 -0
@@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright 2022, Kajol Jain, IBM Corp. + */ + +#include <ppc-asm.h> + + .text + +#define ITER_SHIFT 31 + +FUNC_START(indirect_branch_loop) + li r3, 1 + sldi r3, r3, ITER_SHIFT + +1: cmpdi r3, 0 + beqlr + + addi r3, r3, -1 + + ld r4, 2f@got(%r2) + mtctr r4 + bctr + + .balign 32 +2: b 1b + +FUNC_END(indirect_branch_loop)
tools/testing/selftests/powerpc/pmu/sampling_tests/Makefile +3 -2
@@ -4,9 +4,10 @@ CFLAGS += -m64 TEST_GEN_PROGS := mmcr0_exceptionbits_test mmcr0_cc56run_test mmcr0_pmccext_test \ mmcr0_pmcjce_test mmcr0_fc56_pmc1ce_test mmcr0_fc56_pmc56_test \ mmcr1_comb_test mmcr2_l2l3_test mmcr2_fcs_fch_test \ - mmcr3_src_test mmcra_thresh_marked_sample_test mmcra_thresh_cmp_test + mmcr3_src_test mmcra_thresh_marked_sample_test mmcra_thresh_cmp_test \ + mmcra_bhrb_ind_call_test top_srcdir = ../../../../../.. include ../../../lib.mk -$(TEST_GEN_PROGS): ../../harness.c ../../utils.c ../event.c ../lib.c misc.c misc.h ../loop.S +$(TEST_GEN_PROGS): ../../harness.c ../../utils.c ../event.c ../lib.c misc.c misc.h ../loop.S ../branch_loops.S
tools/testing/selftests/powerpc/pmu/sampling_tests/mmcra_bhrb_ind_call_test.c new file +69 -0
69 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH v3 6/35 selftest/powerpc/pmu: Add interface test for mmcra_ifm field for any branch type
In reply to Athira RajeevFrom: Kajol Jain <[email protected]>
The testcase uses "instructions" event to check if the Instruction filtering mode(IFM) bits are programmed correctly for type any branch. Testcase checks if IFM bits is programmed correctly to Monitor Mode Control Register A (MMCRA) via perf interface.
--- .../powerpc/pmu/sampling_tests/Makefile | 2 +- .../pmu/sampling_tests/mmcra_bhrb_any_test.c | 65 +++++++++++++++++++ 2 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/powerpc/pmu/sampling_tests/mmcra_bhrb_any_test.c
tools/testing/selftests/powerpc/pmu/sampling_tests/Makefile +1 -1
@@ -5,7 +5,7 @@ TEST_GEN_PROGS := mmcr0_exceptionbits_test mmcr0_cc56run_test mmcr0_pmccext_test mmcr0_pmcjce_test mmcr0_fc56_pmc1ce_test mmcr0_fc56_pmc56_test \ mmcr1_comb_test mmcr2_l2l3_test mmcr2_fcs_fch_test \ mmcr3_src_test mmcra_thresh_marked_sample_test mmcra_thresh_cmp_test \ - mmcra_bhrb_ind_call_test + mmcra_bhrb_ind_call_test mmcra_bhrb_any_test top_srcdir = ../../../../../.. include ../../../lib.mk
tools/testing/selftests/powerpc/pmu/sampling_tests/mmcra_bhrb_any_test.c new file +65 -0
65 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH v3 7/35 selftest/powerpc/pmu: Add interface test for mmcra_ifm field for conditional branch type
In reply to Athira RajeevFrom: Kajol Jain <[email protected]>
The testcase uses "instructions" event to check if the Instruction filtering mode(IFM) bits are programmed correctly for conditional branch type. Testcase checks if IFM bits is programmed correctly to Monitor Mode Control Register A (MMCRA) via perf interface for ISA v3.1 platform.
--- .../powerpc/pmu/sampling_tests/Makefile | 2 +- .../pmu/sampling_tests/mmcra_bhrb_cond_test.c | 69 +++++++++++++++++++ 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/powerpc/pmu/sampling_tests/mmcra_bhrb_cond_test.c
tools/testing/selftests/powerpc/pmu/sampling_tests/Makefile +1 -1
@@ -5,7 +5,7 @@ TEST_GEN_PROGS := mmcr0_exceptionbits_test mmcr0_cc56run_test mmcr0_pmccext_test mmcr0_pmcjce_test mmcr0_fc56_pmc1ce_test mmcr0_fc56_pmc56_test \ mmcr1_comb_test mmcr2_l2l3_test mmcr2_fcs_fch_test \ mmcr3_src_test mmcra_thresh_marked_sample_test mmcra_thresh_cmp_test \ - mmcra_bhrb_ind_call_test mmcra_bhrb_any_test + mmcra_bhrb_ind_call_test mmcra_bhrb_any_test mmcra_bhrb_cond_test top_srcdir = ../../../../../.. include ../../../lib.mk
tools/testing/selftests/powerpc/pmu/sampling_tests/mmcra_bhrb_cond_test.c new file +69 -0
69 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH v3 8/35 selftest/powerpc/pmu: Add interface test for bhrb disable field
In reply to Athira RajeevFrom: Kajol Jain <[email protected]>
The testcase uses "instructions" event to generate the samples and fetch Monitor Mode Control Register A (MMCRA) when overflow. Branch History Rolling Buffer(bhrb) disable bit is part of MMCRA which need to be verified by perf interface. Testcase checks if the bhrb disable bit of MMCRA register is programmed correctly via perf interface for ISA v3.1 platform Also make get_mmcra_ifm return type as u64.
--- .../powerpc/pmu/sampling_tests/Makefile | 3 +- .../powerpc/pmu/sampling_tests/misc.h | 2 +- .../sampling_tests/mmcra_bhrb_disable_test.c | 66 +++++++++++++++++++ 3 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 tools/testing/selftests/powerpc/pmu/sampling_tests/mmcra_bhrb_disable_test.c
tools/testing/selftests/powerpc/pmu/sampling_tests/Makefile +2 -1
@@ -5,7 +5,8 @@ TEST_GEN_PROGS := mmcr0_exceptionbits_test mmcr0_cc56run_test mmcr0_pmccext_test mmcr0_pmcjce_test mmcr0_fc56_pmc1ce_test mmcr0_fc56_pmc56_test \ mmcr1_comb_test mmcr2_l2l3_test mmcr2_fcs_fch_test \ mmcr3_src_test mmcra_thresh_marked_sample_test mmcra_thresh_cmp_test \ - mmcra_bhrb_ind_call_test mmcra_bhrb_any_test mmcra_bhrb_cond_test + mmcra_bhrb_ind_call_test mmcra_bhrb_any_test mmcra_bhrb_cond_test \ + mmcra_bhrb_disable_test top_srcdir = ../../../../../.. include ../../../lib.mk
tools/testing/selftests/powerpc/pmu/sampling_tests/misc.h +1 -1
@@ -188,7 +188,7 @@ static inline int get_mmcra_sm(u64 mmcra, int pmc)return ((mmcra >>42 ) &0x3 ); } -static inline int get_mmcra_bhrb_disable (u64 mmcra,int pmc) +static inline u64 get_mmcra_bhrb_disable (u64 mmcra,int pmc) {if (pvr ==POWER10 )return mmcra &BHRB_DISABLE ;
tools/testing/selftests/powerpc/pmu/sampling_tests/mmcra_bhrb_disable_test.c new file +66 -0
66 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH v3 9/35 selftest/powerpc/pmu: Refactor the platform check and add macros to find array size/PVR
In reply to Athira RajeevThe platform check for selftest support "check_pvr_for_sampling_tests" is specific to sampling tests which includes PVR check, presence of PMU and extended regs support. Extended regs support is needed for sampling tests which tests whether PMU registers are programmed correctly. There could be other sampling tests which may not need extended regs, example, bhrb filter tests which only needs validity check via event open.
Hence refactor the platform check to have a common function "platform_check_for_tests" that checks only for PVR check and presence of PMU. The existing function "check_pvr_for_sampling_tests" will invoke the common function and also will include checks for extended regs specific for sampling. The common function can also be used by tests other than sampling like event code tests.
Add macro to find array size ("ARRAY_SIZE") to sampling tests "misc.h" file. This can be used in next tests to find event array size. Also update "include/reg.h" to add macros to find minor and major version from PVR which will be used in testcases.
--- tools/testing/selftests/powerpc/include/reg.h | 4 ++++ .../powerpc/pmu/sampling_tests/misc.c | 20 +++++++++++++++---- .../powerpc/pmu/sampling_tests/misc.h | 3 +++ 3 files changed, 23 insertions(+), 4 deletions(-)
tools/testing/selftests/powerpc/include/reg.h +4 -0
@@ -55,6 +55,10 @@#define PVR_VER (pvr) (((pvr) >> 16) & 0xFFFF)#define SPRN_PVR 0x11F +#define PVR_CFG (pvr) (((pvr) >> 8) & 0xF)/* Configuration field */ +#define PVR_MAJ (pvr) (((pvr) >> 4) & 0xF)/* Major revision field */ +#define PVR_MIN (pvr) (((pvr) >> 0) & 0xF)/* Minor revision field */ +#define SPRN_DSCR_PRIV 0x11/* Privilege State DSCR */ #define SPRN_DSCR 0x03/* Data Stream Control Register */ #define SPRN_PPR 896/* Program Priority Register */
tools/testing/selftests/powerpc/pmu/sampling_tests/misc.c +16 -4
@@ -121,12 +121,10 @@ int check_extended_regs_support(void)return -1 ; } -int check_pvr_for_sampling_tests (void ) +int platform_check_for_tests (void ) { pvr =PVR_VER (mfspr (SPRN_PVR )); - platform_extended_mask =perf_get_platform_reg_mask (); -/* * Check for supported platforms * for sampling test
@@ -138,19 +136,33 @@ int check_pvr_for_sampling_tests(void)* Check PMU driver registered by looking for * PPC_FEATURE2_EBB bit in AT_HWCAP2 */ -if (!have_hwcap2 (PPC_FEATURE2_EBB )) +if (!have_hwcap2 (PPC_FEATURE2_EBB ) || !have_hwcap2 (PPC_FEATURE2_ARCH_3_00 )) goto out; +return 0 ; + +out: +printf ("%s: Tests un-supported for this platform\n" , __func__); +return -1 ; +} + +int check_pvr_for_sampling_tests (void ) +{ +SKIP_IF (platform_check_for_tests ()); + + platform_extended_mask =perf_get_platform_reg_mask ();/* check if platform supports extended regs */ if (check_extended_regs_support ()) goto out;init_ev_encodes ();return 0 ; + out:printf ("%s: Sampling tests un-supported\n" , __func__);return -1 ; } +/* * Allocate mmap buffer of "mmap_pages" number of * pages.
tools/testing/selftests/powerpc/pmu/sampling_tests/misc.h +3 -0
@@ -18,6 +18,8 @@#define MMCR1_RSQ 0x200000000000ULL/* radix scope qual field */ #define BHRB_DISABLE 0x2000000000ULL/* MMCRA BHRB DISABLE bit */ +#define ARRAY_SIZE (x) (sizeof(x) / sizeof((x)[0])) +extern int ev_mask_pmcxsel, ev_shift_pmcxsel;extern int ev_mask_marked, ev_shift_marked;extern int ev_mask_comb, ev_shift_comb;
@@ -36,6 +38,7 @@ extern int ev_mask_mmcr3_src, ev_shift_mmcr3_src;extern int pvr;extern u64 platform_extended_mask;extern int check_pvr_for_sampling_tests (void ); +extern int platform_check_for_tests (void );/* * Event code field extraction macro.
Signature · 1 line
2.35.1
PATCH v3 10/35 selftest/powerpc/pmu: Add selftest to check branch stack enablement will not crash on any platforms
In reply to Athira RajeevWhile enabling branch stack for an event, BHRB (Branch History Rolling Buffer) filter is set using bhrb_filter_map() callback. This callback is not defined for cases like generic_compat_pmu or in case where there is no PMU registered. A fix was added in kernel to address a crash issue observed while enabling branch stack for environments which doesn't have this callback. commit b460b512417a ("powerpc/perf: Fix crashes with generic_compat_pmu & BHRB").
Add perf sampling test to exercise this code path and make sure enabling branch stack shouldn't crash in any platform. Testcase uses software event cycles since software event is available and can be used even in cases without PMU.
--- .../powerpc/pmu/sampling_tests/Makefile | 2 +- .../bhrb_no_crash_wo_pmu_test.c | 59 +++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/powerpc/pmu/sampling_tests/bhrb_no_crash_wo_pmu_test.c
tools/testing/selftests/powerpc/pmu/sampling_tests/Makefile +1 -1
@@ -6,7 +6,7 @@ TEST_GEN_PROGS := mmcr0_exceptionbits_test mmcr0_cc56run_test mmcr0_pmccext_test mmcr1_comb_test mmcr2_l2l3_test mmcr2_fcs_fch_test \ mmcr3_src_test mmcra_thresh_marked_sample_test mmcra_thresh_cmp_test \ mmcra_bhrb_ind_call_test mmcra_bhrb_any_test mmcra_bhrb_cond_test \ - mmcra_bhrb_disable_test + mmcra_bhrb_disable_test bhrb_no_crash_wo_pmu_test top_srcdir = ../../../../../.. include ../../../lib.mk
tools/testing/selftests/powerpc/pmu/sampling_tests/bhrb_no_crash_wo_pmu_test.c new file +59 -0
59 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH v3 11/35 selftest/powerpc/pmu: Add selftest to check PERF_SAMPLE_REGS_INTR option will not crash on any platforms
In reply to Athira RajeevWith sampling, --intr-regs option is used for capturing interrupt regs. When --intr-regs option is used, PMU code uses is_sier_available() function which uses PMU flags in the code. In environment where platform specific PMU is not registered, PMU flags is not defined. A fix was added in kernel to address crash while accessing is_sier_available() function when pmu is not set. commit f75e7d73bdf7 ("powerpc/perf:
Fix crash with is_sier_available when pmu is not set").
Add perf sampling test to exercise this code and make sure enabling intr_regs shouldn't crash in any platform. Testcase uses software event cycles since software event will work even in cases without PMU.
--- .../powerpc/pmu/sampling_tests/Makefile | 2 +- .../intr_regs_no_crash_wo_pmu_test.c | 57 +++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/powerpc/pmu/sampling_tests/intr_regs_no_crash_wo_pmu_test.c
tools/testing/selftests/powerpc/pmu/sampling_tests/Makefile +1 -1
@@ -6,7 +6,7 @@ TEST_GEN_PROGS := mmcr0_exceptionbits_test mmcr0_cc56run_test mmcr0_pmccext_test mmcr1_comb_test mmcr2_l2l3_test mmcr2_fcs_fch_test \ mmcr3_src_test mmcra_thresh_marked_sample_test mmcra_thresh_cmp_test \ mmcra_bhrb_ind_call_test mmcra_bhrb_any_test mmcra_bhrb_cond_test \ - mmcra_bhrb_disable_test bhrb_no_crash_wo_pmu_test + mmcra_bhrb_disable_test bhrb_no_crash_wo_pmu_test intr_regs_no_crash_wo_pmu_test top_srcdir = ../../../../../.. include ../../../lib.mk
tools/testing/selftests/powerpc/pmu/sampling_tests/intr_regs_no_crash_wo_pmu_test.c new file +57 -0
57 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH v3 12/35 selftest/powerpc/pmu: Add selftest for checking valid and invalid bhrb filter maps
In reply to Athira RajeevFor PERF_SAMPLE_BRANCH_STACK sample type, different branch_sample_type, ie branch filters are supported. All the branch filters are not supported in powerpc. Example, power10 platform supports any, ind_call and cond branch filters. Whereas, it is different in power9. Testcase checks event open for invalid and valid branch sample types. The branch types for testcase are picked from "perf_branch_sample_type" in perf_event.h
--- .../powerpc/pmu/sampling_tests/Makefile | 3 +- .../pmu/sampling_tests/bhrb_filter_map_test.c | 105 ++++++++++++++++++ 2 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/powerpc/pmu/sampling_tests/bhrb_filter_map_test.c
tools/testing/selftests/powerpc/pmu/sampling_tests/Makefile +2 -1
@@ -6,7 +6,8 @@ TEST_GEN_PROGS := mmcr0_exceptionbits_test mmcr0_cc56run_test mmcr0_pmccext_test mmcr1_comb_test mmcr2_l2l3_test mmcr2_fcs_fch_test \ mmcr3_src_test mmcra_thresh_marked_sample_test mmcra_thresh_cmp_test \ mmcra_bhrb_ind_call_test mmcra_bhrb_any_test mmcra_bhrb_cond_test \ - mmcra_bhrb_disable_test bhrb_no_crash_wo_pmu_test intr_regs_no_crash_wo_pmu_test + mmcra_bhrb_disable_test bhrb_no_crash_wo_pmu_test intr_regs_no_crash_wo_pmu_test \ + bhrb_filter_map_test top_srcdir = ../../../../../.. include ../../../lib.mk
tools/testing/selftests/powerpc/pmu/sampling_tests/bhrb_filter_map_test.c new file +105 -0
105 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH v3 13/35 selftest/powerpc/pmu: Add selftest for mmcr1 pmcxsel/unit/cache fields
In reply to Athira RajeevThe testcase uses event code "0x21c040" to verify the settings for different fields in Monitor Mode Control Register 1 (MMCR1). The fields include PMCxSEL, PMCXCOMB PMCxUNIT, cache. Checks if these fields are translated correctly via perf interface to MMCR1
--- .../powerpc/pmu/sampling_tests/Makefile | 2 +- .../mmcr1_sel_unit_cache_test.c | 77 +++++++++++++++++++ 2 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/powerpc/pmu/sampling_tests/mmcr1_sel_unit_cache_test.c
tools/testing/selftests/powerpc/pmu/sampling_tests/Makefile +1 -1
@@ -7,7 +7,7 @@ TEST_GEN_PROGS := mmcr0_exceptionbits_test mmcr0_cc56run_test mmcr0_pmccext_test mmcr3_src_test mmcra_thresh_marked_sample_test mmcra_thresh_cmp_test \ mmcra_bhrb_ind_call_test mmcra_bhrb_any_test mmcra_bhrb_cond_test \ mmcra_bhrb_disable_test bhrb_no_crash_wo_pmu_test intr_regs_no_crash_wo_pmu_test \ - bhrb_filter_map_test + bhrb_filter_map_test mmcr1_sel_unit_cache_test top_srcdir = ../../../../../.. include ../../../lib.mk
tools/testing/selftests/powerpc/pmu/sampling_tests/mmcr1_sel_unit_cache_test.c new file +77 -0
77 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH v3 14/35 selftest/powerpc/pmu: Add interface test for bhrb disable field for non-branch samples
In reply to Athira RajeevFrom: Kajol Jain <[email protected]>
The testcase uses "instructions" event to generate the samples and fetch Monitor Mode Control Register A (MMCRA) when overflow. Branch History Rolling Buffer(bhrb) disable bit is part of MMCRA which need to be verified by perf interface. Incase sample is not of branch type, bhrb disable bit is explicitly set to 1. Testcase checks if the bhrb disable bit is set of MMCRA register via perf interface for ISA v3.1 platform
--- .../powerpc/pmu/sampling_tests/Makefile | 2 +- .../mmcra_bhrb_disable_no_branch_test.c | 64 +++++++++++++++++++ 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/powerpc/pmu/sampling_tests/mmcra_bhrb_disable_no_branch_test.c
tools/testing/selftests/powerpc/pmu/sampling_tests/Makefile +1 -1
@@ -7,7 +7,7 @@ TEST_GEN_PROGS := mmcr0_exceptionbits_test mmcr0_cc56run_test mmcr0_pmccext_test mmcr3_src_test mmcra_thresh_marked_sample_test mmcra_thresh_cmp_test \ mmcra_bhrb_ind_call_test mmcra_bhrb_any_test mmcra_bhrb_cond_test \ mmcra_bhrb_disable_test bhrb_no_crash_wo_pmu_test intr_regs_no_crash_wo_pmu_test \ - bhrb_filter_map_test mmcr1_sel_unit_cache_test + bhrb_filter_map_test mmcr1_sel_unit_cache_test mmcra_bhrb_disable_no_branch_test top_srcdir = ../../../../../.. include ../../../lib.mk
tools/testing/selftests/powerpc/pmu/sampling_tests/mmcra_bhrb_disable_no_branch_test.c new file +64 -0
64 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH v3 15/35 selftest/powerpc/pmu: Add support for perf event code tests
In reply to Athira RajeevAdd new folder for enabling perf event code tests which includes checking for group constraints, valid/invalid events, also checks for event excludes, alternatives so on. A new folder "event_code_tests", is created under "selftests/powerpc/pmu".
Also updates the corresponding Makefiles in "selftests/powerpc" and "event_code_tests" folder.
--- tools/testing/selftests/powerpc/pmu/Makefile | 11 +++++++++-- .../selftests/powerpc/pmu/event_code_tests/Makefile | 9 +++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/Makefile
tools/testing/selftests/powerpc/pmu/Makefile +9 -2
@@ -8,7 +8,7 @@ EXTRA_SOURCES := ../harness.c event.c lib.c ../utils.c top_srcdir = ../../../../.. include ../../lib.mk -all: $(TEST_GEN_PROGS) ebb sampling_tests +all: $(TEST_GEN_PROGS) ebb sampling_tests event_code_tests $(TEST_GEN_PROGS): $(EXTRA_SOURCES)
@@ -27,6 +27,7 @@ override define RUN_TESTS $(DEFAULT_RUN_TESTS) TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests TARGET=sampling_tests; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests + TARGET=event_code_tests; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests endef DEFAULT_EMIT_TESTS := $(EMIT_TESTS)
@@ -34,6 +35,7 @@ override define EMIT_TESTS $(DEFAULT_EMIT_TESTS) TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET emit_tests TARGET=sampling_tests; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET emit_tests + TARGET=event_code_tests; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET emit_tests endef DEFAULT_INSTALL_RULE := $(INSTALL_RULE)
@@ -41,12 +43,14 @@ override define INSTALL_RULE $(DEFAULT_INSTALL_RULE) TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET install TARGET=sampling_tests; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET install + TARGET=event_code_tests; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET install endef clean: $(RM) $(TEST_GEN_PROGS) $(OUTPUT)/loop.o TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean TARGET=sampling_tests; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean + TARGET=event_code_tests; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean ebb: TARGET=$@; BUILD_TARGET=$$OUTPUT/$$TARGET; mkdir -p $$BUILD_TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -k -C $$TARGET all
@@ -54,4 +58,7 @@ ebb: sampling_tests: TARGET=$@; BUILD_TARGET=$$OUTPUT/$$TARGET; mkdir -p $$BUILD_TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -k -C $$TARGET all -.PHONY: all run_tests clean ebb sampling_tests +event_code_tests: + TARGET=$@; BUILD_TARGET=$$OUTPUT/$$TARGET; mkdir -p $$BUILD_TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -k -C $$TARGET all + +.PHONY: all run_tests clean ebb sampling_tests event_code_tests
tools/testing/selftests/powerpc/pmu/event_code_tests/Makefile new file +9 -0
@@ -0,0 +1,9 @@ +# SPDX-License-Identifier: GPL-2.0 +CFLAGS += -m64 + +TEST_GEN_PROGS := + +top_srcdir = ../../../../../.. +include ../../../lib.mk + +$(TEST_GEN_PROGS): ../../harness.c ../../utils.c ../event.c ../lib.c ../sampling_tests/misc.h ../sampling_tests/misc.c
Signature · 1 line
2.35.1
PATCH v3 16/35 selftest/powerpc/pmu: Add selftest for group constraint check for PMC5 and PMC6
In reply to Athira RajeevEvents using Performance Monitor Counter 5 (PMC5) and Performance Monitor Counter 6 (PMC6) can't have other fields in event code like cache bits, thresholding or marked bit. PMC5 and PMC6 only supports base events: ie 500fa and 600f4. Other combinations should fail. Testcase tries setting other bits in event code for 500fa and 600f4 to check this scenario.
--- .../powerpc/pmu/event_code_tests/Makefile | 2 +- .../group_constraint_pmc56_test.c | 63 +++++++++++++++++++ 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_pmc56_test.c
tools/testing/selftests/powerpc/pmu/event_code_tests/Makefile +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 CFLAGS += -m64 -TEST_GEN_PROGS := +TEST_GEN_PROGS := group_constraint_pmc56_test top_srcdir = ../../../../../.. include ../../../lib.mk
tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_pmc56_test.c new file +63 -0
63 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH v3 17/35 selftest/powerpc/pmu: Add selftest to check PMC5/6 is excluded from some constraint checks
In reply to Athira RajeevEvents using Performance Monitor Counter 5 (PMC5) and Performance Monitor Counter 6 (PMC6) should be excluded from constraint check when scheduled along with group of events. Example, combination of PMC5, PMC6, and an event with cache bit will succeed to schedule though first two events doesn't have cache bit set. Testcase use three events, ie, 600f4(cycles), 500fa(instructions), 22C040 with cache bit (dc_ic) set to test this constraint check.
--- .../powerpc/pmu/event_code_tests/Makefile | 2 +- .../group_pmc56_exclude_constraints_test.c | 64 +++++++++++++++++++ 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/group_pmc56_exclude_constraints_test.c
tools/testing/selftests/powerpc/pmu/event_code_tests/Makefile +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 CFLAGS += -m64 -TEST_GEN_PROGS := group_constraint_pmc56_test +TEST_GEN_PROGS := group_constraint_pmc56_test group_pmc56_exclude_constraints_test top_srcdir = ../../../../../.. include ../../../lib.mk
tools/testing/selftests/powerpc/pmu/event_code_tests/group_pmc56_exclude_constraints_test.c new file +64 -0
64 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH v3 18/35 selftest/powerpc/pmu: Add selftest to check constraint for number of counters in use.
In reply to Athira RajeevTestcase for group constraint check for number of counters in use. The number of programmable counters is from PMC1 to PMC4. Testcase uses four events with PMC1 to PMC4 and 5th event without any PMC which is expected to fail since it is exceeding the number of counters in use.
--- .../powerpc/pmu/event_code_tests/Makefile | 2 +- .../group_constraint_pmc_count_test.c | 70 +++++++++++++++++++ 2 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_pmc_count_test.c
tools/testing/selftests/powerpc/pmu/event_code_tests/Makefile +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 CFLAGS += -m64 -TEST_GEN_PROGS := group_constraint_pmc56_test group_pmc56_exclude_constraints_test +TEST_GEN_PROGS := group_constraint_pmc56_test group_pmc56_exclude_constraints_test group_constraint_pmc_count_test top_srcdir = ../../../../../.. include ../../../lib.mk
tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_pmc_count_test.c new file +70 -0
70 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH v3 19/35 selftest/powerpc/pmu: Add selftest for group constraint check when using same PMC
In reply to Athira RajeevTestcase for group constraint check when using events with same PMC. Multiple events in a group asking for same PMC should fail. Testcase uses "0x22C040" on PMC2 as leader and also subling which is expected to fail. Using PMC1 for sibling event should pass the test.
--- .../powerpc/pmu/event_code_tests/Makefile | 3 +- .../group_constraint_repeat_test.c | 56 +++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_repeat_test.c
tools/testing/selftests/powerpc/pmu/event_code_tests/Makefile +2 -1
@@ -1,7 +1,8 @@ # SPDX-License-Identifier: GPL-2.0 CFLAGS += -m64 -TEST_GEN_PROGS := group_constraint_pmc56_test group_pmc56_exclude_constraints_test group_constraint_pmc_count_test +TEST_GEN_PROGS := group_constraint_pmc56_test group_pmc56_exclude_constraints_test group_constraint_pmc_count_test \ + group_constraint_repeat_test top_srcdir = ../../../../../.. include ../../../lib.mk
tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_repeat_test.c new file +56 -0
56 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH v3 20/35 selftest/powerpc/pmu: Add selftest for group constraint check for radix_scope_qual field
In reply to Athira RajeevTestcase for group constraint check for radix_scope_qual field which is used to program Monitor Mode Control Register (MMCR1) bit 18. All events in the group should match radix_scope_qual bit, otherwise event_open for the group should fail. Testcase uses "0x14242" (PM_DATA_RADIX_PROCESS_L2_PTE_FROM_L2) with radix_scope_qual bit set for power10.
--- .../powerpc/pmu/event_code_tests/Makefile | 2 +- .../group_constraint_radix_scope_qual_test.c | 56 +++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_radix_scope_qual_test.c
tools/testing/selftests/powerpc/pmu/event_code_tests/Makefile +1 -1
@@ -2,7 +2,7 @@ CFLAGS += -m64 TEST_GEN_PROGS := group_constraint_pmc56_test group_pmc56_exclude_constraints_test group_constraint_pmc_count_test \ - group_constraint_repeat_test + group_constraint_repeat_test group_constraint_radix_scope_qual_test top_srcdir = ../../../../../.. include ../../../lib.mk
tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_radix_scope_qual_test.c new file +56 -0
56 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH v3 21/35 selftest/powerpc/pmu: Add selftest for group constraint for MMCRA Sampling Mode field
In reply to Athira RajeevTestcase for reserved bits in Monitor Mode Control Register A (MMCRA) Random Sampling Mode (SM) value. As per Instruction Set Architecture (ISA), the values 0x5, 0x9, 0xD, 0x19, 0x1D, 0x1A, 0x1E are reserved for sampling mode field. Test that having these reserved bit values should cause event_open to fail. Input event code in testcases uses these sampling bits along with 401e0 (PM_MRK_INST_CMPL).
--- .../powerpc/pmu/event_code_tests/Makefile | 2 +- ...eserved_bits_mmcra_sample_elig_mode_test.c | 77 +++++++++++++++++++ 2 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/reserved_bits_mmcra_sample_elig_mode_test.c
tools/testing/selftests/powerpc/pmu/event_code_tests/Makefile +1 -1
@@ -2,7 +2,7 @@ CFLAGS += -m64 TEST_GEN_PROGS := group_constraint_pmc56_test group_pmc56_exclude_constraints_test group_constraint_pmc_count_test \ - group_constraint_repeat_test group_constraint_radix_scope_qual_test + group_constraint_repeat_test group_constraint_radix_scope_qual_test reserved_bits_mmcra_sample_elig_mode_test top_srcdir = ../../../../../.. include ../../../lib.mk
tools/testing/selftests/powerpc/pmu/event_code_tests/reserved_bits_mmcra_sample_elig_mode_test.c new file +77 -0
77 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH v3 22/35 selftest/powerpc/pmu: Add selftest for group constraint check MMCRA sample bits
In reply to Athira RajeevEvents with different "sample" field values which is used to program Monitor Mode Control Register A (MMCRA) in a group will fail to schedule. Testcase uses event with load only sampling mode as group leader and event with store only sampling as sibling event. So that it can check that using different sample bits in event code will fail in event open for group of events
--- .../powerpc/pmu/event_code_tests/Makefile | 3 +- .../group_constraint_mmcra_sample_test.c | 54 +++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_mmcra_sample_test.c
tools/testing/selftests/powerpc/pmu/event_code_tests/Makefile +2 -1
@@ -2,7 +2,8 @@ CFLAGS += -m64 TEST_GEN_PROGS := group_constraint_pmc56_test group_pmc56_exclude_constraints_test group_constraint_pmc_count_test \ - group_constraint_repeat_test group_constraint_radix_scope_qual_test reserved_bits_mmcra_sample_elig_mode_test + group_constraint_repeat_test group_constraint_radix_scope_qual_test reserved_bits_mmcra_sample_elig_mode_test \ + group_constraint_mmcra_sample_test top_srcdir = ../../../../../.. include ../../../lib.mk
tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_mmcra_sample_test.c new file +54 -0
54 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH v3 23/35 selftest/powerpc/pmu: Add selftest for checking invalid bits in event code
In reply to Athira RajeevSome of the bits in the event code is reserved
for specific platforms. Event code bits 52-59 are reserved in power9, whereas in power10, these are used for programming Monitor Mode Control Register 3 (MMCR3). Bit 9 in event code is reserved in power9, whereas it is used for programming "radix_scope_qual" bit 18 in Monitor Mode Control Register 1 (MMCR1).
Testcase to ensure that using reserved bits in
event code should cause event_open to fail.
--- .../powerpc/pmu/event_code_tests/Makefile | 2 +- .../invalid_event_code_test.c | 67 +++++++++++++++++++ 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/invalid_event_code_test.c
tools/testing/selftests/powerpc/pmu/event_code_tests/Makefile +1 -1
@@ -3,7 +3,7 @@ CFLAGS += -m64 TEST_GEN_PROGS := group_constraint_pmc56_test group_pmc56_exclude_constraints_test group_constraint_pmc_count_test \ group_constraint_repeat_test group_constraint_radix_scope_qual_test reserved_bits_mmcra_sample_elig_mode_test \ - group_constraint_mmcra_sample_test + group_constraint_mmcra_sample_test invalid_event_code_test top_srcdir = ../../../../../.. include ../../../lib.mk
tools/testing/selftests/powerpc/pmu/event_code_tests/invalid_event_code_test.c new file +67 -0
67 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH v3 24/35 selftest/powerpc/pmu: Add selftest for reserved bit check for MMCRA thresh_ctl field
In reply to Athira RajeevTestcase for reserved bits in Monitor Mode
Control Register A (MMCRA) thresh_ctl bits.
For MMCRA[48:51]/[52:55]) Threshold Start/Stop,
0b11110000/0b00001111 is reserved.
--- .../powerpc/pmu/event_code_tests/Makefile | 2 +- .../reserved_bits_mmcra_thresh_ctl_test.c | 44 +++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/reserved_bits_mmcra_thresh_ctl_test.c
tools/testing/selftests/powerpc/pmu/event_code_tests/Makefile +1 -1
@@ -3,7 +3,7 @@ CFLAGS += -m64 TEST_GEN_PROGS := group_constraint_pmc56_test group_pmc56_exclude_constraints_test group_constraint_pmc_count_test \ group_constraint_repeat_test group_constraint_radix_scope_qual_test reserved_bits_mmcra_sample_elig_mode_test \ - group_constraint_mmcra_sample_test invalid_event_code_test + group_constraint_mmcra_sample_test invalid_event_code_test reserved_bits_mmcra_thresh_ctl_test top_srcdir = ../../../../../.. include ../../../lib.mk
tools/testing/selftests/powerpc/pmu/event_code_tests/reserved_bits_mmcra_thresh_ctl_test.c new file +44 -0
44 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH v3 25/35 selftest/powerpc/pmu: Add selftest for blacklist events check in power9
In reply to Athira RajeevSome of the events are blacklisted in power9. The list of blacklisted events are noted in power9-events-list.h When trying to do event open for any of these blacklisted event will cause a failure. Testcase ensures that using blacklisted events will cause event_open to fail in power9. This test is only applicable on power9 DD2.1 and DD2.2 and hence test adds checks to skip on other platforms.
--- .../powerpc/pmu/event_code_tests/Makefile | 3 +- .../blacklisted_events_test.c | 132 ++++++++++++++++++ 2 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/blacklisted_events_test.c
tools/testing/selftests/powerpc/pmu/event_code_tests/Makefile +2 -1
@@ -3,7 +3,8 @@ CFLAGS += -m64 TEST_GEN_PROGS := group_constraint_pmc56_test group_pmc56_exclude_constraints_test group_constraint_pmc_count_test \ group_constraint_repeat_test group_constraint_radix_scope_qual_test reserved_bits_mmcra_sample_elig_mode_test \ - group_constraint_mmcra_sample_test invalid_event_code_test reserved_bits_mmcra_thresh_ctl_test + group_constraint_mmcra_sample_test invalid_event_code_test reserved_bits_mmcra_thresh_ctl_test \ + blacklisted_events_test top_srcdir = ../../../../../.. include ../../../lib.mk
tools/testing/selftests/powerpc/pmu/event_code_tests/blacklisted_events_test.c new file +132 -0
132 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH v3 26/35 selftest/powerpc/pmu: Add selftest for event alternatives for power9
In reply to Athira RajeevPlatform specific PMU supports alternative event for some of the event codes. During perf_event_open, it any event group doesn't match constraint check criteria, further lookup is done to find alternative event. Code checks to see if it is possible to schedule event as group using alternative events.
Testcase exercises the alternative event find code for power9. Example, since events in same PMC can't go in as a group, ideally using PM_RUN_CYC_ALT (0x200f4) and PM_BR_TAKEN_CMPL (0x200fa) will fail. But since RUN_CYC (0x600f4) is alternative event for 0x200f4, it is possible to use 0x600f4 and 0x200fa as group. Testcase uses such combination for all events in power9 which has an alternative event.
--- .../powerpc/pmu/event_code_tests/Makefile | 2 +- .../event_alternatives_tests_p9.c | 116 ++++++++++++++++++ 2 files changed, 117 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/event_alternatives_tests_p9.c
tools/testing/selftests/powerpc/pmu/event_code_tests/Makefile +1 -1
@@ -4,7 +4,7 @@ CFLAGS += -m64 TEST_GEN_PROGS := group_constraint_pmc56_test group_pmc56_exclude_constraints_test group_constraint_pmc_count_test \ group_constraint_repeat_test group_constraint_radix_scope_qual_test reserved_bits_mmcra_sample_elig_mode_test \ group_constraint_mmcra_sample_test invalid_event_code_test reserved_bits_mmcra_thresh_ctl_test \ - blacklisted_events_test + blacklisted_events_test event_alternatives_tests_p9 top_srcdir = ../../../../../.. include ../../../lib.mk
tools/testing/selftests/powerpc/pmu/event_code_tests/event_alternatives_tests_p9.c new file +116 -0
116 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH v3 27/35 selftest/powerpc/pmu: Add selftest for event alternatives for power10
In reply to Athira RajeevPlatform specific PMU supports alternative event for some of the event codes. During perf_event_open, it any event group doesn't match constraint check criteria, further lookup is done to find alternative event. Code checks to see if it is possible to schedule event as group using alternative events.
Testcase exercises the alternative event find code for power10. Example, Using PMC1 to PMC4 in a group and again trying to schedule PM_CYC_ALT (0x0001e) will fail since this exceeds number of programmable events in group. But since 0x600f4 is an alternative event for 0x0001e, it is possible to use 0x0001e in the group. Testcase uses such combination all events in power10 which has alternative event.
--- .../powerpc/pmu/event_code_tests/Makefile | 2 +- .../event_alternatives_tests_p10.c | 109 ++++++++++++++++++ 2 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/event_alternatives_tests_p10.c
tools/testing/selftests/powerpc/pmu/event_code_tests/Makefile +1 -1
@@ -4,7 +4,7 @@ CFLAGS += -m64 TEST_GEN_PROGS := group_constraint_pmc56_test group_pmc56_exclude_constraints_test group_constraint_pmc_count_test \ group_constraint_repeat_test group_constraint_radix_scope_qual_test reserved_bits_mmcra_sample_elig_mode_test \ group_constraint_mmcra_sample_test invalid_event_code_test reserved_bits_mmcra_thresh_ctl_test \ - blacklisted_events_test event_alternatives_tests_p9 + blacklisted_events_test event_alternatives_tests_p9 event_alternatives_tests_p10 top_srcdir = ../../../../../.. include ../../../lib.mk
tools/testing/selftests/powerpc/pmu/event_code_tests/event_alternatives_tests_p10.c new file +109 -0
109 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH v3 28/35 selftest/powerpc/pmu: Add selftest for PERF_TYPE_HARDWARE events valid check
In reply to Athira RajeevTestcase to ensure that using invalid event in generic event for PERF_TYPE_HARDWARE will fail. Invalid generic events in power10 are:
- PERF_COUNT_HW_BUS_CYCLES
- PERF_COUNT_HW_STALLED_CYCLES_FRONTEND
- PERF_COUNT_HW_STALLED_CYCLES_BACKEND
- PERF_COUNT_HW_REF_CPU_CYCLES
Invalid generic events in power9 are:
- PERF_COUNT_HW_BUS_CYCLES
- PERF_COUNT_HW_REF_CPU_CYCLES
Testcase does event open for valid and invalid generic events to ensure event open works for all valid events and fails for invalid events.
--- .../powerpc/pmu/event_code_tests/Makefile | 2 +- .../generic_events_valid_test.c | 130 ++++++++++++++++++ 2 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/generic_events_valid_test.c
tools/testing/selftests/powerpc/pmu/event_code_tests/Makefile +1 -1
@@ -4,7 +4,7 @@ CFLAGS += -m64 TEST_GEN_PROGS := group_constraint_pmc56_test group_pmc56_exclude_constraints_test group_constraint_pmc_count_test \ group_constraint_repeat_test group_constraint_radix_scope_qual_test reserved_bits_mmcra_sample_elig_mode_test \ group_constraint_mmcra_sample_test invalid_event_code_test reserved_bits_mmcra_thresh_ctl_test \ - blacklisted_events_test event_alternatives_tests_p9 event_alternatives_tests_p10 + blacklisted_events_test event_alternatives_tests_p9 event_alternatives_tests_p10 generic_events_valid_test top_srcdir = ../../../../../.. include ../../../lib.mk
tools/testing/selftests/powerpc/pmu/event_code_tests/generic_events_valid_test.c new file +130 -0
130 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH v3 29/35 selftest/powerpc/pmu: Add selftest for group constraint check for MMCR0 l2l3_sel bits
In reply to Athira RajeevFrom: Kajol Jain <[email protected]>
In power10, L2L3 select bits in the event code is used to program l2l3_sel field in Monitor Mode Control Register 0 (MMCR0: 56-60). When scheduling events as a group, all events in that group should match value in these bits. Otherwise event open for the sibling events will fail.
Testcase uses event code "0x010000046080" as leader and another events "0x26880" and "0x010000026880" as sibling events, and checks for l2l3_sel constraints via perf interface for ISA v3.1 platform.
--- .../powerpc/pmu/event_code_tests/Makefile | 3 +- .../group_constraint_l2l3_sel_test.c | 64 +++++++++++++++++++ 2 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_l2l3_sel_test.c
tools/testing/selftests/powerpc/pmu/event_code_tests/Makefile +2 -1
@@ -4,7 +4,8 @@ CFLAGS += -m64 TEST_GEN_PROGS := group_constraint_pmc56_test group_pmc56_exclude_constraints_test group_constraint_pmc_count_test \ group_constraint_repeat_test group_constraint_radix_scope_qual_test reserved_bits_mmcra_sample_elig_mode_test \ group_constraint_mmcra_sample_test invalid_event_code_test reserved_bits_mmcra_thresh_ctl_test \ - blacklisted_events_test event_alternatives_tests_p9 event_alternatives_tests_p10 generic_events_valid_test + blacklisted_events_test event_alternatives_tests_p9 event_alternatives_tests_p10 generic_events_valid_test \ + group_constraint_l2l3_sel_test top_srcdir = ../../../../../.. include ../../../lib.mk
tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_l2l3_sel_test.c new file +64 -0
64 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH v3 30/35 selftest/powerpc/pmu: Add selftest for group constraint check for MMCR1 cache bits
In reply to Athira RajeevFrom: Kajol Jain <[email protected]>
Data and instruction cache qualifier bits in the event code is used to program cache select field in Monitor Mode Control Register 1 (MMCR1: 16-17). When scheduling events as a group, all events in that group should match value in these bits. Otherwise event open for the sibling events will fail.
Testcase uses event code "0x1100fc" as leader and other events like "0x23e054" and "0x13e054" as sibling events to checks for l1 cache select field constraints via perf interface.
--- .../powerpc/pmu/event_code_tests/Makefile | 2 +- .../group_constraint_cache_test.c | 60 +++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_cache_test.c
tools/testing/selftests/powerpc/pmu/event_code_tests/Makefile +1 -1
@@ -5,7 +5,7 @@ TEST_GEN_PROGS := group_constraint_pmc56_test group_pmc56_exclude_constraints_te group_constraint_repeat_test group_constraint_radix_scope_qual_test reserved_bits_mmcra_sample_elig_mode_test \ group_constraint_mmcra_sample_test invalid_event_code_test reserved_bits_mmcra_thresh_ctl_test \ blacklisted_events_test event_alternatives_tests_p9 event_alternatives_tests_p10 generic_events_valid_test \ - group_constraint_l2l3_sel_test + group_constraint_l2l3_sel_test group_constraint_cache_test top_srcdir = ../../../../../.. include ../../../lib.mk
tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_cache_test.c new file +60 -0
60 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH v3 31/35 selftest/powerpc/pmu: Add selftest for group constraint check for MMCRA thresh_cmp field
In reply to Athira RajeevFrom: Kajol Jain <[email protected]>
Thresh compare bits for a event is used to program thresh compare field in Monitor Mode Control Register A (MMCRA: 9-18 bits for power9 and MMCRA: 8-18 bits for power10). When scheduling events as a group, all events in that group should match value in thresh compare bits. Otherwise event open for the sibling events will fail.
Testcase uses event code "0x401e0" as leader and another event "0x101ec" as sibling event, and checks for thresh compare constraint via perf interface.
--- .../powerpc/pmu/event_code_tests/Makefile | 2 +- .../group_constraint_thresh_cmp_test.c | 96 +++++++++++++++++++ 2 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_thresh_cmp_test.c
tools/testing/selftests/powerpc/pmu/event_code_tests/Makefile +1 -1
@@ -5,7 +5,7 @@ TEST_GEN_PROGS := group_constraint_pmc56_test group_pmc56_exclude_constraints_te group_constraint_repeat_test group_constraint_radix_scope_qual_test reserved_bits_mmcra_sample_elig_mode_test \ group_constraint_mmcra_sample_test invalid_event_code_test reserved_bits_mmcra_thresh_ctl_test \ blacklisted_events_test event_alternatives_tests_p9 event_alternatives_tests_p10 generic_events_valid_test \ - group_constraint_l2l3_sel_test group_constraint_cache_test + group_constraint_l2l3_sel_test group_constraint_cache_test group_constraint_thresh_cmp_test top_srcdir = ../../../../../.. include ../../../lib.mk
tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_thresh_cmp_test.c new file +96 -0
96 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH v3 32/35 selftest/powerpc/pmu: Add selftest for group constraint for unit and pmc field in p9
In reply to Athira RajeevFrom: Kajol Jain <[email protected]>
Unit and pmu bits in the event code is used to program unit and pmc fields in Monitor Mode Control Register 1 (MMCR1). For power9 platform, incase unit field value is within 6 to 9, one of the event in the group should use PMC4. Otherwise event_open should fail for that group.
--- .../powerpc/pmu/event_code_tests/Makefile | 3 +- .../group_constraint_unit_test.c | 74 +++++++++++++++++++ 2 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_unit_test.c
tools/testing/selftests/powerpc/pmu/event_code_tests/Makefile +2 -1
@@ -5,7 +5,8 @@ TEST_GEN_PROGS := group_constraint_pmc56_test group_pmc56_exclude_constraints_te group_constraint_repeat_test group_constraint_radix_scope_qual_test reserved_bits_mmcra_sample_elig_mode_test \ group_constraint_mmcra_sample_test invalid_event_code_test reserved_bits_mmcra_thresh_ctl_test \ blacklisted_events_test event_alternatives_tests_p9 event_alternatives_tests_p10 generic_events_valid_test \ - group_constraint_l2l3_sel_test group_constraint_cache_test group_constraint_thresh_cmp_test + group_constraint_l2l3_sel_test group_constraint_cache_test group_constraint_thresh_cmp_test \ + group_constraint_unit_test top_srcdir = ../../../../../.. include ../../../lib.mk
tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_unit_test.c new file +74 -0
74 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH v3 33/35 selftest/powerpc/pmu: Add selftest for group constraint check for MMCRA thresh_ctl field
In reply to Athira RajeevFrom: Kajol Jain <[email protected]>
Thresh control bits in the event code is used to program thresh_ctl field in Monitor Mode Control Register A (MMCRA: 48-55). When scheduling events as a group, all events in that group should match value in these bits. Otherwise event open for the sibling events will fail.
Testcase uses event code PM_MRK_INST_CMPL (0x401e0) as leader and another event PM_THRESH_MET (101ec) as sibling event, and checks if group constraint checks for thresh_ctl field added correctly via perf interface.
--- .../powerpc/pmu/event_code_tests/Makefile | 2 +- .../group_constraint_thresh_ctl_test.c | 64 +++++++++++++++++++ 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_thresh_ctl_test.c
tools/testing/selftests/powerpc/pmu/event_code_tests/Makefile +1 -1
@@ -6,7 +6,7 @@ TEST_GEN_PROGS := group_constraint_pmc56_test group_pmc56_exclude_constraints_te group_constraint_mmcra_sample_test invalid_event_code_test reserved_bits_mmcra_thresh_ctl_test \ blacklisted_events_test event_alternatives_tests_p9 event_alternatives_tests_p10 generic_events_valid_test \ group_constraint_l2l3_sel_test group_constraint_cache_test group_constraint_thresh_cmp_test \ - group_constraint_unit_test + group_constraint_unit_test group_constraint_thresh_ctl_test top_srcdir = ../../../../../.. include ../../../lib.mk
tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_thresh_ctl_test.c new file +64 -0
64 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH v3 34/35 selftest/powerpc/pmu: Add selftest for group constraint check for MMCRA thresh_sel field
In reply to Athira RajeevFrom: Kajol Jain <[email protected]>
Thresh select bits in the event code is used to program thresh_sel field in Monitor Mode Control Register A (MMCRA: 45-47). When scheduling events as a group, all events in that group should match value in these bits. Otherwise event open for the sibling events will fail.
Testcase uses event code PM_MRK_INST_CMPL (0x401e0) as leader and another event PM_THRESH_MET (0x101ec) as sibling event, and checks if group constraint checks for thresh_sel field added correctly via perf interface.
--- .../powerpc/pmu/event_code_tests/Makefile | 2 +- .../group_constraint_thresh_sel_test.c | 63 +++++++++++++++++++ 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_thresh_sel_test.c
tools/testing/selftests/powerpc/pmu/event_code_tests/Makefile +1 -1
@@ -6,7 +6,7 @@ TEST_GEN_PROGS := group_constraint_pmc56_test group_pmc56_exclude_constraints_te group_constraint_mmcra_sample_test invalid_event_code_test reserved_bits_mmcra_thresh_ctl_test \ blacklisted_events_test event_alternatives_tests_p9 event_alternatives_tests_p10 generic_events_valid_test \ group_constraint_l2l3_sel_test group_constraint_cache_test group_constraint_thresh_cmp_test \ - group_constraint_unit_test group_constraint_thresh_ctl_test + group_constraint_unit_test group_constraint_thresh_ctl_test group_constraint_thresh_sel_test top_srcdir = ../../../../../.. include ../../../lib.mk
tools/testing/selftests/powerpc/pmu/event_code_tests/group_constraint_thresh_sel_test.c new file +63 -0
63 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH v3 35/35 selftest/powerpc/pmu: Add test for hardware cache events
In reply to Athira RajeevFrom: Kajol Jain <[email protected]>
The testcase checks if the transalation of a generic hardware cache event is done properly via perf interface. The hardware cache events has type as PERF_TYPE_HW_CACHE and each event points to raw event code id.
Testcase checks different combination of cache level, cache event operation type and cache event result type and verify for a given event code, whether transalation matches with the current cache event mappings via perf interface.
--- .../powerpc/pmu/event_code_tests/Makefile | 3 +- .../hw_cache_event_type_test.c | 88 +++++++++++++++++++ 2 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/powerpc/pmu/event_code_tests/hw_cache_event_type_test.c
tools/testing/selftests/powerpc/pmu/event_code_tests/Makefile +2 -1
@@ -6,7 +6,8 @@ TEST_GEN_PROGS := group_constraint_pmc56_test group_pmc56_exclude_constraints_te group_constraint_mmcra_sample_test invalid_event_code_test reserved_bits_mmcra_thresh_ctl_test \ blacklisted_events_test event_alternatives_tests_p9 event_alternatives_tests_p10 generic_events_valid_test \ group_constraint_l2l3_sel_test group_constraint_cache_test group_constraint_thresh_cmp_test \ - group_constraint_unit_test group_constraint_thresh_ctl_test group_constraint_thresh_sel_test + group_constraint_unit_test group_constraint_thresh_ctl_test group_constraint_thresh_sel_test \ + hw_cache_event_type_test top_srcdir = ../../../../../.. include ../../../lib.mk
tools/testing/selftests/powerpc/pmu/event_code_tests/hw_cache_event_type_test.c new file +88 -0
88 lines not on this page · raw message
Signature · 1 line
2.35.1
Michael Ellerman
AppliedQuoted 14 lines · Athira Rajeev
Patch series extends the perf interface selftests to cover scenarios for event code checking, group constraints, and also thresholding/branch related interface tests in sampling area.
In this series, patches 1 to 14 adds additional tests under "powerpc/sampling_tests". These adds support for handling sample type
PERF_SAMPLE_BRANCH_STACKalong with interrupt regs. It adds utility functions and test forthresh_cmpand branch filters programmed in control register. Some of the tests needs to be skipped for "Generic Compat PMU" environment. Hence utility functions are added in "include/utils.c" and "sampling_tests/misc.h" to detect platform based on "auxv" entries.
Quoted 1 line
[...]
Applied to powerpc/next.
[01/35] selftest/powerpc/pmu: Add mask/shift bits for extracting threshold compare field
https://git.kernel.org/powerpc/c/42e0576eec75479fa7709c41e5c3b9ec556b8f4d [02/35] testing/selftests/powerpc: Add support to fetch "platform" and "base platform" from auxv to detect platform. https://git.kernel.org/powerpc/c/a069b5f980e3b65b64b6322b71d5819f90dbb42b [03/35] selftest/powerpc/pmu: Add interface test for mmcra_thresh_cmp fields https://git.kernel.org/powerpc/c/50d9c30a685c14e41e44d48a08a08703c680d861 [04/35] selftest/powerpc/pmu: Add support for branch sampling in get_intr_regs function https://git.kernel.org/powerpc/c/61d89900315aa25f6da0c1bc800ce295d74d69f1 [05/35] selftest/powerpc/pmu: Add interface test for mmcra_ifm field of indirect call type https://git.kernel.org/powerpc/c/c55dabc6d577a864cd618107ea6aaa6cad8c987b [06/35] selftest/powerpc/pmu: Add interface test for mmcra_ifm field for any branch type https://git.kernel.org/powerpc/c/faa64ddc1e398131e7eaadc8f03cb7bd3904eff2 [07/35] selftest/powerpc/pmu: Add interface test for mmcra_ifm field for conditional branch type https://git.kernel.org/powerpc/c/014fb4a3ae746276f4320f7010d03157485051cb [08/35] selftest/powerpc/pmu: Add interface test for bhrb disable field https://git.kernel.org/powerpc/c/84cc4e66d90f6624f821df381073813dd502f657 [09/35] selftest/powerpc/pmu: Refactor the platform check and add macros to find array size/PVR https://git.kernel.org/powerpc/c/9cfd110a36649f9452120a648f15f32d1c82b99d [10/35] selftest/powerpc/pmu: Add selftest to check branch stack enablement will not crash on any platforms https://git.kernel.org/powerpc/c/2ac05f8f2e4b9068e5bbc0836b35abafd70f02c1 [11/35] selftest/powerpc/pmu: Add selftest to check PERF_SAMPLE_REGS_INTR option will not crash on any platforms https://git.kernel.org/powerpc/c/11bbc524390572dfe1bd0375c7e7ab8f9ddf4b34 [12/35] selftest/powerpc/pmu: Add selftest for checking valid and invalid bhrb filter maps https://git.kernel.org/powerpc/c/f6380e05aa92b005ac6f38be92afbdd2a0706cff [13/35] selftest/powerpc/pmu: Add selftest for mmcr1 pmcxsel/unit/cache fields https://git.kernel.org/powerpc/c/0321f2d0ae6959f79f5b8a21b31694b54dbaa35d [14/35] selftest/powerpc/pmu: Add interface test for bhrb disable field for non-branch samples https://git.kernel.org/powerpc/c/78cd598af648131d2e9a32825c59b8d1e9ec9357 [15/35] selftest/powerpc/pmu: Add support for perf event code tests https://git.kernel.org/powerpc/c/0a110a4b69dacc30ce4f6c10c0396bd2fd097831 [16/35] selftest/powerpc/pmu: Add selftest for group constraint check for PMC5 and PMC6 https://git.kernel.org/powerpc/c/9258c0aa755fac469869dd647a6c3d5299ff7725 [17/35] selftest/powerpc/pmu: Add selftest to check PMC5/6 is excluded from some constraint checks https://git.kernel.org/powerpc/c/4000c2e5d40a3ee340c3940949d658fc52a56603 [18/35] selftest/powerpc/pmu: Add selftest to check constraint for number of counters in use. https://git.kernel.org/powerpc/c/827765a449dbc41ad19ab3e31757c93cac47b728 [19/35] selftest/powerpc/pmu: Add selftest for group constraint check when using same PMC https://git.kernel.org/powerpc/c/38b6da45304e55de11b8b79a0f31a4d61818e63e [20/35] selftest/powerpc/pmu: Add selftest for group constraint check for radix_scope_qual field https://git.kernel.org/powerpc/c/dc431be3b54901744e84f5f94f0f0a2b5d36bb7f [21/35] selftest/powerpc/pmu: Add selftest for group constraint for MMCRA Sampling Mode field https://git.kernel.org/powerpc/c/beebeecb47d3b93198fe46922fd4ba2af2090cdd [22/35] selftest/powerpc/pmu: Add selftest for group constraint check MMCRA sample bits https://git.kernel.org/powerpc/c/122b6b9e57006520addd9f3a44f6b7e3ce503044 [23/35] selftest/powerpc/pmu: Add selftest for checking invalid bits in event code https://git.kernel.org/powerpc/c/5196a27978dcc74251eab14cffa8fa96813e0365 [24/35] selftest/powerpc/pmu: Add selftest for reserved bit check for MMCRA thresh_ctl field https://git.kernel.org/powerpc/c/0c90263339da3e4cdcbf57cfa43d6d866c3ac95e [25/35] selftest/powerpc/pmu: Add selftest for blacklist events check in power9 https://git.kernel.org/powerpc/c/a77c69766c7d4a213e65a4ecdedda7c22f2deb01 [26/35] selftest/powerpc/pmu: Add selftest for event alternatives for power9 https://git.kernel.org/powerpc/c/5958ad4392b0f437605ade8bab42447b0d97ad8c [27/35] selftest/powerpc/pmu: Add selftest for event alternatives for power10 https://git.kernel.org/powerpc/c/3f1a87425f8c2f9af745923865a4765e36a2ed3c [28/35] selftest/powerpc/pmu: Add selftest for PERF_TYPE_HARDWARE events valid check https://git.kernel.org/powerpc/c/8efeedf5aac77b58f68e6eb9df62758ba1882bb3 [29/35] selftest/powerpc/pmu: Add selftest for group constraint check for MMCR0 l2l3_sel bits https://git.kernel.org/powerpc/c/20b3073f8727e20332379f145b6eecf580291b2c [30/35] selftest/powerpc/pmu: Add selftest for group constraint check for MMCR1 cache bits https://git.kernel.org/powerpc/c/291c01ed207d83c8910e0fb21944e6ef84021956 [31/35] selftest/powerpc/pmu: Add selftest for group constraint check for MMCRA thresh_cmp field https://git.kernel.org/powerpc/c/8eaca8c4b4ed9a2058e4f232d56b5973191fec37 [32/35] selftest/powerpc/pmu: Add selftest for group constraint for unit and pmc field in p9 https://git.kernel.org/powerpc/c/142c9bd1ff215f364a5d683a9dd0b7c413397185 [33/35] selftest/powerpc/pmu: Add selftest for group constraint check for MMCRA thresh_ctl field https://git.kernel.org/powerpc/c/c178606ab51076d464fe537cd7a6bcbc615939e5 [34/35] selftest/powerpc/pmu: Add selftest for group constraint check for MMCRA thresh_sel field https://git.kernel.org/powerpc/c/9ac92fecd1dbfcabd64925571b94151d7a814878 [35/35] selftest/powerpc/pmu: Add test for hardware cache events https://git.kernel.org/powerpc/c/ab8bca92aebcb59d81dc95ddebe241052f2bb411
cheers