Patch series adds support for perf sampling tests that enables capturing sampling data in perf mmap buffer and further support for reading and processing the samples. It also addds basic utility functions to process the mmap buffer inorder to read total count of samples as well as the contents of sample.
With enablement of extended regs in powerpc, sample can also capture performance monitor registers (different Monitor Mode control Registers) by specifying sample type for extended regs. This information from sample is used to verify the perf interface, by comparing the event code fields with interrupt registers value. Patch series also include support for macros which does the job of extracting the event code fields and specific fields from supported Monitor Mode Control Registers. The sampling support functions and testcases are added in new folder "sampling_tests" under "selftests/powerpc/pmu" and corresponding updates are done Makefiles in "selftests/powerpc" and "sampling_tests" folder. Testcases are added for PMU registers which verifies that the perf interface programs these SPR's correctly. Patch 1 of the series add new field "mmap_buffer" to "struct event" to enable capturing of samples as part of perf event. This field is a place-holder for the mmap-buffer incase of sample collection Patch 2-4 adds support functions for enabling perf sampling test and adds couple of basic utility functions to post process the mmap buffer. It also adds macros to parse event codes. Patch 5 adds event_init_sampling function to initialise event attribute fields for sampling events. Patch 6-8 adds generic Monitor Mode Control Register(MMCR) macro to get specific field value from a specific MMCR. It also adds macros and utility functions to fetch individual fields from all MMCRx PMU registers. Patch 9-20 adds testcases to verify if fields values of MMCRx registers are set correctly from event code via perf interface Link to the linux-ci: https://github.com/athira-rajeev/linux-ci/actions?query=branch%3Asefltests Patchset contains initial set of test cases along with basic utilities to verify basic perf interface. More sampling testcases are in plan which will cover additional scenarios. Athira Rajeev (11): selftest/powerpc/pmu: Include mmap_buffer field as part of struct event selftest/powerpc/pmu: Add support for perf sampling tests selftest/powerpc/pmu: Add macro to extract mmcr0/mmcr1 fields selftest/powerpc/pmu/: Add interface test for mmcr0 exception bits selftest/powerpc/pmu/: Add interface test for mmcr0_cc56run field selftest/powerpc/pmu/: Add interface test for mmcr0_pmccext bit selftest/powerpc/pmu/: Add interface test for mmcr0_pmcjce field selftest/powerpc/pmu/: Add interface test for mmcr0_fc56 field using pmc1 selftest/powerpc/pmu/: Add interface test for mmcr0_pmc56 using pmc5 selftest/powerpc/pmu/: Add interface test for mmcr1_comb field selftest/powerpc/pmu/: Add selftest for mmcr1 pmcxsel/unit/cache fields Kajol Jain (4): selftest/powerpc/pmu: Add utility functions to post process the mmap buffer selftest/powerpc/pmu: Add macro to extract mmcr3 and mmcra fields selftest/powerpc/pmu/: Add interface test for mmcr3_src fields selftest/powerpc/pmu: Add interface test for mmcra register fields Madhavan Srinivasan (5): selftest/powerpc/pmu: Add macros to parse event codes selftest/powerpc/pmu: Add event_init_sampling function selftest/powerpc/pmu: Add macros to extract mmcr fields selftest/powerpc/pmu/: Add interface test for mmcr2_l2l3 field selftest/powerpc/pmu/: Add interface test for mmcr2_fcs_fch fields tools/testing/selftests/powerpc/pmu/Makefile | 11 +- tools/testing/selftests/powerpc/pmu/event.c | 18 +- tools/testing/selftests/powerpc/pmu/event.h | 6 + .../powerpc/pmu/sampling_tests/Makefile | 28 + .../powerpc/pmu/sampling_tests/misc.c | 507 ++++++++++++++++++ .../powerpc/pmu/sampling_tests/misc.h | 263 +++++++++ .../pmu/sampling_tests/mmcr0_cc56run_test.c | 59 ++ .../sampling_tests/mmcr0_exceptionbits_test.c | 59 ++ .../sampling_tests/mmcr0_fc56_pmc1ce_test.c | 58 ++ .../sampling_tests/mmcr0_fc56_pmc56_test.c | 58 ++ .../pmu/sampling_tests/mmcr0_pmccext_test.c | 59 ++ .../pmu/sampling_tests/mmcr0_pmcjce_test.c | 58 ++ .../pmu/sampling_tests/mmcr1_comb_test.c | 66 +++ .../mmcr1_sel_unit_cache_test.c | 70 +++ .../pmu/sampling_tests/mmcr2_fcs_fch_test.c | 67 +++ .../pmu/sampling_tests/mmcr2_l2l3_test.c | 74 +++ .../pmu/sampling_tests/mmcr3_src_test.c | 67 +++ .../mmcra_thresh_marked_sample_test.c | 80 +++ 18 files changed, 1605 insertions(+), 3 deletions(-) create mode 100644 tools/testing/selftests/powerpc/pmu/sampling_tests/Makefile create mode 100644 tools/testing/selftests/powerpc/pmu/sampling_tests/misc.c create mode 100644 tools/testing/selftests/powerpc/pmu/sampling_tests/misc.h create mode 100644 tools/testing/selftests/powerpc/pmu/sampling_tests/mmcr0_cc56run_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/sampling_tests/mmcr0_exceptionbits_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/sampling_tests/mmcr0_fc56_pmc1ce_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/sampling_tests/mmcr0_fc56_pmc56_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/sampling_tests/mmcr0_pmccext_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/sampling_tests/mmcr0_pmcjce_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/sampling_tests/mmcr1_comb_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/mmcr2_fcs_fch_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/sampling_tests/mmcr2_l2l3_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/sampling_tests/mmcr3_src_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/sampling_tests/mmcra_thresh_marked_sample_test.c -- 2.27.0