Skip to contentSkip to conversation

kselftest/arm64: Small fixes for sve-ptrace test

PATCH Applied Mark Brown 3 participants 8 messages Jan 24, 2022 – Jan 28, 2022

Subsystems (2)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

cover kselftest/arm64: Small fixes for sve-ptrace test

A couple of fairly minor fixes for the sve-ptrace test, one output thing and one for an issue which would generate spurious false positives.

Mark Brown (2):
kselftest/arm64: Skip VL_INHERIT tests for unsupported vector types kselftest/arm64: Correct logging of FPSIMD register read via ptrace

 tools/testing/selftests/arm64/fp/sve-ptrace.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

base-commit: e783362eb54cd99b2cac8b3a9aeac942e6f6ac07

Signature · 1 line
2.30.2
author
#1 lore raw

PATCH 1/2 kselftest/arm64: Skip VL_INHERIT tests for unsupported vector types

Currently we unconditionally test the ability to set the vector length inheritance flag via ptrace meaning that we generate false failures on systems that don't support SVE when we attempt to set the vector length there. Check the hwcap and mark the tests as skipped when it's not present.

Fixes 0ba1ce1e86052d ("selftests: arm64: Add coverage of ptrace flags for SVE VL inheritance")
---
 tools/testing/selftests/arm64/fp/sve-ptrace.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
tools/testing/selftests/arm64/fp/sve-ptrace.c +8 -1
index af798b9d232c..0cf78360c5bc 100644
@@ -557,7 +557,14 @@ static int do_parent(pid_t child)
 		}
 
 		/* prctl() flags */
-		ptrace_set_get_inherit(child, &vec_types[i]);
+		if (getauxval(vec_types[i].hwcap_type) & vec_types[i].hwcap) {
+			ptrace_set_get_inherit(child, &vec_types[i]);
+		} else {
+			ksft_test_result_skip("%s SVE_PT_VL_INHERIT set\n",
+					      vec_types[i].name);
+			ksft_test_result_skip("%s SVE_PT_VL_INHERIT cleared\n",
+					      vec_types[i].name);
+		}
 
 		/* Step through every possible VQ */
 		for (vq = SVE_VQ_MIN; vq <= SVE_VQ_MAX; vq++) {
Signature · 1 line
2.30.2
maintainer
#2 lore raw

Re: [PATCH v1 1/2] kselftest/arm64: Skip VL_INHERIT tests for unsupported vector types

Quoted 17 lines · Mark Brown

Currently we unconditionally test the ability to set the vector length inheritance flag via ptrace meaning that we generate false failures on systems that don't support SVE when we attempt to set the vector length there. Check the hwcap and mark the tests as skipped when it's not present.

Fixes 0ba1ce1e86052d ("selftests: arm64: Add coverage of ptrace flags for SVE VL inheritance")
---
  tools/testing/selftests/arm64/fp/sve-ptrace.c | 9 ++++++++-
  1 file changed, 8 insertions(+), 1 deletion(-)
tools/testing/selftests/arm64/fp/sve-ptrace.c +0 -0
index af798b9d232c..0cf78360c5bc 100644
@@ -557,7 +557,14 @@ static int do_parent(pid_t child)
  		}

tools/testing/selftests/arm64/fp/sve-ptrace.c static int do_parent(pid_t child) · line 566

Quoted 10 lines
tools/testing/selftests/arm64/fp/sve-ptrace.c +7 -1
 
  		/* prctl() flags */
-		ptrace_set_get_inherit(child, &vec_types[i]);
+		if (getauxval(vec_types[i].hwcap_type) & vec_types[i].hwcap) {
+			ptrace_set_get_inherit(child, &vec_types[i]);
+		} else {
+			ksft_test_result_skip("%s SVE_PT_VL_INHERIT set\n",
+					      vec_types[i].name);
+			ksft_test_result_skip("%s SVE_PT_VL_INHERIT cleared\n",
+					      vec_types[i].name);

These messages are a bit confusing. Are we skipping two tests? These messages can be combined into one like this one on lin 572:

ksft_test_result_skip("%s get/set VL %d\n", vec_types[i].name, vl);

tools/testing/selftests/arm64/fp/sve-ptrace.c static int do_parent(pid_t child) · line 570

Quoted 5 lines
tools/testing/selftests/arm64/fp/sve-ptrace.c +1 -0
+		}
 
  		/* Step through every possible VQ */
  		for (vq = SVE_VQ_MIN; vq <= SVE_VQ_MAX; vq++) {

thanks,
-- Shuah

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

author
#3 lore raw

Re: [PATCH v1 1/2] kselftest/arm64: Skip VL_INHERIT tests for unsupported vector types

Quoted 12 lines · Shuah Khan

tools/testing/selftests/arm64/fp/sve-ptrace.c static int do_parent(pid_t child) · line 566

Quoted 8 lines · Mark Brown
tools/testing/selftests/arm64/fp/sve-ptrace.c +7 -1
-		ptrace_set_get_inherit(child, &vec_types[i]);
+		if (getauxval(vec_types[i].hwcap_type) & vec_types[i].hwcap) {
+			ptrace_set_get_inherit(child, &vec_types[i]);
+		} else {
+			ksft_test_result_skip("%s SVE_PT_VL_INHERIT set\n",
+					      vec_types[i].name);
+			ksft_test_result_skip("%s SVE_PT_VL_INHERIT cleared\n",
+					      vec_types[i].name);

These messages are a bit confusing. Are we skipping two tests?

ptrace_set_get_inherit() logs two test results (one for set, one for get).

Quoted 3 lines

These messages can be combined into one like this one on lin 572:

ksft_test_result_skip("%s get/set VL %d\n", vec_types[i].name, vl);

If we do that then the number of planned tests won't line up with the number of expected tests.

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

maintainer Reviewed-by
#4 lore raw

Re: [PATCH v1 1/2] kselftest/arm64: Skip VL_INHERIT tests for unsupported vector types

Quoted 14 lines · Mark Brown
Quoted 12 lines · Shuah Khan

tools/testing/selftests/arm64/fp/sve-ptrace.c static int do_parent(pid_t child) · line 566

Quoted 8 lines · Mark Brown
tools/testing/selftests/arm64/fp/sve-ptrace.c +7 -1
-		ptrace_set_get_inherit(child, &vec_types[i]);
+		if (getauxval(vec_types[i].hwcap_type) & vec_types[i].hwcap) {
+			ptrace_set_get_inherit(child, &vec_types[i]);
+		} else {
+			ksft_test_result_skip("%s SVE_PT_VL_INHERIT set\n",
+					      vec_types[i].name);
+			ksft_test_result_skip("%s SVE_PT_VL_INHERIT cleared\n",
+					      vec_types[i].name);

These messages are a bit confusing. Are we skipping two tests?

Quoted 2 lines

ptrace_set_get_inherit() logs two test results (one for set, one for get).

Ah okay.

Quoted 7 lines
Quoted 3 lines

These messages can be combined into one like this one on lin 572:

ksft_test_result_skip("%s get/set VL %d\n", vec_types[i].name, vl);

If we do that then the number of planned tests won't line up with the number of expected tests.

Sounds good. Assuming this is going through ARM tree?

thanks,
-- Shuah

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

author
#5 lore raw

PATCH 2/2 kselftest/arm64: Correct logging of FPSIMD register read via ptrace

In reply to Mark Brown

There's a cut'n'paste error in the logging for our test for reading register state back via ptrace, correctly say that we did a read instead of a write.

---
 tools/testing/selftests/arm64/fp/sve-ptrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/arm64/fp/sve-ptrace.c +1 -1
index 0cf78360c5bc..a3c1e67441f9 100644
@@ -261,7 +261,7 @@ static void ptrace_sve_fpsimd(pid_t child, const struct vec_type *type)
 	}
 
 	ksft_test_result((sve->flags & SVE_PT_REGS_MASK) == SVE_PT_REGS_FPSIMD,
-			 "Set FPSIMD registers via %s\n", type->name);
+			 "Got FPSIMD registers via %s\n", type->name);
 	if ((sve->flags & SVE_PT_REGS_MASK) != SVE_PT_REGS_FPSIMD)
 		goto out;
 
Signature · 1 line
2.30.2
maintainer Reviewed-by on v1 2/2
#6 lore raw

Re: [PATCH v1 2/2] kselftest/arm64: Correct logging of FPSIMD register read via ptrace

Quoted 14 lines · Mark Brown

There's a cut'n'paste error in the logging for our test for reading register state back via ptrace, correctly say that we did a read instead of a write.

---
  tools/testing/selftests/arm64/fp/sve-ptrace.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/arm64/fp/sve-ptrace.c +0 -0
index 0cf78360c5bc..a3c1e67441f9 100644

tools/testing/selftests/arm64/fp/sve-ptrace.c static void ptrace_sve_fpsimd(pid_t child, const struct vec_type *type) · line 267

Quoted 8 lines
tools/testing/selftests/arm64/fp/sve-ptrace.c +1 -1
@@ -261,7 +261,7 @@ static void ptrace_sve_fpsimd(pid_t child, const struct vec_type *type)
  	}
 
  	ksft_test_result((sve->flags & SVE_PT_REGS_MASK) == SVE_PT_REGS_FPSIMD,
-			 "Set FPSIMD registers via %s\n", type->name);
+			 "Got FPSIMD registers via %s\n", type->name);
  	if ((sve->flags & SVE_PT_REGS_MASK) != SVE_PT_REGS_FPSIMD)
  		goto out;
 

Looks good to me. Assuming this is going through ARM tree

thanks,
-- Shuah

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

maintainer Applied
#7 lore raw
In reply to Mark Brown
Quoted 8 lines · Mark Brown

A couple of fairly minor fixes for the sve-ptrace test, one output thing and one for an issue which would generate spurious false positives.

Mark Brown (2):
kselftest/arm64: Skip VL_INHERIT tests for unsupported vector types kselftest/arm64: Correct logging of FPSIMD register read via ptrace

[...]

Applied to arm64 (for-next/fixes), thanks!

[1/2] kselftest/arm64: Skip VL_INHERIT tests for unsupported vector types

      https://git.kernel.org/arm64/c/50806fd91428
[2/2] kselftest/arm64: Correct logging of FPSIMD register read via ptrace
      https://git.kernel.org/arm64/c/9ae279ecabe3
Signature · 1 line
Catalin