[PATCH 15/22] arch: vdso: consolidate gettime prototypes

Christophe Leroy christophe.leroy at csgroup.eu
Wed Nov 8 10:31:17 PST 2023


Hi Arnd,

Le 08/11/2023 à 13:58, Arnd Bergmann a écrit :
> From: Arnd Bergmann <arnd at arndb.de>
> 
> The VDSO functions are defined as globals in the kernel sources but intended
> to be called from userspace, so there is no need to declare them in a kernel
> side header.
> 
> Without a prototype, this now causes warnings such as
> 
> arch/mips/vdso/vgettimeofday.c:14:5: error: no previous prototype for '__vdso_clock_gettime' [-Werror=missing-prototypes]
> arch/mips/vdso/vgettimeofday.c:28:5: error: no previous prototype for '__vdso_gettimeofday' [-Werror=missing-prototypes]
> arch/mips/vdso/vgettimeofday.c:36:5: error: no previous prototype for '__vdso_clock_getres' [-Werror=missing-prototypes]
> arch/mips/vdso/vgettimeofday.c:42:5: error: no previous prototype for '__vdso_clock_gettime64' [-Werror=missing-prototypes]
> arch/sparc/vdso/vclock_gettime.c:254:1: error: no previous prototype for '__vdso_clock_gettime' [-Werror=missing-prototypes]
> arch/sparc/vdso/vclock_gettime.c:282:1: error: no previous prototype for '__vdso_clock_gettime_stick' [-Werror=missing-prototypes]
> arch/sparc/vdso/vclock_gettime.c:307:1: error: no previous prototype for '__vdso_gettimeofday' [-Werror=missing-prototypes]
> arch/sparc/vdso/vclock_gettime.c:343:1: error: no previous prototype for '__vdso_gettimeofday_stick' [-Werror=missing-prototypes]
> 
> Most architectures have already added workarounds for these by adding
> declarations somewhere, but since these are all compatible, we should
> really just have one copy, with an #ifdef check for the 32-bit vs
> 64-bit variant and use that everywhere.
> 
> Unfortunately, the sparc version is currently incompatible since
> that never added support for __vdso_clock_gettime64() in 32-bit
> userland. For the moment, I'm leaving this one out, as I can't
> easily test it and it requires a larger rework.
> 
> Signed-off-by: Arnd Bergmann <arnd at arndb.de>
> ---
>   arch/arm/include/asm/vdso.h              |  5 -----
>   arch/arm/vdso/vgettimeofday.c            |  1 +
>   arch/arm64/kernel/vdso32/vgettimeofday.c |  1 +
>   arch/csky/kernel/vdso/vgettimeofday.c    | 11 +----------
>   arch/loongarch/vdso/vgettimeofday.c      |  7 +------
>   arch/mips/vdso/vgettimeofday.c           |  1 +
>   arch/riscv/kernel/vdso/vgettimeofday.c   |  7 +------
>   arch/x86/entry/vdso/vclock_gettime.c     | 10 +---------
>   arch/x86/include/asm/vdso/gettimeofday.h |  2 --
>   arch/x86/um/vdso/um_vdso.c               |  1 +
>   include/vdso/gettime.h                   | 23 +++++++++++++++++++++++
>   11 files changed, 31 insertions(+), 38 deletions(-)
>   create mode 100644 include/vdso/gettime.h

powerpc has functions doing more or less the same, they are called 
__c_kernel_clock_gettime() and alike with their prototypes siting in 
arch/powerpc/include/asm/vdso/gettimeofday.h

Should those prototypes be moved to include/vdso/gettime.h too and 
eventually renamed, or are they considered too powerpc specific ?

Christophe


More information about the linux-riscv mailing list