Skip to contentSkip to conversation

selftests/powerpc: Updates to EBB selftest for ISA v3.1

PATCH Applied Athira Rajeev 3 participants 5 messages May 25, 2021 – Jun 18, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v3 cover selftests/powerpc: Updates to EBB selftest for ISA v3.1

The "no_handler_test" in ebb selftests attempts to read the PMU registers after closing of the event via helper function "dump_ebb_state". With the MMCR0 control bit (PMCCEXT) in ISA v3.1, read access to group B registers is restricted when MMCR0 PMCC=0b00. Hence the call to dump_ebb_state after closing of event will generate a SIGILL, which is expected.

Test has below in logs:
<<>>
!! child died by signal 4
failure: no_handler_test
<<>>

In other platforms (like power9), the older behaviour works where group B PMU SPRs are readable. The "dump_ebb_state" is called twice in the test. The second call after closing of event was done inorder to dump state of registers when the counters are frozen. But since the counters should already be frozen by the time first dump is done, patch1 drops the second call to "dump_ebb_state".

To address the new sigill behaviour in ISA v3.1, patch2 creates a separate selftest.

Changelog:
v2 -> v3:
Fixed a space issue in patch2.

v1 -> v2:
Addressed review comments from Michael Ellerman. First version attempted to address the SIGILL behaviour in existing "no_handler_test" test itself. As per mpe's suggestion, moved that to a separate test and removed the second call to "dump_ebb_state" since that is actually not needed.

Athira Rajeev (2):
selftests/powerpc: Fix "no_handler" EBB selftest selftests/powerpc: EBB selftest for MMCR0 control for PMU SPRs in ISA

    v3.1
 tools/testing/selftests/powerpc/pmu/ebb/Makefile   |  2 +-
 .../selftests/powerpc/pmu/ebb/no_handler_test.c    |  2 -
 .../powerpc/pmu/ebb/regs_access_pmccext_test.c     | 63 ++++++++++++++++++++++
 3 files changed, 64 insertions(+), 3 deletions(-)
 create mode 100644 tools/testing/selftests/powerpc/pmu/ebb/regs_access_pmccext_test.c
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH v3 1/2 selftests/powerpc: Fix "no_handler" EBB selftest

The "no_handler_test" in ebb selftests attempts to read the PMU registers twice via helper function "dump_ebb_state". First dump is just before closing of event and the second invocation is done after closing of the event. The original intention of second dump_ebb_state was to dump the state of registers at the end of the test when the counters are frozen. But this will be achieved with the first call itself since sample period is set to low value and PMU will be frozen by then. Hence patch removes the dump which was done before closing of the event.

---
 tools/testing/selftests/powerpc/pmu/ebb/no_handler_test.c | 2 --
 1 file changed, 2 deletions(-)
tools/testing/selftests/powerpc/pmu/ebb/no_handler_test.c +0 -2
index fc5bf48..01e827c 100644
@@ -50,8 +50,6 @@ static int no_handler_test(void)
 
 	event_close(&event);
 
-	dump_ebb_state();
-
 	/* The real test is that we never took an EBB at 0x0 */
 
 	return 0;
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH v3 2/2 selftests/powerpc: EBB selftest for MMCR0 control for PMU SPRs in ISA v3.1

In reply to Athira Rajeev

With the MMCR0 control bit (PMCCEXT) in ISA v3.1, read access to group B registers is restricted when MMCR0 PMCC=0b00. In other platforms (like power9), the older behaviour works where group B PMU SPRs are readable.

Patch creates a selftest which verifies that the test takes a SIGILL when attempting to read PMU registers via helper function "dump_ebb_state" for ISA v3.1.

---
 tools/testing/selftests/powerpc/pmu/ebb/Makefile   |  2 +-
 .../powerpc/pmu/ebb/regs_access_pmccext_test.c     | 63 ++++++++++++++++++++++
 2 files changed, 64 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/powerpc/pmu/ebb/regs_access_pmccext_test.c
tools/testing/selftests/powerpc/pmu/ebb/Makefile +1 -1
index c5ecb46..0101606 100644
@@ -24,7 +24,7 @@ TEST_GEN_PROGS := reg_access_test event_attributes_test cycles_test	\
 	 fork_cleanup_test ebb_on_child_test			\
 	 ebb_on_willing_child_test back_to_back_ebbs_test	\
 	 lost_exception_test no_handler_test			\
-	 cycles_with_mmcr2_test
+	 cycles_with_mmcr2_test regs_access_pmccext_test
 
 top_srcdir = ../../../../../..
 include ../../../lib.mk
tools/testing/selftests/powerpc/pmu/ebb/regs_access_pmccext_test.c new file +63 -0

63 lines not on this page · raw message

Signature · 1 line
1.8.3.1
Tested-by Nageswara R Sastry on the v3 series
#3 lore raw
In reply to Athira Rajeev
Quoted 11 lines · Athira Rajeev

The "no_handler_test" in ebb selftests attempts to read the PMU registers after closing of the event via helper function "dump_ebb_state". With the MMCR0 control bit (PMCCEXT) in ISA v3.1, read access to group B registers is restricted when MMCR0 PMCC=0b00. Hence the call to dump_ebb_state after closing of event will generate a SIGILL, which is expected.

Quoted 6 lines

Test has below in logs:
<<>>
!! child died by signal 4
failure: no_handler_test
<<>>

Tested patches on Power9 and Power10 - PowerVM environment.

Power9 - no_handler_test - with and without patch - success Power10 - no_handler_test - without patch - failure Power10 - no_handler_test - with patch - success

Power9 - regs_access_pmccext_test - with patch - success Power10 - regs_access_pmccext_test - with patch - success

Tested-by Nageswara R Sastry <[email protected] <mailto:[email protected]>>

Thank you.

#4 lore raw
In reply to Athira Rajeev
Quoted 8 lines · Athira Rajeev

The "no_handler_test" in ebb selftests attempts to read the PMU registers after closing of the event via helper function "dump_ebb_state". With the MMCR0 control bit (PMCCEXT) in ISA v3.1, read access to group B registers is restricted when MMCR0 PMCC=0b00. Hence the call to dump_ebb_state after closing of event will generate a SIGILL, which is expected.

[...]

Applied to powerpc/next.

[1/2] selftests/powerpc: Fix "no_handler" EBB selftest

      https://git.kernel.org/powerpc/c/45677c9aebe926192e59475b35a1ff35ff2d4217
[2/2] selftests/powerpc: EBB selftest for MMCR0 control for PMU SPRs in ISA v3.1
      https://git.kernel.org/powerpc/c/d81090ed44c0d15abf2b07663d5f0b9e5ba51525

cheers