public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH 0/3] kselftest/arm64: Update sve-ptrace for ABI changes
@ 2025-05-23 15:27 Mark Brown
  2025-05-23 15:27 ` [PATCH 1/3] kselftest/arm64: Fix check for setting new VLs in sve-ptrace Mark Brown
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Mark Brown @ 2025-05-23 15:27 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Shuah Khan
  Cc: Mark Rutland, Shuah Khan, linux-arm-kernel, linux-kselftest,
	linux-kernel, Mark Brown

Mark Rutland's recent SME fixes updated the SME ABI to reject any
attempt to write FPSIMD register data via the streaming mode SVE
register set but did not update the sve-ptrace test to take account of
this, resulting in spurious failures.  Update the test for this, and
also fix another preexisting issue I noticed while looking at this.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
Mark Brown (3):
      kselftest/arm64: Fix check for setting new VLs in sve-ptrace
      kselftest/arm64: Fix test for streaming FPSIMD write in sve-ptrace
      kselftest/arm64: Specify SVE data when testing VL set in sve-ptrace

 tools/testing/selftests/arm64/fp/sve-ptrace.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
---
base-commit: 1c1abfd151c824698830ee900cc8d9f62e9a5fbb
change-id: 20250523-kselftest-arm64-ssve-fixups-b68ae61c1ebf

Best regards,
-- 
Mark Brown <broonie@kernel.org>



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/3] kselftest/arm64: Fix check for setting new VLs in sve-ptrace
  2025-05-23 15:27 [PATCH 0/3] kselftest/arm64: Update sve-ptrace for ABI changes Mark Brown
@ 2025-05-23 15:27 ` Mark Brown
  2025-05-26 10:30   ` Mark Rutland
  2025-05-26 10:53   ` Dev Jain
  2025-05-23 15:27 ` [PATCH 2/3] kselftest/arm64: Fix test for streaming FPSIMD write " Mark Brown
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 9+ messages in thread
From: Mark Brown @ 2025-05-23 15:27 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Shuah Khan
  Cc: Mark Rutland, Shuah Khan, linux-arm-kernel, linux-kselftest,
	linux-kernel, Mark Brown

The check that the new vector length we set was the expected one was typoed
to an assignment statement which for some reason the compilers didn't spot,
most likely due to the macros involved.

Fixes: 0dca276ac4d2 ("selftests: arm64: Add test for the SVE ptrace interface")
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 tools/testing/selftests/arm64/fp/sve-ptrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/arm64/fp/sve-ptrace.c b/tools/testing/selftests/arm64/fp/sve-ptrace.c
index 577b6e05e860..c499d5789dd5 100644
--- a/tools/testing/selftests/arm64/fp/sve-ptrace.c
+++ b/tools/testing/selftests/arm64/fp/sve-ptrace.c
@@ -253,7 +253,7 @@ static void ptrace_set_get_vl(pid_t child, const struct vec_type *type,
 		return;
 	}
 
-	ksft_test_result(new_sve->vl = prctl_vl, "Set %s VL %u\n",
+	ksft_test_result(new_sve->vl == prctl_vl, "Set %s VL %u\n",
 			 type->name, vl);
 
 	free(new_sve);

-- 
2.39.5



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/3] kselftest/arm64: Fix test for streaming FPSIMD write in sve-ptrace
  2025-05-23 15:27 [PATCH 0/3] kselftest/arm64: Update sve-ptrace for ABI changes Mark Brown
  2025-05-23 15:27 ` [PATCH 1/3] kselftest/arm64: Fix check for setting new VLs in sve-ptrace Mark Brown
@ 2025-05-23 15:27 ` Mark Brown
  2025-05-26 10:44   ` Mark Rutland
  2025-05-23 15:27 ` [PATCH 3/3] kselftest/arm64: Specify SVE data when testing VL set " Mark Brown
  2025-05-26 10:23 ` [PATCH 0/3] kselftest/arm64: Update sve-ptrace for ABI changes Mark Rutland
  3 siblings, 1 reply; 9+ messages in thread
From: Mark Brown @ 2025-05-23 15:27 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Shuah Khan
  Cc: Mark Rutland, Shuah Khan, linux-arm-kernel, linux-kselftest,
	linux-kernel, Mark Brown

Since f916dd32a943 ("arm64/fpsimd: ptrace: Mandate SVE payload for
streaming-mode state") we do not support writing FPSIMD payload data when
writing NT_ARM_SSVE but the sve-ptrace test has an explicit test for
this being supported which was not updated to reflect the new behaviour.
Fix the test to expect a failure when writing FPSIMD data to the
streaming mode register set.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
 tools/testing/selftests/arm64/fp/sve-ptrace.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/arm64/fp/sve-ptrace.c b/tools/testing/selftests/arm64/fp/sve-ptrace.c
index c499d5789dd5..7e259907805b 100644
--- a/tools/testing/selftests/arm64/fp/sve-ptrace.c
+++ b/tools/testing/selftests/arm64/fp/sve-ptrace.c
@@ -301,8 +301,10 @@ static void ptrace_sve_fpsimd(pid_t child, const struct vec_type *type)
 			p[j] = j;
 	}
 
+	/* This should only succeed for SVE */
 	ret = set_sve(child, type, sve);
-	ksft_test_result(ret == 0, "%s FPSIMD set via SVE: %d\n",
+	ksft_test_result((type->regset == NT_ARM_SVE) == (ret == 0),
+			 "%s FPSIMD set via SVE: %d\n",
 			 type->name, ret);
 	if (ret)
 		goto out;

-- 
2.39.5



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/3] kselftest/arm64: Specify SVE data when testing VL set in sve-ptrace
  2025-05-23 15:27 [PATCH 0/3] kselftest/arm64: Update sve-ptrace for ABI changes Mark Brown
  2025-05-23 15:27 ` [PATCH 1/3] kselftest/arm64: Fix check for setting new VLs in sve-ptrace Mark Brown
  2025-05-23 15:27 ` [PATCH 2/3] kselftest/arm64: Fix test for streaming FPSIMD write " Mark Brown
@ 2025-05-23 15:27 ` Mark Brown
  2025-05-26 10:57   ` Mark Rutland
  2025-05-26 10:23 ` [PATCH 0/3] kselftest/arm64: Update sve-ptrace for ABI changes Mark Rutland
  3 siblings, 1 reply; 9+ messages in thread
From: Mark Brown @ 2025-05-23 15:27 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Shuah Khan
  Cc: Mark Rutland, Shuah Khan, linux-arm-kernel, linux-kselftest,
	linux-kernel, Mark Brown

Since f916dd32a943 ("arm64/fpsimd: ptrace: Mandate SVE payload for
streaming-mode state") we reject attempts to write to the streaming mode
regset even if there is no register data supplied, causing the tests for
setting vector lengths and setting SVE_VL_INHERIT in sve-ptrace to
spuriously fail. Set the flag to avoid the issue, we still support not
supplying register data.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
 tools/testing/selftests/arm64/fp/sve-ptrace.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/arm64/fp/sve-ptrace.c b/tools/testing/selftests/arm64/fp/sve-ptrace.c
index 7e259907805b..7f9b6a61d369 100644
--- a/tools/testing/selftests/arm64/fp/sve-ptrace.c
+++ b/tools/testing/selftests/arm64/fp/sve-ptrace.c
@@ -170,7 +170,7 @@ static void ptrace_set_get_inherit(pid_t child, const struct vec_type *type)
 	memset(&sve, 0, sizeof(sve));
 	sve.size = sizeof(sve);
 	sve.vl = sve_vl_from_vq(SVE_VQ_MIN);
-	sve.flags = SVE_PT_VL_INHERIT;
+	sve.flags = SVE_PT_VL_INHERIT | SVE_PT_REGS_SVE;
 	ret = set_sve(child, type, &sve);
 	if (ret != 0) {
 		ksft_test_result_fail("Failed to set %s SVE_PT_VL_INHERIT\n",
@@ -235,6 +235,7 @@ static void ptrace_set_get_vl(pid_t child, const struct vec_type *type,
 	/* Set the VL by doing a set with no register payload */
 	memset(&sve, 0, sizeof(sve));
 	sve.size = sizeof(sve);
+	sve.flags = SVE_PT_REGS_SVE;
 	sve.vl = vl;
 	ret = set_sve(child, type, &sve);
 	if (ret != 0) {

-- 
2.39.5



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/3] kselftest/arm64: Update sve-ptrace for ABI changes
  2025-05-23 15:27 [PATCH 0/3] kselftest/arm64: Update sve-ptrace for ABI changes Mark Brown
                   ` (2 preceding siblings ...)
  2025-05-23 15:27 ` [PATCH 3/3] kselftest/arm64: Specify SVE data when testing VL set " Mark Brown
@ 2025-05-26 10:23 ` Mark Rutland
  3 siblings, 0 replies; 9+ messages in thread
From: Mark Rutland @ 2025-05-26 10:23 UTC (permalink / raw)
  To: Mark Brown
  Cc: Catalin Marinas, Will Deacon, Shuah Khan, Shuah Khan,
	linux-arm-kernel, linux-kselftest, linux-kernel

On Fri, May 23, 2025 at 04:27:11PM +0100, Mark Brown wrote:
> Mark Rutland's recent SME fixes updated the SME ABI to reject any
> attempt to write FPSIMD register data via the streaming mode SVE
> register set but did not update the sve-ptrace test to take account of
> this, resulting in spurious failures.  Update the test for this, and
> also fix another preexisting issue I noticed while looking at this.

For the sake of the mail archive, that series of fixes was:

  https://lore.kernel.org/linux-arm-kernel/20250508132644.1395904-1-mark.rutland@arm.com/

Evidently I only fixed up the fpsimd-ptrace tests, and missed the
sve-ptrace tests. My bad; sorry about that.

Mark.

> 
> Signed-off-by: Mark Brown <broonie@kernel.org>
> ---
> Mark Brown (3):
>       kselftest/arm64: Fix check for setting new VLs in sve-ptrace
>       kselftest/arm64: Fix test for streaming FPSIMD write in sve-ptrace
>       kselftest/arm64: Specify SVE data when testing VL set in sve-ptrace
> 
>  tools/testing/selftests/arm64/fp/sve-ptrace.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> ---
> base-commit: 1c1abfd151c824698830ee900cc8d9f62e9a5fbb
> change-id: 20250523-kselftest-arm64-ssve-fixups-b68ae61c1ebf
> 
> Best regards,
> -- 
> Mark Brown <broonie@kernel.org>
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] kselftest/arm64: Fix check for setting new VLs in sve-ptrace
  2025-05-23 15:27 ` [PATCH 1/3] kselftest/arm64: Fix check for setting new VLs in sve-ptrace Mark Brown
@ 2025-05-26 10:30   ` Mark Rutland
  2025-05-26 10:53   ` Dev Jain
  1 sibling, 0 replies; 9+ messages in thread
From: Mark Rutland @ 2025-05-26 10:30 UTC (permalink / raw)
  To: Mark Brown
  Cc: Catalin Marinas, Will Deacon, Shuah Khan, Shuah Khan,
	linux-arm-kernel, linux-kselftest, linux-kernel

On Fri, May 23, 2025 at 04:27:12PM +0100, Mark Brown wrote:
> The check that the new vector length we set was the expected one was typoed
> to an assignment statement which for some reason the compilers didn't spot,
> most likely due to the macros involved.
> 
> Fixes: 0dca276ac4d2 ("selftests: arm64: Add test for the SVE ptrace interface")

I don't think that fixes tag is correct. AFAICT, this code was
introduced in commit:

  a1d7111257cd ("selftests: arm64: More comprehensively test the SVE ptrace interface")

... and there wasn't something equivalent prior to that.

With that fixed:

Acked-by: Mark Rutland <mark.rutland@arm.com>

Mark.

> Signed-off-by: Mark Brown <broonie@kernel.org>
> ---
>  tools/testing/selftests/arm64/fp/sve-ptrace.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/arm64/fp/sve-ptrace.c b/tools/testing/selftests/arm64/fp/sve-ptrace.c
> index 577b6e05e860..c499d5789dd5 100644
> --- a/tools/testing/selftests/arm64/fp/sve-ptrace.c
> +++ b/tools/testing/selftests/arm64/fp/sve-ptrace.c
> @@ -253,7 +253,7 @@ static void ptrace_set_get_vl(pid_t child, const struct vec_type *type,
>  		return;
>  	}
>  
> -	ksft_test_result(new_sve->vl = prctl_vl, "Set %s VL %u\n",
> +	ksft_test_result(new_sve->vl == prctl_vl, "Set %s VL %u\n",
>  			 type->name, vl);
>  
>  	free(new_sve);
> 
> -- 
> 2.39.5
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/3] kselftest/arm64: Fix test for streaming FPSIMD write in sve-ptrace
  2025-05-23 15:27 ` [PATCH 2/3] kselftest/arm64: Fix test for streaming FPSIMD write " Mark Brown
@ 2025-05-26 10:44   ` Mark Rutland
  0 siblings, 0 replies; 9+ messages in thread
From: Mark Rutland @ 2025-05-26 10:44 UTC (permalink / raw)
  To: Mark Brown
  Cc: Catalin Marinas, Will Deacon, Shuah Khan, Shuah Khan,
	linux-arm-kernel, linux-kselftest, linux-kernel

On Fri, May 23, 2025 at 04:27:13PM +0100, Mark Brown wrote:
> Since f916dd32a943 ("arm64/fpsimd: ptrace: Mandate SVE payload for
> streaming-mode state") we do not support writing FPSIMD payload data when
> writing NT_ARM_SSVE but the sve-ptrace test has an explicit test for
> this being supported which was not updated to reflect the new behaviour.
> Fix the test to expect a failure when writing FPSIMD data to the
> streaming mode register set.
> 
> Signed-off-by: Mark Brown <broonie@kernel.org>

Acked-by: Mark Rutland <mark.rutland@arm.com>

Mark.

> ---
>  tools/testing/selftests/arm64/fp/sve-ptrace.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/arm64/fp/sve-ptrace.c b/tools/testing/selftests/arm64/fp/sve-ptrace.c
> index c499d5789dd5..7e259907805b 100644
> --- a/tools/testing/selftests/arm64/fp/sve-ptrace.c
> +++ b/tools/testing/selftests/arm64/fp/sve-ptrace.c
> @@ -301,8 +301,10 @@ static void ptrace_sve_fpsimd(pid_t child, const struct vec_type *type)
>  			p[j] = j;
>  	}
>  
> +	/* This should only succeed for SVE */
>  	ret = set_sve(child, type, sve);
> -	ksft_test_result(ret == 0, "%s FPSIMD set via SVE: %d\n",
> +	ksft_test_result((type->regset == NT_ARM_SVE) == (ret == 0),
> +			 "%s FPSIMD set via SVE: %d\n",
>  			 type->name, ret);
>  	if (ret)
>  		goto out;
> 
> -- 
> 2.39.5
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] kselftest/arm64: Fix check for setting new VLs in sve-ptrace
  2025-05-23 15:27 ` [PATCH 1/3] kselftest/arm64: Fix check for setting new VLs in sve-ptrace Mark Brown
  2025-05-26 10:30   ` Mark Rutland
@ 2025-05-26 10:53   ` Dev Jain
  1 sibling, 0 replies; 9+ messages in thread
From: Dev Jain @ 2025-05-26 10:53 UTC (permalink / raw)
  To: Mark Brown, Catalin Marinas, Will Deacon, Shuah Khan
  Cc: Mark Rutland, Shuah Khan, linux-arm-kernel, linux-kselftest,
	linux-kernel


On 23/05/25 8:57 pm, Mark Brown wrote:
> The check that the new vector length we set was the expected one was typoed
> to an assignment statement which for some reason the compilers didn't spot,
> most likely due to the macros involved.
>
> Fixes: 0dca276ac4d2 ("selftests: arm64: Add test for the SVE ptrace interface")
> Signed-off-by: Mark Brown <broonie@kernel.org>

Acked-by: Dev Jain <dev.jain@arm.com>

>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/3] kselftest/arm64: Specify SVE data when testing VL set in sve-ptrace
  2025-05-23 15:27 ` [PATCH 3/3] kselftest/arm64: Specify SVE data when testing VL set " Mark Brown
@ 2025-05-26 10:57   ` Mark Rutland
  0 siblings, 0 replies; 9+ messages in thread
From: Mark Rutland @ 2025-05-26 10:57 UTC (permalink / raw)
  To: Mark Brown
  Cc: Catalin Marinas, Will Deacon, Shuah Khan, Shuah Khan,
	linux-arm-kernel, linux-kselftest, linux-kernel

On Fri, May 23, 2025 at 04:27:14PM +0100, Mark Brown wrote:
> Since f916dd32a943 ("arm64/fpsimd: ptrace: Mandate SVE payload for
> streaming-mode state") we reject attempts to write to the streaming mode
> regset even if there is no register data supplied, causing the tests for
> setting vector lengths and setting SVE_VL_INHERIT in sve-ptrace to
> spuriously fail. Set the flag to avoid the issue, we still support not
> supplying register data.
> 
> Signed-off-by: Mark Brown <broonie@kernel.org>

Acked-by: Mark Rutland <mark.rutland@arm.com>

Mark.

> ---
>  tools/testing/selftests/arm64/fp/sve-ptrace.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/arm64/fp/sve-ptrace.c b/tools/testing/selftests/arm64/fp/sve-ptrace.c
> index 7e259907805b..7f9b6a61d369 100644
> --- a/tools/testing/selftests/arm64/fp/sve-ptrace.c
> +++ b/tools/testing/selftests/arm64/fp/sve-ptrace.c
> @@ -170,7 +170,7 @@ static void ptrace_set_get_inherit(pid_t child, const struct vec_type *type)
>  	memset(&sve, 0, sizeof(sve));
>  	sve.size = sizeof(sve);
>  	sve.vl = sve_vl_from_vq(SVE_VQ_MIN);
> -	sve.flags = SVE_PT_VL_INHERIT;
> +	sve.flags = SVE_PT_VL_INHERIT | SVE_PT_REGS_SVE;
>  	ret = set_sve(child, type, &sve);
>  	if (ret != 0) {
>  		ksft_test_result_fail("Failed to set %s SVE_PT_VL_INHERIT\n",
> @@ -235,6 +235,7 @@ static void ptrace_set_get_vl(pid_t child, const struct vec_type *type,
>  	/* Set the VL by doing a set with no register payload */
>  	memset(&sve, 0, sizeof(sve));
>  	sve.size = sizeof(sve);
> +	sve.flags = SVE_PT_REGS_SVE;
>  	sve.vl = vl;
>  	ret = set_sve(child, type, &sve);
>  	if (ret != 0) {
> 
> -- 
> 2.39.5
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-05-26 11:01 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-23 15:27 [PATCH 0/3] kselftest/arm64: Update sve-ptrace for ABI changes Mark Brown
2025-05-23 15:27 ` [PATCH 1/3] kselftest/arm64: Fix check for setting new VLs in sve-ptrace Mark Brown
2025-05-26 10:30   ` Mark Rutland
2025-05-26 10:53   ` Dev Jain
2025-05-23 15:27 ` [PATCH 2/3] kselftest/arm64: Fix test for streaming FPSIMD write " Mark Brown
2025-05-26 10:44   ` Mark Rutland
2025-05-23 15:27 ` [PATCH 3/3] kselftest/arm64: Specify SVE data when testing VL set " Mark Brown
2025-05-26 10:57   ` Mark Rutland
2025-05-26 10:23 ` [PATCH 0/3] kselftest/arm64: Update sve-ptrace for ABI changes Mark Rutland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox