Skip to contentSkip to conversation

selftests/vDSO: fix ABI selftest on riscv

PATCH In review Tobias Klauser 4 participants 7 messages Feb 4, 2021 – Feb 10, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests/vDSO: fix ABI selftest on riscv

Only older versions of the RISC-V GCC toolchain define __riscv__. Check for __riscv as well, which is used by newer GCC toolchains. Also set VDSO_32BIT based on __riscv_xlen.

Before (on riscv64):

$ ./vdso_test_abi
[vDSO kselftest] VDSO_VERSION: LINUX_4
Could not find __vdso_gettimeofday
Could not find __vdso_clock_gettime
Could not find __vdso_clock_getres
clock_id: CLOCK_REALTIME [PASS]
Could not find __vdso_clock_gettime
Could not find __vdso_clock_getres
clock_id: CLOCK_BOOTTIME [PASS]
Could not find __vdso_clock_gettime
Could not find __vdso_clock_getres
clock_id: CLOCK_TAI [PASS]
Could not find __vdso_clock_gettime
Could not find __vdso_clock_getres
clock_id: CLOCK_REALTIME_COARSE [PASS]
Could not find __vdso_clock_gettime
Could not find __vdso_clock_getres
clock_id: CLOCK_MONOTONIC [PASS]
Could not find __vdso_clock_gettime
Could not find __vdso_clock_getres
clock_id: CLOCK_MONOTONIC_RAW [PASS]
Could not find __vdso_clock_gettime
Could not find __vdso_clock_getres
clock_id: CLOCK_MONOTONIC_COARSE [PASS]
Could not find __vdso_time

After (on riscv32):

$ ./vdso_test_abi
[vDSO kselftest] VDSO_VERSION: LINUX_4.15
The time is 1612449376.015086
The time is 1612449376.18340784
The resolution is 0 1
clock_id: CLOCK_REALTIME [PASS]
The time is 774.842586182
The resolution is 0 1
clock_id: CLOCK_BOOTTIME [PASS]
The time is 1612449376.22536565
The resolution is 0 1
clock_id: CLOCK_TAI [PASS]
The time is 1612449376.20885172
The resolution is 0 4000000
clock_id: CLOCK_REALTIME_COARSE [PASS]
The time is 774.845491269
The resolution is 0 1
clock_id: CLOCK_MONOTONIC [PASS]
The time is 774.849534200
The resolution is 0 1
clock_id: CLOCK_MONOTONIC_RAW [PASS]
The time is 774.842139684
The resolution is 0 4000000
clock_id: CLOCK_MONOTONIC_COARSE [PASS]
Could not find __vdso_time
---
 tools/testing/selftests/vDSO/vdso_config.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tools/testing/selftests/vDSO/vdso_config.h +3 -1
index 6a6fe8d4ff55..6188b16827d1 100644
@@ -47,10 +47,12 @@
 #elif defined(__x86_64__)
 #define VDSO_VERSION		0
 #define VDSO_NAMES		1
-#elif defined(__riscv__)
+#elif defined(__riscv__) || defined(__riscv)
 #define VDSO_VERSION		5
 #define VDSO_NAMES		1
+#if __riscv_xlen == 32
 #define VDSO_32BIT		1
+#endif
 #else /* nds32 */
 #define VDSO_VERSION		4
 #define VDSO_NAMES		1
Signature · 7 lines
2.30.0


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
maintainer Reviewed-by Acked-by on v1 1/1
#1 lore raw
Quoted 73 lines · On Thu, 04 Feb 2021 06:50:42 PST (-0800), [email protected] wrote:

Only older versions of the RISC-V GCC toolchain define __riscv__. Check for __riscv as well, which is used by newer GCC toolchains. Also set VDSO_32BIT based on __riscv_xlen.

Before (on riscv64):

$ ./vdso_test_abi
[vDSO kselftest] VDSO_VERSION: LINUX_4
Could not find __vdso_gettimeofday
Could not find __vdso_clock_gettime
Could not find __vdso_clock_getres
clock_id: CLOCK_REALTIME [PASS]
Could not find __vdso_clock_gettime
Could not find __vdso_clock_getres
clock_id: CLOCK_BOOTTIME [PASS]
Could not find __vdso_clock_gettime
Could not find __vdso_clock_getres
clock_id: CLOCK_TAI [PASS]
Could not find __vdso_clock_gettime
Could not find __vdso_clock_getres
clock_id: CLOCK_REALTIME_COARSE [PASS]
Could not find __vdso_clock_gettime
Could not find __vdso_clock_getres
clock_id: CLOCK_MONOTONIC [PASS]
Could not find __vdso_clock_gettime
Could not find __vdso_clock_getres
clock_id: CLOCK_MONOTONIC_RAW [PASS]
Could not find __vdso_clock_gettime
Could not find __vdso_clock_getres
clock_id: CLOCK_MONOTONIC_COARSE [PASS]
Could not find __vdso_time

After (on riscv32):

$ ./vdso_test_abi
[vDSO kselftest] VDSO_VERSION: LINUX_4.15
The time is 1612449376.015086
The time is 1612449376.18340784
The resolution is 0 1
clock_id: CLOCK_REALTIME [PASS]
The time is 774.842586182
The resolution is 0 1
clock_id: CLOCK_BOOTTIME [PASS]
The time is 1612449376.22536565
The resolution is 0 1
clock_id: CLOCK_TAI [PASS]
The time is 1612449376.20885172
The resolution is 0 4000000
clock_id: CLOCK_REALTIME_COARSE [PASS]
The time is 774.845491269
The resolution is 0 1
clock_id: CLOCK_MONOTONIC [PASS]
The time is 774.849534200
The resolution is 0 1
clock_id: CLOCK_MONOTONIC_RAW [PASS]
The time is 774.842139684
The resolution is 0 4000000
clock_id: CLOCK_MONOTONIC_COARSE [PASS]
Could not find __vdso_time
---
 tools/testing/selftests/vDSO/vdso_config.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tools/testing/selftests/vDSO/vdso_config.h +0 -0
index 6a6fe8d4ff55..6188b16827d1 100644
@@ -47,10 +47,12 @@
 #elif defined(__x86_64__)
 #define VDSO_VERSION		0
 #define VDSO_NAMES		1

tools/testing/selftests/vDSO/vdso_config.h line 58

Quoted 10 lines
tools/testing/selftests/vDSO/vdso_config.h +3 -1
-#elif defined(__riscv__)
+#elif defined(__riscv__) || defined(__riscv)
 #define VDSO_VERSION		5
 #define VDSO_NAMES		1
+#if __riscv_xlen == 32
 #define VDSO_32BIT		1
+#endif
 #else /* nds32 */
 #define VDSO_VERSION		4
 #define VDSO_NAMES		1

Not sure if you want this through the RISC-V tree, so I'm leaving it out for now and assuming it'll go through a kselftest tree.

Thanks!

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

#2 lore raw
Quoted 1 line · Palmer Dabbelt

On Thu, 04 Feb 2021 06:50:42 PST (-0800), [email protected] wrote:

[...]

Quoted 2 lines

Thank you!

Quoted 2 lines

Not sure if you want this through the RISC-V tree, so I'm leaving it out for now and assuming it'll go through a kselftest tree.

Either way is fine for me.

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

maintainer
#3 lore raw
Quoted 8 lines · Tobias Klauser
Quoted 1 line · Palmer Dabbelt

On Thu, 04 Feb 2021 06:50:42 PST (-0800), [email protected] wrote:

[...]

Quoted 2 lines
Quoted 7 lines

Thank you!

Quoted 2 lines

Not sure if you want this through the RISC-V tree, so I'm leaving it out for now and assuming it'll go through a kselftest tree.

Either way is fine for me.

Thank you. Applied to linux-kselftest next for 5.12-rc1

thanks,
-- Shuah

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

maintainer
#4 lore raw
Quoted 11 lines · On Mon, 08 Feb 2021 15:37:24 PST (-0800), [email protected] wrote:
Quoted 10 lines · Tobias Klauser
Quoted 1 line · Palmer Dabbelt

On Thu, 04 Feb 2021 06:50:42 PST (-0800), [email protected] wrote:

[...]

Quoted 2 lines

Thank you!

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Not sure if you want this through the RISC-V tree, so I'm leaving it out for now and assuming it'll go through a kselftest tree.

Either way is fine for me.

Thank you. Applied to linux-kselftest next for 5.12-rc1

Thanks!

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

#5 lore raw
In reply to Shuah Khan
Quoted 11 lines · Shuah Khan
Quoted 10 lines · Tobias Klauser
Quoted 1 line · Palmer Dabbelt

On Thu, 04 Feb 2021 06:50:42 PST (-0800), [email protected] wrote:

[...]

Quoted 2 lines

Thank you!

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Not sure if you want this through the RISC-V tree, so I'm leaving it out for now and assuming it'll go through a kselftest tree.

Either way is fine for me.

Thank you. Applied to linux-kselftest next for 5.12-rc1

Thank you Shuah!

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

maintainer Acked-by
#6 lore raw
In reply to Palmer Dabbelt
Quoted 80 lines · Palmer Dabbelt
Quoted 79 lines · On Thu, 04 Feb 2021 06:50:42 PST (-0800), [email protected] wrote:

Only older versions of the RISC-V GCC toolchain define __riscv__. Check for __riscv as well, which is used by newer GCC toolchains. Also set VDSO_32BIT based on __riscv_xlen.

Before (on riscv64):

$ ./vdso_test_abi
[vDSO kselftest] VDSO_VERSION: LINUX_4
Could not find __vdso_gettimeofday
Could not find __vdso_clock_gettime
Could not find __vdso_clock_getres
clock_id: CLOCK_REALTIME [PASS]
Could not find __vdso_clock_gettime
Could not find __vdso_clock_getres
clock_id: CLOCK_BOOTTIME [PASS]
Could not find __vdso_clock_gettime
Could not find __vdso_clock_getres
clock_id: CLOCK_TAI [PASS]
Could not find __vdso_clock_gettime
Could not find __vdso_clock_getres
clock_id: CLOCK_REALTIME_COARSE [PASS]
Could not find __vdso_clock_gettime
Could not find __vdso_clock_getres
clock_id: CLOCK_MONOTONIC [PASS]
Could not find __vdso_clock_gettime
Could not find __vdso_clock_getres
clock_id: CLOCK_MONOTONIC_RAW [PASS]
Could not find __vdso_clock_gettime
Could not find __vdso_clock_getres
clock_id: CLOCK_MONOTONIC_COARSE [PASS]
Could not find __vdso_time

After (on riscv32):

$ ./vdso_test_abi
[vDSO kselftest] VDSO_VERSION: LINUX_4.15
The time is 1612449376.015086
The time is 1612449376.18340784
The resolution is 0 1
clock_id: CLOCK_REALTIME [PASS]
The time is 774.842586182
The resolution is 0 1
clock_id: CLOCK_BOOTTIME [PASS]
The time is 1612449376.22536565
The resolution is 0 1
clock_id: CLOCK_TAI [PASS]
The time is 1612449376.20885172
The resolution is 0 4000000
clock_id: CLOCK_REALTIME_COARSE [PASS]
The time is 774.845491269
The resolution is 0 1
clock_id: CLOCK_MONOTONIC [PASS]
The time is 774.849534200
The resolution is 0 1
clock_id: CLOCK_MONOTONIC_RAW [PASS]
The time is 774.842139684
The resolution is 0 4000000
clock_id: CLOCK_MONOTONIC_COARSE [PASS]
Could not find __vdso_time

---
 tools/testing/selftests/vDSO/vdso_config.h | 4 +++-

 1 file changed, 3 insertions(+), 1 deletion(-)
tools/testing/selftests/vDSO/vdso_config.h +2 -1
index 6a6fe8d4ff55..6188b16827d1 100644
@@ -47,10 +47,12 @@
  #elif defined(__x86_64__)
  #define VDSO_VERSION        0
  #define VDSO_NAMES        1
-#elif defined(__riscv__)
+#elif defined(__riscv__) || defined(__riscv)
  #define VDSO_VERSION        5
  #define VDSO_NAMES        1
+#if __riscv_xlen == 32
Quoted 9 lines

tools/testing/selftests/vDSO/vdso_config.h line 58

Quoted 5 lines
tools/testing/selftests/vDSO/vdso_config.h +1 -0
  #define VDSO_32BIT        1
+#endif
  #else /* nds32 */
  #define VDSO_VERSION        4
  #define VDSO_NAMES        1
Quoted 4 lines

Not sure if you want this through the RISC-V tree, so I'm leaving it out for now and assuming it'll go through a kselftest tree.

Thanks!

Signature · 7 lines
Regards,
Vincenzo

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