From: Thomas Weißschuh <hidden> Date: 2026-02-27 06:44:43
The vDSO header files are a bit of a mess, relying on transitive
includes and pulling in much more definitions than necessary.
Clean up the headers and remove some ifdeffery in the rng core.
This was originally part of my SPARC generic vDSO patch series [0].
After feedback I am reworking that series and it may not require these
cleanups anymore. But as the code is already written I am submitting it
here standalone.
Based on tip/timers/vdso.
[0] https://lore.kernel.org/lkml/20251106-vdso-sparc64-generic-2-v5-0-97ff2b6542f7@linutronix.de/
Signed-off-by: Thomas Weißschuh <redacted>
---
Changes in v2:
- Rebase on v7.0-rc1
- Link to v1: https://lore.kernel.org/r/20260114-vdso-header-cleanups-v1-0-803b80ee97b4@linutronix.de
---
Thomas Weißschuh (15):
arm64: vDSO: gettimeofday: Explicitly include vdso/clocksource.h
arm64: vDSO: compat_gettimeofday: Add explicit includes
ARM: vdso: gettimeofday: Add explicit includes
powerpc/vdso/gettimeofday: Explicitly include vdso/time32.h
powerpc/vdso: Explicitly include asm/cputable.h and asm/feature-fixups.h
LoongArch: vDSO: Explicitly include asm/vdso/vdso.h
MIPS: vdso: Add include guard to asm/vdso/vdso.h
MIPS: vdso: Explicitly include asm/vdso/vdso.h
random: vDSO: add explicit includes
vdso/gettimeofday: Add explicit includes
vdso/helpers: Explicitly include vdso/processor.h
vdso/datapage: Remove inclusion of gettimeofday.h
vdso/datapage: Trim down unnecessary includes
random: vDSO: trim vDSO includes
random: vDSO: remove ifdeffery
arch/arm/include/asm/vdso/gettimeofday.h | 2 ++
arch/arm64/include/asm/vdso/compat_gettimeofday.h | 3 +++
arch/arm64/include/asm/vdso/gettimeofday.h | 2 ++
arch/loongarch/kernel/process.c | 1 +
arch/loongarch/kernel/vdso.c | 1 +
arch/mips/include/asm/vdso/vdso.h | 5 +++++
arch/mips/kernel/vdso.c | 1 +
arch/powerpc/include/asm/vdso/gettimeofday.h | 1 +
arch/powerpc/include/asm/vdso/processor.h | 3 +++
drivers/char/random.c | 16 ++++++----------
include/vdso/datapage.h | 23 ++---------------------
include/vdso/helpers.h | 1 +
lib/vdso/getrandom.c | 3 +++
lib/vdso/gettimeofday.c | 17 +++++++++++++++++
14 files changed, 48 insertions(+), 31 deletions(-)
---
base-commit: 375f574d703d3af5174d6357d3ca8990bd4a1e42
change-id: 20260114-vdso-header-cleanups-d2fa26758eed
Best regards,
--
Thomas Weißschuh [off-list ref]
From: Thomas Weißschuh <hidden> Date: 2026-02-27 06:44:43
The reference to VDSO_CLOCKMODE_NONE requires vdso/clocksource.h. Currently
this header is included transitively, but that transitive inclusion is
about to go away.
Explicitly include the header.
Signed-off-by: Thomas Weißschuh <redacted>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
---
arch/arm64/include/asm/vdso/gettimeofday.h | 2 ++
1 file changed, 2 insertions(+)
From: Thomas Weißschuh <hidden> Date: 2026-02-27 06:44:44
The reference to VDSO_CLOCKMODE_ARCHTIMER requires vdso/clocksource.h and
'struct old_timespec32' requires vdso/time32.h. Currently these headers
are included transitively, but those transitive inclusions are about to go
away.
Explicitly include the headers.
Signed-off-by: Thomas Weißschuh <redacted>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
---
arch/arm64/include/asm/vdso/compat_gettimeofday.h | 3 +++
1 file changed, 3 insertions(+)
From: Thomas Weißschuh <hidden> Date: 2026-02-27 06:44:44
The reference to VDSO_CLOCKMODE_NONE requires vdso/clocksource.h and
'struct old_timespec32' requires vdso/time32.h. Currently these headers
are included transitively, but those transitive inclusions are about to go
away.
Explicitly include the headers.
Signed-off-by: Thomas Weißschuh <redacted>
---
arch/arm/include/asm/vdso/gettimeofday.h | 2 ++
1 file changed, 2 insertions(+)
From: Thomas Weißschuh <hidden> Date: 2026-02-27 06:44:45
The usage of 'struct old_timespec32' requires vdso/time32.h. Currently
this header is included transitively, but that transitive inclusion is
about to go away.
Explicitly include the header.
Signed-off-by: Thomas Weißschuh <redacted>
Reviewed-by: Christophe Leroy <redacted>
---
arch/powerpc/include/asm/vdso/gettimeofday.h | 1 +
1 file changed, 1 insertion(+)
From: Thomas Weißschuh <hidden> Date: 2026-02-27 06:44:46
The usage of 'struct old_timespec32' requires asm/vdso/vdso.h. Currently
this header is included transitively, but that transitive inclusion is
about to go away.
Explicitly include the header.
Signed-off-by: Thomas Weißschuh <redacted>
---
arch/loongarch/kernel/process.c | 1 +
arch/loongarch/kernel/vdso.c | 1 +
2 files changed, 2 insertions(+)
From: Thomas Weißschuh <hidden> Date: 2026-02-27 06:44:46
An upcomming patch will lead to the header file being included multiple
times from the same source file.
Add an include guard so this is possible.
Signed-off-by: Thomas Weißschuh <redacted>
---
arch/mips/include/asm/vdso/vdso.h | 5 +++++
1 file changed, 5 insertions(+)
From: Thomas Weißschuh <hidden> Date: 2026-02-27 06:44:46
The usage of ASM_FTR_IFCLR(CPU_TR_ARCH_31) requires asm/cputable.h and
asm/feature-fixups.h. Currently these headers are included transitively,
but that transitive inclusion is about to go away.
Explicitly include the headers.
Signed-off-by: Thomas Weißschuh <redacted>
Reviewed-by: Christophe Leroy <redacted>
---
arch/powerpc/include/asm/vdso/processor.h | 3 +++
1 file changed, 3 insertions(+)
From: Thomas Weißschuh <hidden> Date: 2026-02-27 06:44:47
The usage of __VDSO_PAGES requires asm/vdso/vdso.h. Currently this header
is included transitively, but that transitive inclusion is about to go
away.
Explicitly include the header.
Signed-off-by: Thomas Weißschuh <redacted>
---
arch/mips/kernel/vdso.c | 1 +
1 file changed, 1 insertion(+)
From: Thomas Weißschuh <hidden> Date: 2026-02-27 06:44:48
Various used symbols are only visible through transitive includes.
These transitive includes are about to go away.
Explicitly include the necessary headers.
Signed-off-by: Thomas Weißschuh <redacted>
Acked-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
lib/vdso/getrandom.c | 3 +++
1 file changed, 3 insertions(+)
From: Thomas Weißschuh <hidden> Date: 2026-02-27 06:44:48
Various used symbols are only visible through transitive includes.
These transitive includes are about to go away.
Explicitly include the necessary headers.
Signed-off-by: Thomas Weißschuh <redacted>
---
lib/vdso/gettimeofday.c | 6 ++++++
1 file changed, 6 insertions(+)
From: Thomas Weißschuh <hidden> Date: 2026-02-27 06:44:49
The usage of cpu_relax() requires vdso/processor.h. Currently
this header is included transitively, but that transitive inclusion is
about to go away.
Explicitly include the header.
Signed-off-by: Thomas Weißschuh <redacted>
---
include/vdso/helpers.h | 1 +
1 file changed, 1 insertion(+)
From: Thomas Weißschuh <hidden> Date: 2026-02-27 06:44:50
vdso/datapage.h is useful without pulling in the architecture-specific
gettimeofday() helpers.
Move the include to the only users which needs it.
Signed-off-by: Thomas Weißschuh <redacted>
---
include/vdso/datapage.h | 11 -----------
lib/vdso/gettimeofday.c | 11 +++++++++++
2 files changed, 11 insertions(+), 11 deletions(-)
From: Thomas Weißschuh <hidden> Date: 2026-02-27 06:44:51
vdso/datapage.h includes a lot of headers which are not strictly necessary.
Some of those headers include architecture-specific vDSO headers which
prevent the usage of vdso/datapage.h in kernel code on architectures
without an vDSO. This would be useful however to write generic code using
IS_ENABLED(), for example in drivers/char/random.c.
Remove the unnecessary includes.
Signed-off-by: Thomas Weißschuh <redacted>
---
include/vdso/datapage.h | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
From: Thomas Weißschuh <hidden> Date: 2026-02-27 06:44:52
These includes are not used, remove them.
Signed-off-by: Thomas Weißschuh <redacted>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
drivers/char/random.c | 2 --
1 file changed, 2 deletions(-)
From: Thomas Weißschuh <hidden> Date: 2026-02-27 06:44:52
Recent cleanups of the vDSO headers allow the unconditional inclusion of
vdso/datapage.h and the declarations it provides. This also means that
the declaration of vdso_k_rng_data is always visible and its usage does
not need to be guarded by ifdefs anymore. Instead use IS_ENABLED().
Signed-off-by: Thomas Weißschuh <redacted>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
drivers/char/random.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)