Le 02/09/2024 à 14:37, Mark Brown a écrit :
On Mon, Sep 02, 2024 at 02:22:38PM +0200, Christophe Leroy wrote:

When vdso_test_getcpu doesn't find the vDSO entry point, it prints an error
text and returns KSFT_SKIP

I thought it would be more correct to have the same behaviour on
vdso_test_getrandom instead of trying to build it only when the underlying
kernel supports it.

The problem is that the test incorporates assembler code so it simply
won't build for architectures without explicit porting, the issue isn't
if the target kernel supports it but rather that the test won't compile
in the first place.

Yes indeed and that was the purpose of my patch, have a macro in vdso_config.h to tell where the assembler code is:

diff --git a/tools/testing/selftests/vDSO/vdso_config.h b/tools/testing/selftests/vDSO/vdso_config.h
index 740ce8c98d2e..693920471160 100644
--- a/tools/testing/selftests/vDSO/vdso_config.h
+++ b/tools/testing/selftests/vDSO/vdso_config.h
@@ -47,6 +47,7 @@
 #elif defined(__x86_64__)
 #define VDSO_VERSION           0
 #define VDSO_NAMES             1
+#define VDSO_GETRANDOM "../../../../arch/x86/entry/vdso/vgetrandom-chacha.S"
 #elif defined(__riscv__) || defined(__riscv)
 #define VDSO_VERSION           5
 #define VDSO_NAMES             1


And then:

diff --git a/tools/testing/selftests/vDSO/vdso_test_chacha-asm.S b/tools/testing/selftests/vDSO/vdso_test_chacha-asm.S
new file mode 100644
index 000000000000..8e704165f6f2
--- /dev/null
+++ b/tools/testing/selftests/vDSO/vdso_test_chacha-asm.S
@@ -0,0 +1,7 @@
+#include "vdso_config.h"
+
+#ifdef VDSO_GETRANDOM
+
+#include VDSO_GETRANDOM
+
+#endif

I thought it was a lot easier to handle if through necessary #ifdefs in vdso_config.h that implementing an additional logic in Makefiles.

Christophe

Reply via email to