[PATCH] selftests/vDSO: fix ABI selftest on riscv

Vincenzo Frascino vincenzo.frascino at arm.com
Fri Feb 5 06:12:59 EST 2021


On 2/5/21 7:06 AM, Palmer Dabbelt wrote:
> On Thu, 04 Feb 2021 06:50:42 PST (-0800), tklauser at distanz.ch 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
>>
>> Signed-off-by: Tobias Klauser <tklauser at distanz.ch>
>> ---
>>  tools/testing/selftests/vDSO/vdso_config.h | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/vDSO/vdso_config.h
>> b/tools/testing/selftests/vDSO/vdso_config.h
>> index 6a6fe8d4ff55..6188b16827d1 100644
>> --- a/tools/testing/selftests/vDSO/vdso_config.h
>> +++ b/tools/testing/selftests/vDSO/vdso_config.h
>> @@ -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
> 
> Reviewed-by: Palmer Dabbelt <palmerdabbelt at google.com>
> Acked-by: Palmer Dabbelt <palmerdabbelt at google.com>
>

Acked-by: Vincenzo Frascino <vincenzo.frascino at arm.com>

> 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!

-- 
Regards,
Vincenzo



More information about the linux-riscv mailing list