Skip to contentSkip to conversation

arm64/signal: Clean up SVE/SME feature checking inconsistency

PATCH Superseded Mark Brown 2 participants 5 messages Jun 13, 2022 – Jun 24, 2022 arm64

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 arm64/signal: Clean up SVE/SME feature checking inconsistency

Currently when restoring signal state we check to see if SVE is supported in restore_sigframe() but check to see if SVE is supported inside restore_sve_fpsimd_context(). This makes no real difference since SVE is always supported in systems with SME but looks a bit untidy and makes things slightly harder to follow, move the SVE check next to the SME one in restore_sve_fpsimd_context().

---
 arch/arm64/kernel/signal.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
arch/arm64/kernel/signal.c +5 -6
index 23dd4c3bcfed..0d5a9eb43085 100644
@@ -281,6 +281,9 @@ static int restore_sve_fpsimd_context(struct user_ctxs *user)
 
 		vl = task_get_sme_vl(current);
 	} else {
+		if (!system_supports_sve())
+			return -EINVAL;
+
 		vl = task_get_sve_vl(current);
 	}
 
@@ -652,14 +655,10 @@ static int restore_sigframe(struct pt_regs *regs,
 		if (!user.fpsimd)
 			return -EINVAL;
 
-		if (user.sve) {
-			if (!system_supports_sve())
-				return -EINVAL;
-
+		if (user.sve)
 			err = restore_sve_fpsimd_context(&user);
-		} else {
+		else
 			err = restore_fpsimd_context(user.fpsimd);
-		}
 	}
 
 	if (err == 0 && system_supports_sme() && user.za)
Signature · 7 lines
2.30.2


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
maintainer
#1 lore raw
Quoted 27 lines · Mark Brown

Currently when restoring signal state we check to see if SVE is supported in restore_sigframe() but check to see if SVE is supported inside restore_sve_fpsimd_context(). This makes no real difference since SVE is always supported in systems with SME but looks a bit untidy and makes things slightly harder to follow, move the SVE check next to the SME one in restore_sve_fpsimd_context().

---
 arch/arm64/kernel/signal.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
arch/arm64/kernel/signal.c +3 -0
index 23dd4c3bcfed..0d5a9eb43085 100644
@@ -281,6 +281,9 @@ static int restore_sve_fpsimd_context(struct user_ctxs *user)
 
 		vl = task_get_sme_vl(current);
 	} else {
+		if (!system_supports_sve())
+			return -EINVAL;
+
 		vl = task_get_sve_vl(current);
 	}
 

arch/arm64/kernel/signal.c static int restore_sigframe(struct pt_regs *regs, · line 659

Quoted 9 lines
arch/arm64/kernel/signal.c +1 -4
@@ -652,14 +655,10 @@ static int restore_sigframe(struct pt_regs *regs,
 		if (!user.fpsimd)
 			return -EINVAL;
 
-		if (user.sve) {
-			if (!system_supports_sve())
-				return -EINVAL;
-
+		if (user.sve)
 			err = restore_sve_fpsimd_context(&user);

This breaks the allnoconfig build for me:

ld.lld: error: undefined symbol: restore_sve_fpsimd_context

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

referenced by signal.c
kernel/signal.o:(__arm64_sys_rt_sigreturn) in archive arch/arm64/built-in.a

make: *** [Makefile:1164: vmlinux] Error 1

Will

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

author
#2 lore raw
Quoted 6 lines · Will Deacon

This breaks the allnoconfig build for me:

ld.lld: error: undefined symbol: restore_sve_fpsimd_context

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

referenced by signal.c
kernel/signal.o:(__arm64_sys_rt_sigreturn) in archive arch/arm64/built-in.a

make: *** [Makefile:1164: vmlinux] Error 1

I can't reproduce that here - could you confirm exactly what tree you applied against and what toolchain you're using? I'm normally using clang 15 at the minute, 14 seems fine too, and applied against both -next and v5.19-rc3 all of which are building an allnoconfig happily for me.

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

maintainer
#3 lore raw
Quoted 7 lines · Mark Brown
Quoted 5 lines · Will Deacon

This breaks the allnoconfig build for me:

ld.lld: error: undefined symbol: restore_sve_fpsimd_context

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

referenced by signal.c
kernel/signal.o:(__arm64_sys_rt_sigreturn) in archive arch/arm64/built-in.a

Quoted 7 lines
Quoted 1 line

make: *** [Makefile:1164: vmlinux] Error 1

I can't reproduce that here - could you confirm exactly what tree you applied against and what toolchain you're using? I'm normally using clang 15 at the minute, 14 seems fine too, and applied against both -next and v5.19-rc3 all of which are building an allnoconfig happily for me.

I can reproduce the issue with just this patch applied on top of -rc3. I'll give your v2 a try, bu FWIW I'm using clang 12.0.6 and building using:

$ make LLVM=1 ARCH=arm64 mrproper allnoconfig
$ make LLVM=1 ARCH=arm64 -j100

Will

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

author
#4 lore raw
Quoted 11 lines · Will Deacon
Quoted 5 lines · Mark Brown

I can't reproduce that here - could you confirm exactly what tree you applied against and what toolchain you're using? I'm normally using clang 15 at the minute, 14 seems fine too, and applied against both -next and v5.19-rc3 all of which are building an allnoconfig happily for me.

I can reproduce the issue with just this patch applied on top of -rc3. I'll give your v2 a try, bu FWIW I'm using clang 12.0.6 and building using:

Ah, clang 12 is pretty old by clang standards and that .6 suggests it's probably some Android version. I can reproduce with upstream clang 12, my fix does seem to work for me.

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