Skip to contentSkip to conversation

kselftest/arm64: vec-syscfg exit status and VL inheritance coverage

PATCH In review Abdalla Eldoumani 2 participants 4 messages Oct 17 – Oct 18

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

cover kselftest/arm64: vec-syscfg exit status and VL inheritance coverage

From: Abdalla Eldoumani <[email protected]>

Two small changes to the vector length configuration test.

The first makes vec-syscfg report failures through its exit status. It currently always exits 0, so a kernel that fails its checks still shows as passing in the kselftest runner.

The second implements the "Test PR_SVE_VL_INHERIT after a double fork" item from the fp TODO list by also checking the VL in a grandchild, two fork() and exec() generations down.

Tested under QEMU (-cpu max, -cpu max,sme=off and -cpu cortex-a57) on mainline (58161ead2, after v7.3-rc7). To check that the new test can fail, it was also run on a kernel modified to clear the inherit flag on exec(): the existing check passed, the new check failed for SVE and SME, and vec-syscfg exited 1.

Assisted-by LLM

Abdalla Eldoumani (2):
kselftest/arm64: Report test failures in vec-syscfg's exit status kselftest/arm64: Check that PR_SVE_VL_INHERIT survives a second exec

 tools/testing/selftests/arm64/fp/TODO         |  1 -
 tools/testing/selftests/arm64/fp/vec-syscfg.c | 64 +++++++++++++++++--
 2 files changed, 60 insertions(+), 5 deletions(-)

base-commit: 58161ead29e50d70a317ea26b472e0c7508e69da

Signature · 1 line
2.49.0.windows.1
#1 lore raw

PATCH 1/2 kselftest/arm64: Report test failures in vec-syscfg's exit status

From: Abdalla Eldoumani <[email protected]>

vec-syscfg ends with ksft_exit_pass() whatever its tests reported, so it exits 0 even when tests fail. The kselftest runner decides whether a program passed from its exit status, so failures in vec-syscfg are only visible in its TAP output and the run as a whole is reported as passing.

Use ksft_finished() so the exit status reflects the results. Unsupported vector types are reported as skips, which ksft_finished() treats as passing, so systems without SVE or SME are unaffected.

Fixes 95cf3f23877b ("kselftest/arm64: Add tests for SVE vector configuration")
Assisted-by LLM
---
 tools/testing/selftests/arm64/fp/vec-syscfg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/arm64/fp/vec-syscfg.c +1 -1
index 8dd932f..2c8ccbe 100644
@@ -792,5 +792,5 @@ int main(void)
 			ksft_test_result_skip("%s\n", all_types_tests[i].name);
 	}
 
-	ksft_exit_pass();
+	ksft_finished();
 }
Signature · 1 line
2.49.0.windows.1
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] kselftest/arm64: Report test failures in vec-syscfg's exit status

Quoted 10 lines · Abdalla Eldoumani

From: Abdalla Eldoumani <[email protected]>

vec-syscfg ends with ksft_exit_pass() whatever its tests reported, so it exits 0 even when tests fail. The kselftest runner decides whether a program passed from its exit status, so failures in vec-syscfg are only visible in its TAP output and the run as a whole is reported as passing.

Use ksft_finished() so the exit status reflects the results. Unsupported vector types are reported as skips, which ksft_finished() treats as passing, so systems without SVE or SME are unaffected.

#3 lore raw

PATCH 2/2 kselftest/arm64: Check that PR_SVE_VL_INHERIT survives a second exec

In reply to Abdalla Eldoumani

From: Abdalla Eldoumani <[email protected]>

The prctl_set_for_child test sets a vector length with PR_SVE_VL_INHERIT and checks that a forked and exec()ed child sees it. That only covers the first exec(). The kernel keeps the inherit flag and the on-exec VL across exec() so that later descendants keep the VL too, and nothing checks that part, which the fp TODO list notes as testing PR_SVE_VL_INHERIT after a double fork.

Extend the test to also read the VL in a grandchild. The child re-executes vec-syscfg in a mode that forks and execs the rdvl helper, so the VL is read after two fork() and exec() generations. Both SVE and SME are covered since the test runs for each vector type.

With a kernel modified to clear the inherit flag on exec() the existing check still passes and the new check fails for both vector types, with the grandchild getting the default VL. Drop the item from the TODO list.

Assisted-by LLM
---
 tools/testing/selftests/arm64/fp/TODO         |  1 -
 tools/testing/selftests/arm64/fp/vec-syscfg.c | 62 ++++++++++++++++++-
 2 files changed, 59 insertions(+), 4 deletions(-)
tools/testing/selftests/arm64/fp/TODO +0 -1
index 44004e5..90ee128 100644
@@ -4,4 +4,3 @@
  - Ensure ptraced processes actually see the register state visible through
    the ptrace interface.
  - Big endian.
-- Test PR_SVE_VL_INHERIT after a double fork.
tools/testing/selftests/arm64/fp/vec-syscfg.c +59 -3

102 lines not on this page · raw message

Signature · 1 line
2.49.0.windows.1