Skip to contentSkip to conversation

selftests/arm64: Fix O= builds for the FP selftests

PATCH Superseded Mark Brown 2 participants 9 messages Apr 19, 2022 – Apr 27, 2022

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Mark Brown

author
#0 lore raw

v2 cover selftests/arm64: Fix O= builds for the FP selftests

Currently the arm64 selftests don't support building with O=, this series fixes that, bringing them more into line with how the kselftest Makefiles want to work.

v2:
- Rebase onto v5.18-rc3.

Mark Brown (4):
selftests/arm64: Use TEST_GEN_PROGS_EXTENDED in the FP Makefile selftests/arm64: Define top_srcdir for the fp tests selftests/arm64: Clean the fp helper libraries selftests/arm64: Fix O= builds for the floating point tests

 tools/testing/selftests/arm64/fp/Makefile | 29 +++++++++++++----------
 1 file changed, 17 insertions(+), 12 deletions(-)

base-commit: b2d229d4ddb17db541098b83524d901257e93845

Signature · 1 line
2.30.2
author
#1 lore raw

PATCH v2 1/4 selftests/arm64: Use TEST_GEN_PROGS_EXTENDED in the FP Makefile

The kselftest lib.mk provides a default all target which builds additional programs from TEST_GEN_PROGS_EXTENDED, use that rather than using TEST_PROGS_EXTENDED which is for programs that don't need to be built like shell scripts. Leave fpsimd-stress and sve-stress there since they are scripts.

---
 tools/testing/selftests/arm64/fp/Makefile | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
tools/testing/selftests/arm64/fp/Makefile +3 -4
index 95f0b877a060..774c38cee317 100644
@@ -2,12 +2,11 @@
 
 CFLAGS += -I../../../../../usr/include/
 TEST_GEN_PROGS := sve-ptrace sve-probe-vls vec-syscfg
-TEST_PROGS_EXTENDED := fp-pidbench fpsimd-test fpsimd-stress \
+TEST_GEN_PROGS_EXTENDED := fp-pidbench fpsimd-test \
 	rdvl-sve \
-	sve-test sve-stress \
+	sve-test \
 	vlset
-
-all: $(TEST_GEN_PROGS) $(TEST_PROGS_EXTENDED)
+TEST_PROGS_EXTENDED := fpsimd-stress sve-stress
 
 fp-pidbench: fp-pidbench.S asm-utils.o
 	$(CC) -nostdlib $^ -o $@
Signature · 1 line
2.30.2
author
#2 lore raw

PATCH v2 2/4 selftests/arm64: Define top_srcdir for the fp tests

In reply to Mark Brown

Some of the rules in lib.mk use a top_srcdir variable to figure out where the top of the kselftest tree is, provide it.

---
 tools/testing/selftests/arm64/fp/Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
tools/testing/selftests/arm64/fp/Makefile +5 -1
index 774c38cee317..41b420050765 100644
@@ -1,6 +1,10 @@
 # SPDX-License-Identifier: GPL-2.0
 
-CFLAGS += -I../../../../../usr/include/
+# A proper top_srcdir is needed by KSFT(lib.mk)
+top_srcdir = $(realpath ../../../../../)
+
+CFLAGS += -I$(top_srcdir)/usr/include/
+
 TEST_GEN_PROGS := sve-ptrace sve-probe-vls vec-syscfg
 TEST_GEN_PROGS_EXTENDED := fp-pidbench fpsimd-test \
 	rdvl-sve \
Signature · 1 line
2.30.2
author
#3 lore raw

PATCH v2 3/4 selftests/arm64: Clean the fp helper libraries

In reply to Mark Brown

We provide a couple of object files with helpers linked into several of the test programs, ensure they are cleaned.

---
 tools/testing/selftests/arm64/fp/Makefile | 2 ++
 1 file changed, 2 insertions(+)
tools/testing/selftests/arm64/fp/Makefile +2 -0
index 41b420050765..927b1e83f469 100644
@@ -12,6 +12,8 @@ TEST_GEN_PROGS_EXTENDED := fp-pidbench fpsimd-test \
 	vlset
 TEST_PROGS_EXTENDED := fpsimd-stress sve-stress
 
+EXTRA_CLEAN += $(OUTPUT)/asm-utils.o $(OUTPUT)/rdvl.o
+
 fp-pidbench: fp-pidbench.S asm-utils.o
 	$(CC) -nostdlib $^ -o $@
 fpsimd-test: fpsimd-test.o asm-utils.o
Signature · 1 line
2.30.2
author
#4 lore raw

PATCH v2 4/4 selftests/arm64: Fix O= builds for the floating point tests

In reply to Mark Brown

Currently the arm64 floating point tests don't support out of tree builds due to two quirks of the kselftest build system. One is that when building a program from multiple files we shouldn't separately compile the main program to an object file as that will result in the pattern rule not matching when adjusted for the output directory. The other is that we also need to include $(OUTPUT) in the names of the binaries when specifying the dependencies in order to ensure that they get picked up with O=.

Rewrite the dependencies for the executables to fix these issues. The kselftest build system will ensure OUTPUT is always defined.

---
 tools/testing/selftests/arm64/fp/Makefile | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
tools/testing/selftests/arm64/fp/Makefile +8 -8
index 927b1e83f469..45bbbf1c5b97 100644
@@ -14,16 +14,16 @@ TEST_PROGS_EXTENDED := fpsimd-stress sve-stress
 
 EXTRA_CLEAN += $(OUTPUT)/asm-utils.o $(OUTPUT)/rdvl.o
 
-fp-pidbench: fp-pidbench.S asm-utils.o
+$(OUTPUT)/fp-pidbench: fp-pidbench.S asm-utils.o
 	$(CC) -nostdlib $^ -o $@
-fpsimd-test: fpsimd-test.o asm-utils.o
+$(OUTPUT)/fpsimd-test: fpsimd-test.S asm-utils.o
 	$(CC) -nostdlib $^ -o $@
-rdvl-sve: rdvl-sve.o rdvl.o
-sve-ptrace: sve-ptrace.o
-sve-probe-vls: sve-probe-vls.o rdvl.o
-sve-test: sve-test.o asm-utils.o
+$(OUTPUT)/rdvl-sve: rdvl-sve.c rdvl.o
+$(OUTPUT)/sve-ptrace: sve-ptrace.c
+$(OUTPUT)/sve-probe-vls: sve-probe-vls.c rdvl.o
+$(OUTPUT)/sve-test: sve-test.S asm-utils.o
 	$(CC) -nostdlib $^ -o $@
-vec-syscfg: vec-syscfg.o rdvl.o
-vlset: vlset.o
+$(OUTPUT)/vec-syscfg: vec-syscfg.c rdvl.o
+$(OUTPUT)/vlset: vlset.c
 
 include ../../lib.mk
Signature · 1 line
2.30.2
maintainer
#5 lore raw
In reply to Mark Brown

Hi Mark,

Quoted 6 lines · Mark Brown

Currently the arm64 selftests don't support building with O=, this series fixes that, bringing them more into line with how the kselftest Makefiles want to work.

v2:
- Rebase onto v5.18-rc3.

Would you mind rebasing them on top of the arm64 for-next/kselftest branch? I get some conflicts with the SME patches that went in there (or I can sort the conflicts out sometime tomorrow/Friday).

Thanks.

Signature · 1 line
Catalin
maintainer
#6 lore raw
Quoted 7 lines · Catalin Marinas

Hi Mark,

Quoted 4 lines · Mark Brown

Currently the arm64 selftests don't support building with O=, this series fixes that, bringing them more into line with how the kselftest Makefiles want to work.

Quoted 6 lines
Quoted 2 lines

v2:
- Rebase onto v5.18-rc3.

Would you mind rebasing them on top of the arm64 for-next/kselftest branch? I get some conflicts with the SME patches that went in there (or I can sort the conflicts out sometime tomorrow/Friday).

Unless you aimed these at 5.18 but I don't think they are urgent.

Signature · 1 line
Catalin
author
#7 lore raw
In reply to Catalin Marinas
Quoted 3 lines · Catalin Marinas

Would you mind rebasing them on top of the arm64 for-next/kselftest branch? I get some conflicts with the SME patches that went in there (or I can sort the conflicts out sometime tomorrow/Friday).

Sure. BTW note that the kselftest branch doesn't build since it doesn't include the SME branch so the test programs for the SME ABI haven't got a bunch of defintions that they're relying on.

maintainer
#8 lore raw
Quoted 8 lines · Mark Brown
Quoted 3 lines · Catalin Marinas

Would you mind rebasing them on top of the arm64 for-next/kselftest branch? I get some conflicts with the SME patches that went in there (or I can sort the conflicts out sometime tomorrow/Friday).

Sure. BTW note that the kselftest branch doesn't build since it doesn't include the SME branch so the test programs for the SME ABI haven't got a bunch of defintions that they're relying on.

Ah, I haven't tried it independently. I'll probably merge the sme branch into it.

Signature · 6 lines
Catalin

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