[PATCH v2] selftests: vDSO: don't include generated headers for chacha test

Jason A. Donenfeld posted 1 patch 2 months, 2 weeks ago
tools/include/generated/asm-offsets.h     | 0
tools/include/generated/asm/cpucap-defs.h | 0
tools/include/generated/asm/sysreg-defs.h | 0
tools/testing/selftests/vDSO/Makefile     | 2 +-
4 files changed, 1 insertion(+), 1 deletion(-)
create mode 100644 tools/include/generated/asm-offsets.h
create mode 100644 tools/include/generated/asm/cpucap-defs.h
create mode 100644 tools/include/generated/asm/sysreg-defs.h
[PATCH v2] selftests: vDSO: don't include generated headers for chacha test
Posted by Jason A. Donenfeld 2 months, 2 weeks ago
It's not correct to use $(top_srcdir) for generated header files, for
builds that are done out of tree via O=, and $(objtree) isn't valid in
the selftests context. Instead, just obviate the need for these
generated header files by defining empty stubs in tools/include, which
is the same thing that's done for rwlock.h.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
I'll replace the broken commit with this one. I've verified the
kselftests are fine now, particularly for kvm.

 tools/include/generated/asm-offsets.h     | 0
 tools/include/generated/asm/cpucap-defs.h | 0
 tools/include/generated/asm/sysreg-defs.h | 0
 tools/testing/selftests/vDSO/Makefile     | 2 +-
 4 files changed, 1 insertion(+), 1 deletion(-)
 create mode 100644 tools/include/generated/asm-offsets.h
 create mode 100644 tools/include/generated/asm/cpucap-defs.h
 create mode 100644 tools/include/generated/asm/sysreg-defs.h

diff --git a/tools/include/generated/asm-offsets.h b/tools/include/generated/asm-offsets.h
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/tools/include/generated/asm/cpucap-defs.h b/tools/include/generated/asm/cpucap-defs.h
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/tools/include/generated/asm/sysreg-defs.h b/tools/include/generated/asm/sysreg-defs.h
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/tools/testing/selftests/vDSO/Makefile b/tools/testing/selftests/vDSO/Makefile
index 3c6fafbd83a6..610056acc1b7 100644
--- a/tools/testing/selftests/vDSO/Makefile
+++ b/tools/testing/selftests/vDSO/Makefile
@@ -39,7 +39,7 @@ $(OUTPUT)/vdso_test_getrandom: CFLAGS += -isystem $(top_srcdir)/tools/include \
 
 $(OUTPUT)/vdso_test_chacha: $(top_srcdir)/tools/arch/$(SRCARCH)/vdso/vgetrandom-chacha.S
 $(OUTPUT)/vdso_test_chacha: CFLAGS += -idirafter $(top_srcdir)/tools/include \
+                                      -idirafter $(top_srcdir)/tools/include/generated \
                                       -idirafter $(top_srcdir)/arch/$(SRCARCH)/include \
-                                      -idirafter $(top_srcdir)/arch/$(SRCARCH)/include/generated \
                                       -idirafter $(top_srcdir)/include \
                                       -D__ASSEMBLY__ -Wa,--noexecstack
-- 
2.46.0
Re: [PATCH v2] selftests: vDSO: don't include generated headers for chacha test
Posted by Mark Brown 2 months, 2 weeks ago
On Wed, Sep 11, 2024 at 03:36:32PM +0200, Jason A. Donenfeld wrote:

> It's not correct to use $(top_srcdir) for generated header files, for
> builds that are done out of tree via O=, and $(objtree) isn't valid in
> the selftests context. Instead, just obviate the need for these
> generated header files by defining empty stubs in tools/include, which
> is the same thing that's done for rwlock.h.

...

> I'll replace the broken commit with this one. I've verified the
> kselftests are fine now, particularly for kvm.

Did you also check perf?  For arm64 it uses the sysregs values though I
don't off hand know if that includes any of the generated values.  I
would expect that KVM will start breaking for arm64 at some point even
if it works for now, there was a desire to replace use of magic numbers
for registers in the tests with defines.
Re: [PATCH v2] selftests: vDSO: don't include generated headers for chacha test
Posted by Jason A. Donenfeld 2 months, 2 weeks ago
On Wed, Sep 11, 2024 at 03:12:35PM +0100, Mark Brown wrote:
> On Wed, Sep 11, 2024 at 03:36:32PM +0200, Jason A. Donenfeld wrote:
> 
> > It's not correct to use $(top_srcdir) for generated header files, for
> > builds that are done out of tree via O=, and $(objtree) isn't valid in
> > the selftests context. Instead, just obviate the need for these
> > generated header files by defining empty stubs in tools/include, which
> > is the same thing that's done for rwlock.h.
> 
> ...
> 
> > I'll replace the broken commit with this one. I've verified the
> > kselftests are fine now, particularly for kvm.
> 
> Did you also check perf?  For arm64 it uses the sysregs values though I
> don't off hand know if that includes any of the generated values.  I
> would expect that KVM will start breaking for arm64 at some point even
> if it works for now, there was a desire to replace use of magic numbers
> for registers in the tests with defines.

I just booted an arm64 VM and built perf with all the various options
and such, and it works fine. Those header files in the fixup commit
aren't seen by perf.

Jason