public inbox for linuxppc-dev@ozlabs.org
 help / color / mirror / Atom feed
* [PATCH v2 00/15] vDSO: header file cleanups
@ 2026-02-27  6:44 Thomas Weißschuh
  2026-02-27  6:44 ` [PATCH v2 01/15] arm64: vDSO: gettimeofday: Explicitly include vdso/clocksource.h Thomas Weißschuh
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: Thomas Weißschuh @ 2026-02-27  6:44 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Russell King, Madhavan Srinivasan,
	Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
	Huacai Chen, WANG Xuerui, Thomas Bogendoerfer, Andy Lutomirski,
	Thomas Gleixner, Vincenzo Frascino, Theodore Ts'o,
	Jason A. Donenfeld
  Cc: linux-arm-kernel, linux-kernel, linuxppc-dev, loongarch,
	linux-mips, Thomas Weißschuh, Christophe Leroy

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 <thomas.weissschuh@linutronix.de>
---
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 <thomas.weissschuh@linutronix.de>



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 01/15] arm64: vDSO: gettimeofday: Explicitly include vdso/clocksource.h
  2026-02-27  6:44 [PATCH v2 00/15] vDSO: header file cleanups Thomas Weißschuh
@ 2026-02-27  6:44 ` Thomas Weißschuh
  2026-02-27  6:44 ` [PATCH v2 02/15] arm64: vDSO: compat_gettimeofday: Add explicit includes Thomas Weißschuh
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Thomas Weißschuh @ 2026-02-27  6:44 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Russell King, Madhavan Srinivasan,
	Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
	Huacai Chen, WANG Xuerui, Thomas Bogendoerfer, Andy Lutomirski,
	Thomas Gleixner, Vincenzo Frascino, Theodore Ts'o,
	Jason A. Donenfeld
  Cc: linux-arm-kernel, linux-kernel, linuxppc-dev, loongarch,
	linux-mips, Thomas Weißschuh

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 <thomas.weissschuh@linutronix.de>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
---
 arch/arm64/include/asm/vdso/gettimeofday.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm64/include/asm/vdso/gettimeofday.h b/arch/arm64/include/asm/vdso/gettimeofday.h
index 3658a757e255..96d2eccd4995 100644
--- a/arch/arm64/include/asm/vdso/gettimeofday.h
+++ b/arch/arm64/include/asm/vdso/gettimeofday.h
@@ -9,6 +9,8 @@
 
 #ifndef __ASSEMBLER__
 
+#include <vdso/clocksource.h>
+
 #include <asm/alternative.h>
 #include <asm/arch_timer.h>
 #include <asm/barrier.h>

-- 
2.53.0



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 02/15] arm64: vDSO: compat_gettimeofday: Add explicit includes
  2026-02-27  6:44 [PATCH v2 00/15] vDSO: header file cleanups Thomas Weißschuh
  2026-02-27  6:44 ` [PATCH v2 01/15] arm64: vDSO: gettimeofday: Explicitly include vdso/clocksource.h Thomas Weißschuh
@ 2026-02-27  6:44 ` Thomas Weißschuh
  2026-02-27  6:44 ` [PATCH v2 03/15] ARM: vdso: gettimeofday: " Thomas Weißschuh
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Thomas Weißschuh @ 2026-02-27  6:44 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Russell King, Madhavan Srinivasan,
	Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
	Huacai Chen, WANG Xuerui, Thomas Bogendoerfer, Andy Lutomirski,
	Thomas Gleixner, Vincenzo Frascino, Theodore Ts'o,
	Jason A. Donenfeld
  Cc: linux-arm-kernel, linux-kernel, linuxppc-dev, loongarch,
	linux-mips, Thomas Weißschuh

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 <thomas.weissschuh@linutronix.de>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
---
 arch/arm64/include/asm/vdso/compat_gettimeofday.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm64/include/asm/vdso/compat_gettimeofday.h b/arch/arm64/include/asm/vdso/compat_gettimeofday.h
index 0d513f924321..a03e34b572f1 100644
--- a/arch/arm64/include/asm/vdso/compat_gettimeofday.h
+++ b/arch/arm64/include/asm/vdso/compat_gettimeofday.h
@@ -7,6 +7,9 @@
 
 #ifndef __ASSEMBLER__
 
+#include <vdso/clocksource.h>
+#include <vdso/time32.h>
+
 #include <asm/barrier.h>
 #include <asm/unistd_compat_32.h>
 #include <asm/errno.h>

-- 
2.53.0



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 03/15] ARM: vdso: gettimeofday: Add explicit includes
  2026-02-27  6:44 [PATCH v2 00/15] vDSO: header file cleanups Thomas Weißschuh
  2026-02-27  6:44 ` [PATCH v2 01/15] arm64: vDSO: gettimeofday: Explicitly include vdso/clocksource.h Thomas Weißschuh
  2026-02-27  6:44 ` [PATCH v2 02/15] arm64: vDSO: compat_gettimeofday: Add explicit includes Thomas Weißschuh
@ 2026-02-27  6:44 ` Thomas Weißschuh
  2026-02-27  6:44 ` [PATCH v2 04/15] powerpc/vdso/gettimeofday: Explicitly include vdso/time32.h Thomas Weißschuh
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Thomas Weißschuh @ 2026-02-27  6:44 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Russell King, Madhavan Srinivasan,
	Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
	Huacai Chen, WANG Xuerui, Thomas Bogendoerfer, Andy Lutomirski,
	Thomas Gleixner, Vincenzo Frascino, Theodore Ts'o,
	Jason A. Donenfeld
  Cc: linux-arm-kernel, linux-kernel, linuxppc-dev, loongarch,
	linux-mips, Thomas Weißschuh

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 <thomas.weissschuh@linutronix.de>
---
 arch/arm/include/asm/vdso/gettimeofday.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/include/asm/vdso/gettimeofday.h b/arch/arm/include/asm/vdso/gettimeofday.h
index 1e9f81639c88..26da5d8621cc 100644
--- a/arch/arm/include/asm/vdso/gettimeofday.h
+++ b/arch/arm/include/asm/vdso/gettimeofday.h
@@ -11,6 +11,8 @@
 #include <asm/errno.h>
 #include <asm/unistd.h>
 #include <asm/vdso/cp15.h>
+#include <vdso/clocksource.h>
+#include <vdso/time32.h>
 #include <uapi/linux/time.h>
 
 #define VDSO_HAS_CLOCK_GETRES		1

-- 
2.53.0



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 04/15] powerpc/vdso/gettimeofday: Explicitly include vdso/time32.h
  2026-02-27  6:44 [PATCH v2 00/15] vDSO: header file cleanups Thomas Weißschuh
                   ` (2 preceding siblings ...)
  2026-02-27  6:44 ` [PATCH v2 03/15] ARM: vdso: gettimeofday: " Thomas Weißschuh
@ 2026-02-27  6:44 ` Thomas Weißschuh
  2026-02-27  6:44 ` [PATCH v2 05/15] powerpc/vdso: Explicitly include asm/cputable.h and asm/feature-fixups.h Thomas Weißschuh
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Thomas Weißschuh @ 2026-02-27  6:44 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Russell King, Madhavan Srinivasan,
	Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
	Huacai Chen, WANG Xuerui, Thomas Bogendoerfer, Andy Lutomirski,
	Thomas Gleixner, Vincenzo Frascino, Theodore Ts'o,
	Jason A. Donenfeld
  Cc: linux-arm-kernel, linux-kernel, linuxppc-dev, loongarch,
	linux-mips, Thomas Weißschuh, Christophe Leroy

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 <thomas.weissschuh@linutronix.de>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 arch/powerpc/include/asm/vdso/gettimeofday.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/include/asm/vdso/gettimeofday.h b/arch/powerpc/include/asm/vdso/gettimeofday.h
index 8ea397e26ad0..a853f853da6c 100644
--- a/arch/powerpc/include/asm/vdso/gettimeofday.h
+++ b/arch/powerpc/include/asm/vdso/gettimeofday.h
@@ -8,6 +8,7 @@
 #include <asm/barrier.h>
 #include <asm/unistd.h>
 #include <uapi/linux/time.h>
+#include <vdso/time32.h>
 
 #define VDSO_HAS_CLOCK_GETRES		1
 

-- 
2.53.0



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 05/15] powerpc/vdso: Explicitly include asm/cputable.h and asm/feature-fixups.h
  2026-02-27  6:44 [PATCH v2 00/15] vDSO: header file cleanups Thomas Weißschuh
                   ` (3 preceding siblings ...)
  2026-02-27  6:44 ` [PATCH v2 04/15] powerpc/vdso/gettimeofday: Explicitly include vdso/time32.h Thomas Weißschuh
@ 2026-02-27  6:44 ` Thomas Weißschuh
  2026-02-27  6:44 ` [PATCH v2 06/15] LoongArch: vDSO: Explicitly include asm/vdso/vdso.h Thomas Weißschuh
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Thomas Weißschuh @ 2026-02-27  6:44 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Russell King, Madhavan Srinivasan,
	Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
	Huacai Chen, WANG Xuerui, Thomas Bogendoerfer, Andy Lutomirski,
	Thomas Gleixner, Vincenzo Frascino, Theodore Ts'o,
	Jason A. Donenfeld
  Cc: linux-arm-kernel, linux-kernel, linuxppc-dev, loongarch,
	linux-mips, Thomas Weißschuh, Christophe Leroy

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 <thomas.weissschuh@linutronix.de>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 arch/powerpc/include/asm/vdso/processor.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/powerpc/include/asm/vdso/processor.h b/arch/powerpc/include/asm/vdso/processor.h
index c1f3d7aaf3ee..4c6802c3a580 100644
--- a/arch/powerpc/include/asm/vdso/processor.h
+++ b/arch/powerpc/include/asm/vdso/processor.h
@@ -4,6 +4,9 @@
 
 #ifndef __ASSEMBLER__
 
+#include <asm/cputable.h>
+#include <asm/feature-fixups.h>
+
 /* Macros for adjusting thread priority (hardware multi-threading) */
 #ifdef CONFIG_PPC64
 #define HMT_very_low()		asm volatile("or 31, 31, 31	# very low priority")

-- 
2.53.0



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 06/15] LoongArch: vDSO: Explicitly include asm/vdso/vdso.h
  2026-02-27  6:44 [PATCH v2 00/15] vDSO: header file cleanups Thomas Weißschuh
                   ` (4 preceding siblings ...)
  2026-02-27  6:44 ` [PATCH v2 05/15] powerpc/vdso: Explicitly include asm/cputable.h and asm/feature-fixups.h Thomas Weißschuh
@ 2026-02-27  6:44 ` Thomas Weißschuh
  2026-02-27  6:44 ` [PATCH v2 07/15] MIPS: vdso: Add include guard to asm/vdso/vdso.h Thomas Weißschuh
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Thomas Weißschuh @ 2026-02-27  6:44 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Russell King, Madhavan Srinivasan,
	Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
	Huacai Chen, WANG Xuerui, Thomas Bogendoerfer, Andy Lutomirski,
	Thomas Gleixner, Vincenzo Frascino, Theodore Ts'o,
	Jason A. Donenfeld
  Cc: linux-arm-kernel, linux-kernel, linuxppc-dev, loongarch,
	linux-mips, Thomas Weißschuh

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 <thomas.weissschuh@linutronix.de>
---
 arch/loongarch/kernel/process.c | 1 +
 arch/loongarch/kernel/vdso.c    | 1 +
 2 files changed, 2 insertions(+)

diff --git a/arch/loongarch/kernel/process.c b/arch/loongarch/kernel/process.c
index 4ac1c3086152..ac3a0baa5d00 100644
--- a/arch/loongarch/kernel/process.c
+++ b/arch/loongarch/kernel/process.c
@@ -52,6 +52,7 @@
 #include <asm/switch_to.h>
 #include <asm/unwind.h>
 #include <asm/vdso.h>
+#include <asm/vdso/vdso.h>
 
 #ifdef CONFIG_STACKPROTECTOR
 #include <linux/stackprotector.h>
diff --git a/arch/loongarch/kernel/vdso.c b/arch/loongarch/kernel/vdso.c
index 0aa10cadb959..8ce8159c10b9 100644
--- a/arch/loongarch/kernel/vdso.c
+++ b/arch/loongarch/kernel/vdso.c
@@ -18,6 +18,7 @@
 
 #include <asm/page.h>
 #include <asm/vdso.h>
+#include <asm/vdso/vdso.h>
 #include <vdso/helpers.h>
 #include <vdso/vsyscall.h>
 #include <vdso/datapage.h>

-- 
2.53.0



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 07/15] MIPS: vdso: Add include guard to asm/vdso/vdso.h
  2026-02-27  6:44 [PATCH v2 00/15] vDSO: header file cleanups Thomas Weißschuh
                   ` (5 preceding siblings ...)
  2026-02-27  6:44 ` [PATCH v2 06/15] LoongArch: vDSO: Explicitly include asm/vdso/vdso.h Thomas Weißschuh
@ 2026-02-27  6:44 ` Thomas Weißschuh
  2026-02-27  6:44 ` [PATCH v2 08/15] MIPS: vdso: Explicitly include asm/vdso/vdso.h Thomas Weißschuh
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Thomas Weißschuh @ 2026-02-27  6:44 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Russell King, Madhavan Srinivasan,
	Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
	Huacai Chen, WANG Xuerui, Thomas Bogendoerfer, Andy Lutomirski,
	Thomas Gleixner, Vincenzo Frascino, Theodore Ts'o,
	Jason A. Donenfeld
  Cc: linux-arm-kernel, linux-kernel, linuxppc-dev, loongarch,
	linux-mips, Thomas Weißschuh

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 <thomas.weissschuh@linutronix.de>
---
 arch/mips/include/asm/vdso/vdso.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/mips/include/asm/vdso/vdso.h b/arch/mips/include/asm/vdso/vdso.h
index 6889e0f2e5db..ef50d33f3439 100644
--- a/arch/mips/include/asm/vdso/vdso.h
+++ b/arch/mips/include/asm/vdso/vdso.h
@@ -4,6 +4,9 @@
  * Author: Alex Smith <alex.smith@imgtec.com>
  */
 
+#ifndef __ASM_VDSO_VDSO_H
+#define __ASM_VDSO_VDSO_H
+
 #include <asm/sgidefs.h>
 #include <vdso/page.h>
 
@@ -70,3 +73,5 @@ static inline void __iomem *get_gic(const struct vdso_time_data *data)
 #endif /* CONFIG_CLKSRC_MIPS_GIC */
 
 #endif /* __ASSEMBLER__ */
+
+#endif /* __ASM_VDSO_VDSO_H */

-- 
2.53.0



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 08/15] MIPS: vdso: Explicitly include asm/vdso/vdso.h
  2026-02-27  6:44 [PATCH v2 00/15] vDSO: header file cleanups Thomas Weißschuh
                   ` (6 preceding siblings ...)
  2026-02-27  6:44 ` [PATCH v2 07/15] MIPS: vdso: Add include guard to asm/vdso/vdso.h Thomas Weißschuh
@ 2026-02-27  6:44 ` Thomas Weißschuh
  2026-02-27  6:44 ` [PATCH v2 09/15] random: vDSO: add explicit includes Thomas Weißschuh
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Thomas Weißschuh @ 2026-02-27  6:44 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Russell King, Madhavan Srinivasan,
	Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
	Huacai Chen, WANG Xuerui, Thomas Bogendoerfer, Andy Lutomirski,
	Thomas Gleixner, Vincenzo Frascino, Theodore Ts'o,
	Jason A. Donenfeld
  Cc: linux-arm-kernel, linux-kernel, linuxppc-dev, loongarch,
	linux-mips, Thomas Weißschuh

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 <thomas.weissschuh@linutronix.de>
---
 arch/mips/kernel/vdso.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/mips/kernel/vdso.c b/arch/mips/kernel/vdso.c
index de096777172f..2fa4df3e46e4 100644
--- a/arch/mips/kernel/vdso.c
+++ b/arch/mips/kernel/vdso.c
@@ -21,6 +21,7 @@
 #include <asm/mips-cps.h>
 #include <asm/page.h>
 #include <asm/vdso.h>
+#include <asm/vdso/vdso.h>
 #include <vdso/helpers.h>
 #include <vdso/vsyscall.h>
 

-- 
2.53.0



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 09/15] random: vDSO: add explicit includes
  2026-02-27  6:44 [PATCH v2 00/15] vDSO: header file cleanups Thomas Weißschuh
                   ` (7 preceding siblings ...)
  2026-02-27  6:44 ` [PATCH v2 08/15] MIPS: vdso: Explicitly include asm/vdso/vdso.h Thomas Weißschuh
@ 2026-02-27  6:44 ` Thomas Weißschuh
  2026-02-27  6:44 ` [PATCH v2 10/15] vdso/gettimeofday: Add " Thomas Weißschuh
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Thomas Weißschuh @ 2026-02-27  6:44 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Russell King, Madhavan Srinivasan,
	Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
	Huacai Chen, WANG Xuerui, Thomas Bogendoerfer, Andy Lutomirski,
	Thomas Gleixner, Vincenzo Frascino, Theodore Ts'o,
	Jason A. Donenfeld
  Cc: linux-arm-kernel, linux-kernel, linuxppc-dev, loongarch,
	linux-mips, Thomas Weißschuh

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 <thomas.weissschuh@linutronix.de>
Acked-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 lib/vdso/getrandom.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/vdso/getrandom.c b/lib/vdso/getrandom.c
index 440f8a6203a6..7e29005aa208 100644
--- a/lib/vdso/getrandom.c
+++ b/lib/vdso/getrandom.c
@@ -7,8 +7,11 @@
 #include <linux/minmax.h>
 #include <vdso/datapage.h>
 #include <vdso/getrandom.h>
+#include <vdso/limits.h>
 #include <vdso/unaligned.h>
+#include <asm/barrier.h>
 #include <asm/vdso/getrandom.h>
+#include <uapi/linux/errno.h>
 #include <uapi/linux/mman.h>
 #include <uapi/linux/random.h>
 

-- 
2.53.0



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 10/15] vdso/gettimeofday: Add explicit includes
  2026-02-27  6:44 [PATCH v2 00/15] vDSO: header file cleanups Thomas Weißschuh
                   ` (8 preceding siblings ...)
  2026-02-27  6:44 ` [PATCH v2 09/15] random: vDSO: add explicit includes Thomas Weißschuh
@ 2026-02-27  6:44 ` Thomas Weißschuh
  2026-02-27  6:44 ` [PATCH v2 11/15] vdso/helpers: Explicitly include vdso/processor.h Thomas Weißschuh
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Thomas Weißschuh @ 2026-02-27  6:44 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Russell King, Madhavan Srinivasan,
	Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
	Huacai Chen, WANG Xuerui, Thomas Bogendoerfer, Andy Lutomirski,
	Thomas Gleixner, Vincenzo Frascino, Theodore Ts'o,
	Jason A. Donenfeld
  Cc: linux-arm-kernel, linux-kernel, linuxppc-dev, loongarch,
	linux-mips, Thomas Weißschuh

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 <thomas.weissschuh@linutronix.de>
---
 lib/vdso/gettimeofday.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/vdso/gettimeofday.c b/lib/vdso/gettimeofday.c
index 4399e143d43a..73b079eb4511 100644
--- a/lib/vdso/gettimeofday.c
+++ b/lib/vdso/gettimeofday.c
@@ -3,8 +3,14 @@
  * Generic userspace implementations of gettimeofday() and similar.
  */
 #include <vdso/auxclock.h>
+#include <vdso/clocksource.h>
 #include <vdso/datapage.h>
 #include <vdso/helpers.h>
+#include <vdso/ktime.h>
+#include <vdso/limits.h>
+#include <vdso/math64.h>
+#include <vdso/time32.h>
+#include <vdso/time64.h>
 
 /* Bring in default accessors */
 #include <vdso/vsyscall.h>

-- 
2.53.0



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 11/15] vdso/helpers: Explicitly include vdso/processor.h
  2026-02-27  6:44 [PATCH v2 00/15] vDSO: header file cleanups Thomas Weißschuh
                   ` (9 preceding siblings ...)
  2026-02-27  6:44 ` [PATCH v2 10/15] vdso/gettimeofday: Add " Thomas Weißschuh
@ 2026-02-27  6:44 ` Thomas Weißschuh
  2026-02-27  6:44 ` [PATCH v2 12/15] vdso/datapage: Remove inclusion of gettimeofday.h Thomas Weißschuh
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Thomas Weißschuh @ 2026-02-27  6:44 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Russell King, Madhavan Srinivasan,
	Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
	Huacai Chen, WANG Xuerui, Thomas Bogendoerfer, Andy Lutomirski,
	Thomas Gleixner, Vincenzo Frascino, Theodore Ts'o,
	Jason A. Donenfeld
  Cc: linux-arm-kernel, linux-kernel, linuxppc-dev, loongarch,
	linux-mips, Thomas Weißschuh

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 <thomas.weissschuh@linutronix.de>
---
 include/vdso/helpers.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/vdso/helpers.h b/include/vdso/helpers.h
index 1a5ee9d9052c..a1c995af4696 100644
--- a/include/vdso/helpers.h
+++ b/include/vdso/helpers.h
@@ -6,6 +6,7 @@
 
 #include <asm/barrier.h>
 #include <vdso/datapage.h>
+#include <vdso/processor.h>
 
 static __always_inline u32 vdso_read_begin(const struct vdso_clock *vc)
 {

-- 
2.53.0



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 12/15] vdso/datapage: Remove inclusion of gettimeofday.h
  2026-02-27  6:44 [PATCH v2 00/15] vDSO: header file cleanups Thomas Weißschuh
                   ` (10 preceding siblings ...)
  2026-02-27  6:44 ` [PATCH v2 11/15] vdso/helpers: Explicitly include vdso/processor.h Thomas Weißschuh
@ 2026-02-27  6:44 ` Thomas Weißschuh
  2026-02-27  6:44 ` [PATCH v2 13/15] vdso/datapage: Trim down unnecessary includes Thomas Weißschuh
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Thomas Weißschuh @ 2026-02-27  6:44 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Russell King, Madhavan Srinivasan,
	Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
	Huacai Chen, WANG Xuerui, Thomas Bogendoerfer, Andy Lutomirski,
	Thomas Gleixner, Vincenzo Frascino, Theodore Ts'o,
	Jason A. Donenfeld
  Cc: linux-arm-kernel, linux-kernel, linuxppc-dev, loongarch,
	linux-mips, Thomas Weißschuh

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 <thomas.weissschuh@linutronix.de>
---
 include/vdso/datapage.h | 11 -----------
 lib/vdso/gettimeofday.c | 11 +++++++++++
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/include/vdso/datapage.h b/include/vdso/datapage.h
index 23c39b96190f..752856b36a3a 100644
--- a/include/vdso/datapage.h
+++ b/include/vdso/datapage.h
@@ -184,17 +184,6 @@ enum vdso_pages {
 	VDSO_NR_PAGES
 };
 
-/*
- * The generic vDSO implementation requires that gettimeofday.h
- * provides:
- * - __arch_get_hw_counter(): to get the hw counter based on the
- *   clock_mode.
- * - gettimeofday_fallback(): fallback for gettimeofday.
- * - clock_gettime_fallback(): fallback for clock_gettime.
- * - clock_getres_fallback(): fallback for clock_getres.
- */
-#include <asm/vdso/gettimeofday.h>
-
 #else /* !__ASSEMBLY__ */
 
 #ifdef CONFIG_VDSO_GETRANDOM
diff --git a/lib/vdso/gettimeofday.c b/lib/vdso/gettimeofday.c
index 73b079eb4511..a4b0f06cf970 100644
--- a/lib/vdso/gettimeofday.c
+++ b/lib/vdso/gettimeofday.c
@@ -12,6 +12,17 @@
 #include <vdso/time32.h>
 #include <vdso/time64.h>
 
+/*
+ * The generic vDSO implementation requires that gettimeofday.h
+ * provides:
+ * - __arch_get_hw_counter(): to get the hw counter based on the
+ *   clock_mode.
+ * - gettimeofday_fallback(): fallback for gettimeofday.
+ * - clock_gettime_fallback(): fallback for clock_gettime.
+ * - clock_getres_fallback(): fallback for clock_getres.
+ */
+#include <asm/vdso/gettimeofday.h>
+
 /* Bring in default accessors */
 #include <vdso/vsyscall.h>
 

-- 
2.53.0



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 13/15] vdso/datapage: Trim down unnecessary includes
  2026-02-27  6:44 [PATCH v2 00/15] vDSO: header file cleanups Thomas Weißschuh
                   ` (11 preceding siblings ...)
  2026-02-27  6:44 ` [PATCH v2 12/15] vdso/datapage: Remove inclusion of gettimeofday.h Thomas Weißschuh
@ 2026-02-27  6:44 ` Thomas Weißschuh
  2026-02-27  6:44 ` [PATCH v2 14/15] random: vDSO: trim vDSO includes Thomas Weißschuh
  2026-02-27  6:44 ` [PATCH v2 15/15] random: vDSO: remove ifdeffery Thomas Weißschuh
  14 siblings, 0 replies; 16+ messages in thread
From: Thomas Weißschuh @ 2026-02-27  6:44 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Russell King, Madhavan Srinivasan,
	Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
	Huacai Chen, WANG Xuerui, Thomas Bogendoerfer, Andy Lutomirski,
	Thomas Gleixner, Vincenzo Frascino, Theodore Ts'o,
	Jason A. Donenfeld
  Cc: linux-arm-kernel, linux-kernel, linuxppc-dev, loongarch,
	linux-mips, Thomas Weißschuh

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 <thomas.weissschuh@linutronix.de>
---
 include/vdso/datapage.h | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/include/vdso/datapage.h b/include/vdso/datapage.h
index 752856b36a3a..9021b9580be2 100644
--- a/include/vdso/datapage.h
+++ b/include/vdso/datapage.h
@@ -4,24 +4,16 @@
 
 #ifndef __ASSEMBLY__
 
-#include <linux/compiler.h>
+#include <linux/types.h>
+
 #include <uapi/linux/bits.h>
 #include <uapi/linux/time.h>
-#include <uapi/linux/types.h>
-#include <uapi/asm-generic/errno-base.h>
 
 #include <vdso/align.h>
 #include <vdso/bits.h>
 #include <vdso/cache.h>
-#include <vdso/clocksource.h>
-#include <vdso/ktime.h>
-#include <vdso/limits.h>
-#include <vdso/math64.h>
 #include <vdso/page.h>
-#include <vdso/processor.h>
 #include <vdso/time.h>
-#include <vdso/time32.h>
-#include <vdso/time64.h>
 
 #ifdef CONFIG_ARCH_HAS_VDSO_TIME_DATA
 #include <asm/vdso/time_data.h>

-- 
2.53.0



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 14/15] random: vDSO: trim vDSO includes
  2026-02-27  6:44 [PATCH v2 00/15] vDSO: header file cleanups Thomas Weißschuh
                   ` (12 preceding siblings ...)
  2026-02-27  6:44 ` [PATCH v2 13/15] vdso/datapage: Trim down unnecessary includes Thomas Weißschuh
@ 2026-02-27  6:44 ` Thomas Weißschuh
  2026-02-27  6:44 ` [PATCH v2 15/15] random: vDSO: remove ifdeffery Thomas Weißschuh
  14 siblings, 0 replies; 16+ messages in thread
From: Thomas Weißschuh @ 2026-02-27  6:44 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Russell King, Madhavan Srinivasan,
	Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
	Huacai Chen, WANG Xuerui, Thomas Bogendoerfer, Andy Lutomirski,
	Thomas Gleixner, Vincenzo Frascino, Theodore Ts'o,
	Jason A. Donenfeld
  Cc: linux-arm-kernel, linux-kernel, linuxppc-dev, loongarch,
	linux-mips, Thomas Weißschuh

These includes are not used, remove them.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 drivers/char/random.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/char/random.c b/drivers/char/random.c
index dcd002e1b890..9738673018f3 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -57,9 +57,7 @@
 #include <crypto/chacha.h>
 #include <crypto/blake2s.h>
 #ifdef CONFIG_VDSO_GETRANDOM
-#include <vdso/getrandom.h>
 #include <vdso/datapage.h>
-#include <vdso/vsyscall.h>
 #endif
 #include <asm/archrandom.h>
 #include <asm/processor.h>

-- 
2.53.0



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 15/15] random: vDSO: remove ifdeffery
  2026-02-27  6:44 [PATCH v2 00/15] vDSO: header file cleanups Thomas Weißschuh
                   ` (13 preceding siblings ...)
  2026-02-27  6:44 ` [PATCH v2 14/15] random: vDSO: trim vDSO includes Thomas Weißschuh
@ 2026-02-27  6:44 ` Thomas Weißschuh
  14 siblings, 0 replies; 16+ messages in thread
From: Thomas Weißschuh @ 2026-02-27  6:44 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Russell King, Madhavan Srinivasan,
	Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
	Huacai Chen, WANG Xuerui, Thomas Bogendoerfer, Andy Lutomirski,
	Thomas Gleixner, Vincenzo Frascino, Theodore Ts'o,
	Jason A. Donenfeld
  Cc: linux-arm-kernel, linux-kernel, linuxppc-dev, loongarch,
	linux-mips, Thomas Weißschuh

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 <thomas.weissschuh@linutronix.de>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 drivers/char/random.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/char/random.c b/drivers/char/random.c
index 9738673018f3..9392a45852ec 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -56,9 +56,7 @@
 #include <linux/sched/isolation.h>
 #include <crypto/chacha.h>
 #include <crypto/blake2s.h>
-#ifdef CONFIG_VDSO_GETRANDOM
 #include <vdso/datapage.h>
-#endif
 #include <asm/archrandom.h>
 #include <asm/processor.h>
 #include <asm/irq.h>
@@ -274,7 +272,7 @@ static void crng_reseed(struct work_struct *work)
 	if (next_gen == ULONG_MAX)
 		++next_gen;
 	WRITE_ONCE(base_crng.generation, next_gen);
-#ifdef CONFIG_VDSO_GETRANDOM
+
 	/* base_crng.generation's invalid value is ULONG_MAX, while
 	 * vdso_k_rng_data->generation's invalid value is 0, so add one to the
 	 * former to arrive at the latter. Use smp_store_release so that this
@@ -288,8 +286,9 @@ static void crng_reseed(struct work_struct *work)
 	 * because the vDSO side only checks whether the value changed, without
 	 * actually using or interpreting the value.
 	 */
-	smp_store_release((unsigned long *)&vdso_k_rng_data->generation, next_gen + 1);
-#endif
+	if (IS_ENABLED(CONFIG_VDSO_GETRANDOM))
+		smp_store_release((unsigned long *)&vdso_k_rng_data->generation, next_gen + 1);
+
 	if (!static_branch_likely(&crng_is_ready))
 		crng_init = CRNG_READY;
 	spin_unlock_irqrestore(&base_crng.lock, flags);
@@ -742,9 +741,8 @@ static void __cold _credit_init_bits(size_t bits)
 		if (system_dfl_wq)
 			queue_work(system_dfl_wq, &set_ready);
 		atomic_notifier_call_chain(&random_ready_notifier, 0, NULL);
-#ifdef CONFIG_VDSO_GETRANDOM
-		WRITE_ONCE(vdso_k_rng_data->is_ready, true);
-#endif
+		if (IS_ENABLED(CONFIG_VDSO_GETRANDOM))
+			WRITE_ONCE(vdso_k_rng_data->is_ready, true);
 		wake_up_interruptible(&crng_init_wait);
 		kill_fasync(&fasync, SIGIO, POLL_IN);
 		pr_notice("crng init done\n");

-- 
2.53.0



^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2026-02-27  6:46 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-27  6:44 [PATCH v2 00/15] vDSO: header file cleanups Thomas Weißschuh
2026-02-27  6:44 ` [PATCH v2 01/15] arm64: vDSO: gettimeofday: Explicitly include vdso/clocksource.h Thomas Weißschuh
2026-02-27  6:44 ` [PATCH v2 02/15] arm64: vDSO: compat_gettimeofday: Add explicit includes Thomas Weißschuh
2026-02-27  6:44 ` [PATCH v2 03/15] ARM: vdso: gettimeofday: " Thomas Weißschuh
2026-02-27  6:44 ` [PATCH v2 04/15] powerpc/vdso/gettimeofday: Explicitly include vdso/time32.h Thomas Weißschuh
2026-02-27  6:44 ` [PATCH v2 05/15] powerpc/vdso: Explicitly include asm/cputable.h and asm/feature-fixups.h Thomas Weißschuh
2026-02-27  6:44 ` [PATCH v2 06/15] LoongArch: vDSO: Explicitly include asm/vdso/vdso.h Thomas Weißschuh
2026-02-27  6:44 ` [PATCH v2 07/15] MIPS: vdso: Add include guard to asm/vdso/vdso.h Thomas Weißschuh
2026-02-27  6:44 ` [PATCH v2 08/15] MIPS: vdso: Explicitly include asm/vdso/vdso.h Thomas Weißschuh
2026-02-27  6:44 ` [PATCH v2 09/15] random: vDSO: add explicit includes Thomas Weißschuh
2026-02-27  6:44 ` [PATCH v2 10/15] vdso/gettimeofday: Add " Thomas Weißschuh
2026-02-27  6:44 ` [PATCH v2 11/15] vdso/helpers: Explicitly include vdso/processor.h Thomas Weißschuh
2026-02-27  6:44 ` [PATCH v2 12/15] vdso/datapage: Remove inclusion of gettimeofday.h Thomas Weißschuh
2026-02-27  6:44 ` [PATCH v2 13/15] vdso/datapage: Trim down unnecessary includes Thomas Weißschuh
2026-02-27  6:44 ` [PATCH v2 14/15] random: vDSO: trim vDSO includes Thomas Weißschuh
2026-02-27  6:44 ` [PATCH v2 15/15] random: vDSO: remove ifdeffery Thomas Weißschuh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox