linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] kselftest/arm64: Fixes for fp-ptrace on SME only systems
@ 2025-07-18 22:14 Mark Brown
  2025-07-18 22:14 ` [PATCH 1/3] kselftest/arm64: Test SME on SME only systems in fp-ptrace Mark Brown
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Mark Brown @ 2025-07-18 22:14 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Shuah Khan
  Cc: Mark Rutland, linux-arm-kernel, linux-kselftest, linux-kernel,
	Mark Brown

When testing SME only systems I noticed that fp-ptrace does not cope at
all well with them, this series fixes the major issues so that the test
program completes successfully.  The reason I was looking at this is
that following the recent round of fixes to ptrace we do not currently
offer any mechanism for disabling streaming mode via ptrace, this series
brings the program to a point where it tests the currently implemented
ABI.  A further series allowing the disabling of streaming mode via
ptrace will follow.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
Mark Brown (3):
      kselftest/arm64: Test SME on SME only systems in fp-ptrace
      kselftest/arm64: Fix SVE write data generation for SME only systems
      kselftest/arm64: Handle attempts to disable SM on SME only systems

 tools/testing/selftests/arm64/fp/fp-ptrace.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
---
base-commit: 86731a2a651e58953fc949573895f2fa6d456841
change-id: 20250718-arm64-fp-ptrace-sme-only-ab327d7f0d32

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


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

* [PATCH 1/3] kselftest/arm64: Test SME on SME only systems in fp-ptrace
  2025-07-18 22:14 [PATCH 0/3] kselftest/arm64: Fixes for fp-ptrace on SME only systems Mark Brown
@ 2025-07-18 22:14 ` Mark Brown
  2025-07-18 22:14 ` [PATCH 2/3] kselftest/arm64: Fix SVE write data generation for SME only systems Mark Brown
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2025-07-18 22:14 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Shuah Khan
  Cc: Mark Rutland, linux-arm-kernel, linux-kselftest, linux-kernel,
	Mark Brown

When checking that the vector extensions are supported fp-ptrace
currently only checks for SVE being supported which means that we get
into a confused half configured state for SME only systems. Check for
SME as well.

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

diff --git a/tools/testing/selftests/arm64/fp/fp-ptrace.c b/tools/testing/selftests/arm64/fp/fp-ptrace.c
index 191c47ca0ed8..d953e9b0ebe5 100644
--- a/tools/testing/selftests/arm64/fp/fp-ptrace.c
+++ b/tools/testing/selftests/arm64/fp/fp-ptrace.c
@@ -1607,7 +1607,7 @@ int main(void)
 	 * Run the test set if there is no SVE or SME, with those we
 	 * have to pick a VL for each run.
 	 */
-	if (!sve_supported()) {
+	if (!sve_supported() && !sme_supported()) {
 		test_config.sve_vl_in = 0;
 		test_config.sve_vl_expected = 0;
 		test_config.sme_vl_in = 0;

-- 
2.39.5


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

* [PATCH 2/3] kselftest/arm64: Fix SVE write data generation for SME only systems
  2025-07-18 22:14 [PATCH 0/3] kselftest/arm64: Fixes for fp-ptrace on SME only systems Mark Brown
  2025-07-18 22:14 ` [PATCH 1/3] kselftest/arm64: Test SME on SME only systems in fp-ptrace Mark Brown
@ 2025-07-18 22:14 ` Mark Brown
  2025-07-18 22:14 ` [PATCH 3/3] kselftest/arm64: Handle attempts to disable SM on " Mark Brown
  2025-07-22 10:10 ` [PATCH 0/3] kselftest/arm64: Fixes for fp-ptrace " Catalin Marinas
  3 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2025-07-18 22:14 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Shuah Khan
  Cc: Mark Rutland, linux-arm-kernel, linux-kselftest, linux-kernel,
	Mark Brown

fp-ptrace does not handle SME only systems correctly when generating data,
on SME only systems scenarios where we are not in streaming mode will not
have an expected vector length. This leads to attempts to do memcpy()s of
zero byte arrays which can crash, fix this by skipping generation of SVE
data for cases where we do not expect to have an active vector length.

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

diff --git a/tools/testing/selftests/arm64/fp/fp-ptrace.c b/tools/testing/selftests/arm64/fp/fp-ptrace.c
index d953e9b0ebe5..9fc9dc4adaf9 100644
--- a/tools/testing/selftests/arm64/fp/fp-ptrace.c
+++ b/tools/testing/selftests/arm64/fp/fp-ptrace.c
@@ -1134,6 +1134,9 @@ static void sve_write_expected(struct test_config *config)
 	int vl = vl_expected(config);
 	int sme_vq = __sve_vq_from_vl(config->sme_vl_expected);
 
+	if (!vl)
+		return;
+
 	fill_random(z_expected, __SVE_ZREGS_SIZE(__sve_vq_from_vl(vl)));
 	fill_random(p_expected, __SVE_PREGS_SIZE(__sve_vq_from_vl(vl)));
 
@@ -1161,6 +1164,9 @@ static void sve_write(pid_t child, struct test_config *config)
 	vl = vl_expected(config);
 	vq = __sve_vq_from_vl(vl);
 
+	if (!vl)
+		return;
+
 	iov.iov_len = SVE_PT_SVE_OFFSET + SVE_PT_SVE_SIZE(vq, SVE_PT_REGS_SVE);
 	iov.iov_base = malloc(iov.iov_len);
 	if (!iov.iov_base) {

-- 
2.39.5


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

* [PATCH 3/3] kselftest/arm64: Handle attempts to disable SM on SME only systems
  2025-07-18 22:14 [PATCH 0/3] kselftest/arm64: Fixes for fp-ptrace on SME only systems Mark Brown
  2025-07-18 22:14 ` [PATCH 1/3] kselftest/arm64: Test SME on SME only systems in fp-ptrace Mark Brown
  2025-07-18 22:14 ` [PATCH 2/3] kselftest/arm64: Fix SVE write data generation for SME only systems Mark Brown
@ 2025-07-18 22:14 ` Mark Brown
  2025-07-22 10:10 ` [PATCH 0/3] kselftest/arm64: Fixes for fp-ptrace " Catalin Marinas
  3 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2025-07-18 22:14 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Shuah Khan
  Cc: Mark Rutland, linux-arm-kernel, linux-kselftest, linux-kernel,
	Mark Brown

The ABI for disabling streaming mode via ptrace is to do a write via the
SVE register set. Following the recent round of fixes to the ptrace code
we don't support this operation on systems without SVE, which is detected
as failures by fp-ptrace. Update the program so that it knows that this
operation is not currently supported.

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

diff --git a/tools/testing/selftests/arm64/fp/fp-ptrace.c b/tools/testing/selftests/arm64/fp/fp-ptrace.c
index 9fc9dc4adaf9..21bc4eac092e 100644
--- a/tools/testing/selftests/arm64/fp/fp-ptrace.c
+++ b/tools/testing/selftests/arm64/fp/fp-ptrace.c
@@ -1061,6 +1061,9 @@ static bool sve_write_supported(struct test_config *config)
 		if (config->sme_vl_in != config->sme_vl_expected) {
 			return false;
 		}
+
+		if (!sve_supported())
+			return false;
 	}
 
 	return true;

-- 
2.39.5


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

* Re: [PATCH 0/3] kselftest/arm64: Fixes for fp-ptrace on SME only systems
  2025-07-18 22:14 [PATCH 0/3] kselftest/arm64: Fixes for fp-ptrace on SME only systems Mark Brown
                   ` (2 preceding siblings ...)
  2025-07-18 22:14 ` [PATCH 3/3] kselftest/arm64: Handle attempts to disable SM on " Mark Brown
@ 2025-07-22 10:10 ` Catalin Marinas
  3 siblings, 0 replies; 5+ messages in thread
From: Catalin Marinas @ 2025-07-22 10:10 UTC (permalink / raw)
  To: Will Deacon, Shuah Khan, Mark Brown
  Cc: Mark Rutland, linux-arm-kernel, linux-kselftest, linux-kernel

On Fri, 18 Jul 2025 23:14:49 +0100, Mark Brown wrote:
> When testing SME only systems I noticed that fp-ptrace does not cope at
> all well with them, this series fixes the major issues so that the test
> program completes successfully.  The reason I was looking at this is
> that following the recent round of fixes to ptrace we do not currently
> offer any mechanism for disabling streaming mode via ptrace, this series
> brings the program to a point where it tests the currently implemented
> ABI.  A further series allowing the disabling of streaming mode via
> ptrace will follow.
> 
> [...]

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

[1/3] kselftest/arm64: Test SME on SME only systems in fp-ptrace
      https://git.kernel.org/arm64/c/b021f45d39f3
[2/3] kselftest/arm64: Fix SVE write data generation for SME only systems
      https://git.kernel.org/arm64/c/aa7d3c8bc27d
[3/3] kselftest/arm64: Handle attempts to disable SM on SME only systems
      https://git.kernel.org/arm64/c/4752dcc156f2

-- 
Catalin


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

end of thread, other threads:[~2025-07-22 10:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-18 22:14 [PATCH 0/3] kselftest/arm64: Fixes for fp-ptrace on SME only systems Mark Brown
2025-07-18 22:14 ` [PATCH 1/3] kselftest/arm64: Test SME on SME only systems in fp-ptrace Mark Brown
2025-07-18 22:14 ` [PATCH 2/3] kselftest/arm64: Fix SVE write data generation for SME only systems Mark Brown
2025-07-18 22:14 ` [PATCH 3/3] kselftest/arm64: Handle attempts to disable SM on " Mark Brown
2025-07-22 10:10 ` [PATCH 0/3] kselftest/arm64: Fixes for fp-ptrace " Catalin Marinas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).