Various cleanups to the generic vDSO infrastructure and a patch for ARM which was never applied.
This series has one trivial syntactic conflict with "dso/datastore: Allow prefaulting by mlockall()" [0] and a semantic one with "sparc64: vdso: Switch to generic vDSO library" [1], which still uses the removed GENERIC_VDSO_DATA_STORE.
[0] https://lore.kernel.org/lkml/20250812-vdso-mlockall-v1-0-2f49ba7cf819@linutr... [1] https://lore.kernel.org/lkml/20250815-vdso-sparc64-generic-2-v2-0-b5ff806723...
Signed-off-by: Thomas Weißschuh thomas.weissschuh@linutronix.de --- Rasmus Villemoes (1): ARM: VDSO: remove cntvct_ok global variable
Thomas Weißschuh (10): vdso/datastore: Gate time data behind CONFIG_GENERIC_GETTIMEOFDAY vdso: Move ENABLE_COMPAT_VDSO from core to arm64 vdso/gettimeofday: Remove !CONFIG_TIME_NS stubs time: Build generic update_vsyscall() only with generic time vDSO riscv: vdso: Untangle kconfig logic vdso: Drop kconfig GENERIC_VDSO_32 vdso: Drop kconfig GENERIC_COMPAT_VDSO vdso: Drop kconfig GENERIC_VDSO_DATA_STORE vdso: Drop kconfig GENERIC_VDSO_TIME_NS vdso: Gate VDSO_GETRANDOM behind HAVE_GENERIC_VDSO
arch/Kconfig | 2 +- arch/arm/include/asm/vdso/vsyscall.h | 2 -- arch/arm/kernel/vdso.c | 10 +++------ arch/arm/mm/Kconfig | 2 -- arch/arm64/Kconfig | 3 --- arch/arm64/include/asm/vdso/compat_barrier.h | 7 +++--- arch/arm64/include/asm/vdso/compat_gettimeofday.h | 6 ++--- arch/arm64/include/asm/vdso/gettimeofday.h | 8 +++++++ arch/arm64/kernel/vdso32/Makefile | 1 - arch/loongarch/Kconfig | 2 -- arch/mips/Kconfig | 1 - arch/powerpc/Kconfig | 2 -- arch/riscv/Kconfig | 12 +++++----- arch/s390/Kconfig | 2 -- arch/x86/Kconfig | 3 --- include/asm-generic/vdso/vsyscall.h | 4 ---- include/vdso/datapage.h | 9 +------- init/Kconfig | 2 +- kernel/time/Makefile | 2 +- lib/vdso/Kconfig | 25 +-------------------- lib/vdso/Makefile | 2 +- lib/vdso/datastore.c | 6 ++--- lib/vdso/gettimeofday.c | 27 ----------------------- tools/testing/selftests/pidfd/config | 1 - 24 files changed, 31 insertions(+), 110 deletions(-) --- base-commit: 3cd1f6bc6aa056cfd32946f9ce0aa3eb3db180e8 change-id: 20250825-vdso-cleanups-fd6fbb32fc19
Best regards,
When the generic vDSO does not provide time functions, as for example on riscv32, then the time data store is not necessary.
Avoid allocating these time data pages when not used.
Fixes: df7fcbefa710 ("vdso: Add generic time data storage") Signed-off-by: Thomas Weißschuh thomas.weissschuh@linutronix.de --- lib/vdso/datastore.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/vdso/datastore.c b/lib/vdso/datastore.c index 3693c6caf2c4d41a526613d5fb746cb3a981ea2e..a565c30c71a04ff4116c14f43f4450210eba99c5 100644 --- a/lib/vdso/datastore.c +++ b/lib/vdso/datastore.c @@ -11,14 +11,14 @@ /* * The vDSO data page. */ -#ifdef CONFIG_HAVE_GENERIC_VDSO +#ifdef CONFIG_GENERIC_GETTIMEOFDAY static union { struct vdso_time_data data; u8 page[PAGE_SIZE]; } vdso_time_data_store __page_aligned_data; struct vdso_time_data *vdso_k_time_data = &vdso_time_data_store.data; static_assert(sizeof(vdso_time_data_store) == PAGE_SIZE); -#endif /* CONFIG_HAVE_GENERIC_VDSO */ +#endif /* CONFIG_GENERIC_GETTIMEOFDAY */
#ifdef CONFIG_VDSO_GETRANDOM static union { @@ -46,7 +46,7 @@ static vm_fault_t vvar_fault(const struct vm_special_mapping *sm,
switch (vmf->pgoff) { case VDSO_TIME_PAGE_OFFSET: - if (!IS_ENABLED(CONFIG_HAVE_GENERIC_VDSO)) + if (!IS_ENABLED(CONFIG_GENERIC_GETTIMEOFDAY)) return VM_FAULT_SIGBUS; pfn = __phys_to_pfn(__pa_symbol(vdso_k_time_data)); if (timens_page) {
From: Rasmus Villemoes linux@rasmusvillemoes.dk
The cntvct_ok variable has not had any external user since commit c7a18100bdff ("lib/vdso: Avoid highres update if clocksource is not VDSO capable").
It also only has one user in vdso.c, once during init, so rather than having the caller of patch_vdso() initialize cntvct_ok, just call cntvct_functional() directly and avoid the global variable entirely.
Signed-off-by: Rasmus Villemoes linux@rasmusvillemoes.dk Reviewed-by: Vincenzo Frascino vincenzo.frascino@arm.com --- arch/arm/include/asm/vdso/vsyscall.h | 2 -- arch/arm/kernel/vdso.c | 10 +++------- 2 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/arch/arm/include/asm/vdso/vsyscall.h b/arch/arm/include/asm/vdso/vsyscall.h index 4e7226ad02ec4dcf88203c9046e1b320a10e7373..ff1c729af05f03ac5db86c28276db2e4a31c775c 100644 --- a/arch/arm/include/asm/vdso/vsyscall.h +++ b/arch/arm/include/asm/vdso/vsyscall.h @@ -7,8 +7,6 @@ #include <vdso/datapage.h> #include <asm/cacheflush.h>
-extern bool cntvct_ok; - static __always_inline void __arch_sync_vdso_time_data(struct vdso_time_data *vdata) { diff --git a/arch/arm/kernel/vdso.c b/arch/arm/kernel/vdso.c index 325448ffbba0c29895ea5d97e60d6f51e552cb2e..e38a30477f3d70939f6d57c79fad52eed73c49b4 100644 --- a/arch/arm/kernel/vdso.c +++ b/arch/arm/kernel/vdso.c @@ -54,11 +54,9 @@ struct elfinfo { char *dynstr; /* ptr to .dynstr section */ };
-/* Cached result of boot-time check for whether the arch timer exists, - * and if so, whether the virtual counter is useable. +/* Boot-time check for whether the arch timer exists, and if so, + * whether the virtual counter is usable. */ -bool cntvct_ok __ro_after_init; - static bool __init cntvct_functional(void) { struct device_node *np; @@ -159,7 +157,7 @@ static void __init patch_vdso(void *ehdr) * want programs to incur the slight additional overhead of * dispatching through the VDSO only to fall back to syscalls. */ - if (!cntvct_ok) { + if (!cntvct_functional()) { vdso_nullpatch_one(&einfo, "__vdso_gettimeofday"); vdso_nullpatch_one(&einfo, "__vdso_clock_gettime"); vdso_nullpatch_one(&einfo, "__vdso_clock_gettime64"); @@ -197,8 +195,6 @@ static int __init vdso_init(void) vdso_total_pages = VDSO_NR_PAGES; /* for the data/vvar pages */ vdso_total_pages += text_pages;
- cntvct_ok = cntvct_functional(); - patch_vdso(vdso_start);
return 0;
The ENABLE_COMAPT_VDSO symbol is only used by arm64 and only for the time-related functionality. There should be no new users, so it doesn't need to be in the generic vDSO code.
Move the logic into arm64 architecture-specific code and replace the explicit define by the standard '#ifdef __aarch64__'.
Signed-off-by: Thomas Weißschuh thomas.weissschuh@linutronix.de --- arch/arm64/include/asm/vdso/compat_barrier.h | 7 +++---- arch/arm64/include/asm/vdso/compat_gettimeofday.h | 6 +++--- arch/arm64/include/asm/vdso/gettimeofday.h | 8 ++++++++ arch/arm64/kernel/vdso32/Makefile | 1 - include/vdso/datapage.h | 4 ---- 5 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/arch/arm64/include/asm/vdso/compat_barrier.h b/arch/arm64/include/asm/vdso/compat_barrier.h index 3ac35f4a667cfc8c03fb6b6913c5a02b230a1659..6d75e03d38274a6b8549ab10a0f3c9732e7fae56 100644 --- a/arch/arm64/include/asm/vdso/compat_barrier.h +++ b/arch/arm64/include/asm/vdso/compat_barrier.h @@ -7,11 +7,10 @@
#ifndef __ASSEMBLY__ /* - * Warning: This code is meant to be used with - * ENABLE_COMPAT_VDSO only. + * Warning: This code is meant to be used from the compat vDSO only. */ -#ifndef ENABLE_COMPAT_VDSO -#error This header is meant to be used with ENABLE_COMPAT_VDSO only +#ifdef __arch64__ +#error This header is meant to be used with from the compat vDSO only #endif
#ifdef dmb diff --git a/arch/arm64/include/asm/vdso/compat_gettimeofday.h b/arch/arm64/include/asm/vdso/compat_gettimeofday.h index d60ea7a72a9cb3457c412d0ece21ed76ae77782d..7d1a116549b1b98d6eb7a78d053958c6a71799ec 100644 --- a/arch/arm64/include/asm/vdso/compat_gettimeofday.h +++ b/arch/arm64/include/asm/vdso/compat_gettimeofday.h @@ -2,8 +2,8 @@ /* * Copyright (C) 2018 ARM Limited */ -#ifndef __ASM_VDSO_GETTIMEOFDAY_H -#define __ASM_VDSO_GETTIMEOFDAY_H +#ifndef __ASM_VDSO_COMPAT_GETTIMEOFDAY_H +#define __ASM_VDSO_COMPAT_GETTIMEOFDAY_H
#ifndef __ASSEMBLY__
@@ -163,4 +163,4 @@ static inline bool vdso_clocksource_ok(const struct vdso_clock *vc)
#endif /* !__ASSEMBLY__ */
-#endif /* __ASM_VDSO_GETTIMEOFDAY_H */ +#endif /* __ASM_VDSO_COMPAT_GETTIMEOFDAY_H */ diff --git a/arch/arm64/include/asm/vdso/gettimeofday.h b/arch/arm64/include/asm/vdso/gettimeofday.h index da1ab87595925fdfa74fd10d0c9548f109970588..c59e84105b43cdb0c823da3dd793a83781f84302 100644 --- a/arch/arm64/include/asm/vdso/gettimeofday.h +++ b/arch/arm64/include/asm/vdso/gettimeofday.h @@ -5,6 +5,8 @@ #ifndef __ASM_VDSO_GETTIMEOFDAY_H #define __ASM_VDSO_GETTIMEOFDAY_H
+#ifdef __aarch64__ + #ifndef __ASSEMBLY__
#include <asm/alternative.h> @@ -96,4 +98,10 @@ static __always_inline const struct vdso_time_data *__arch_get_vdso_u_time_data(
#endif /* !__ASSEMBLY__ */
+#else /* !__aarch64__ */ + +#include "compat_gettimeofday.h" + +#endif /* __aarch64__ */ + #endif /* __ASM_VDSO_GETTIMEOFDAY_H */ diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile index f2dfdc7dc8185bc045907283b68ab18fed980312..230fdc26796aa5ba561519bcf2de8ccd7ad3b9f8 100644 --- a/arch/arm64/kernel/vdso32/Makefile +++ b/arch/arm64/kernel/vdso32/Makefile @@ -59,7 +59,6 @@ VDSO_CAFLAGS += -DDISABLE_BRANCH_PROFILING VDSO_CAFLAGS += -march=armv8-a
VDSO_CFLAGS := $(VDSO_CAFLAGS) -VDSO_CFLAGS += -DENABLE_COMPAT_VDSO=1 # KBUILD_CFLAGS from top-level Makefile VDSO_CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ -fno-strict-aliasing -fno-common \ diff --git a/include/vdso/datapage.h b/include/vdso/datapage.h index 02533038640e53c40291c7e09139e0f9b32f502a..0b1982f15de427723c9ff8502ca1eaa195f9a6a1 100644 --- a/include/vdso/datapage.h +++ b/include/vdso/datapage.h @@ -196,11 +196,7 @@ enum vdso_pages { * - clock_gettime_fallback(): fallback for clock_gettime. * - clock_getres_fallback(): fallback for clock_getres. */ -#ifdef ENABLE_COMPAT_VDSO -#include <asm/vdso/compat_gettimeofday.h> -#else #include <asm/vdso/gettimeofday.h> -#endif /* ENABLE_COMPAT_VDSO */
#else /* !__ASSEMBLY__ */
On Tue, Aug 26, 2025 at 08:17:06AM +0200, Thomas Weißschuh wrote:
The ENABLE_COMAPT_VDSO symbol is only used by arm64 and only for the time-related functionality. There should be no new users, so it doesn't need to be in the generic vDSO code.
Move the logic into arm64 architecture-specific code and replace the explicit define by the standard '#ifdef __aarch64__'.
Signed-off-by: Thomas Weißschuh thomas.weissschuh@linutronix.de
Acked-by: Catalin Marinas catalin.marinas@arm.com
All calls of these functions are already gated behind CONFIG_TIME_NS. The compiler will already optimize them away if time namespaces are disabled.
Drop the unnecessary stubs.
Signed-off-by: Thomas Weißschuh thomas.weissschuh@linutronix.de --- lib/vdso/gettimeofday.c | 25 ------------------------- 1 file changed, 25 deletions(-)
diff --git a/lib/vdso/gettimeofday.c b/lib/vdso/gettimeofday.c index 02ea19f671647e9a1b8c3e7ea0cbff33b4024711..1e2a40b8d2c6c2356cfc678a1ea441ec1bad181a 100644 --- a/lib/vdso/gettimeofday.c +++ b/lib/vdso/gettimeofday.c @@ -108,8 +108,6 @@ bool vdso_get_timestamp(const struct vdso_time_data *vd, const struct vdso_clock return true; }
-#ifdef CONFIG_TIME_NS - #ifdef CONFIG_GENERIC_VDSO_DATA_STORE static __always_inline const struct vdso_time_data *__arch_get_vdso_u_timens_data(const struct vdso_time_data *vd) @@ -149,20 +147,6 @@ bool do_hres_timens(const struct vdso_time_data *vdns, const struct vdso_clock *
return true; } -#else -static __always_inline -const struct vdso_time_data *__arch_get_vdso_u_timens_data(const struct vdso_time_data *vd) -{ - return NULL; -} - -static __always_inline -bool do_hres_timens(const struct vdso_time_data *vdns, const struct vdso_clock *vcns, - clockid_t clk, struct __kernel_timespec *ts) -{ - return false; -} -#endif
static __always_inline bool do_hres(const struct vdso_time_data *vd, const struct vdso_clock *vc, @@ -204,7 +188,6 @@ bool do_hres(const struct vdso_time_data *vd, const struct vdso_clock *vc, return true; }
-#ifdef CONFIG_TIME_NS static __always_inline bool do_coarse_timens(const struct vdso_time_data *vdns, const struct vdso_clock *vcns, clockid_t clk, struct __kernel_timespec *ts) @@ -233,14 +216,6 @@ bool do_coarse_timens(const struct vdso_time_data *vdns, const struct vdso_clock
return true; } -#else -static __always_inline -bool do_coarse_timens(const struct vdso_time_data *vdns, const struct vdso_clock *vcns, - clockid_t clk, struct __kernel_timespec *ts) -{ - return false; -} -#endif
static __always_inline bool do_coarse(const struct vdso_time_data *vd, const struct vdso_clock *vc,
The generic vDSO can be used without the time-related functionality. In that case the generic update_vsyscall() from kernel/time/vsyscall.c should not be built.
Signed-off-by: Thomas Weißschuh thomas.weissschuh@linutronix.de --- kernel/time/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/time/Makefile b/kernel/time/Makefile index e6e9b85d4db5f8dd5d9b574ef7bb0a281b9daa6d..f7d52d9543cc7a2d1a18db179229a8d7936317d3 100644 --- a/kernel/time/Makefile +++ b/kernel/time/Makefile @@ -26,7 +26,7 @@ obj-$(CONFIG_LEGACY_TIMER_TICK) += tick-legacy.o ifeq ($(CONFIG_SMP),y) obj-$(CONFIG_NO_HZ_COMMON) += timer_migration.o endif -obj-$(CONFIG_HAVE_GENERIC_VDSO) += vsyscall.o +obj-$(CONFIG_GENERIC_GETTIMEOFDAY) += vsyscall.o obj-$(CONFIG_DEBUG_FS) += timekeeping_debug.o obj-$(CONFIG_TEST_UDELAY) += test_udelay.o obj-$(CONFIG_TIME_NS) += namespace.o
On riscv32 the generic vDSO infrastructure is used but without its time-related functionality. The kconfig logic to implement this treats HAVE_GENERIC_VDSO as a synonym for GENERIC_GETTIMEOFDAY. This works today due to some underlying issues in how the generic vDSO library works. Some future cleanups will break this logic.
Restructure the kconfig logic, so HAVE_GENERIC_VDSO refers to the generic library in general and GENERIC_GETTIMEOFDAY refers to its time-related functionality.
Signed-off-by: Thomas Weißschuh thomas.weissschuh@linutronix.de --- arch/riscv/Kconfig | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index a4b233a0659ed80c0eb6b118ea8c8db81ed3fdba..e4ac0e833ecfdb976134e9009a2cdfdea789f13d 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -52,7 +52,7 @@ config RISCV select ARCH_HAS_SYSCALL_WRAPPER select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST select ARCH_HAS_UBSAN - select ARCH_HAS_VDSO_ARCH_DATA if GENERIC_VDSO_DATA_STORE + select ARCH_HAS_VDSO_ARCH_DATA if HAVE_GENERIC_VDSO select ARCH_KEEP_MEMBLOCK if ACPI select ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE if 64BIT && MMU select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX @@ -107,7 +107,7 @@ config RISCV select GENERIC_CPU_VULNERABILITIES select GENERIC_EARLY_IOREMAP select GENERIC_ENTRY - select GENERIC_GETTIMEOFDAY if HAVE_GENERIC_VDSO + select GENERIC_GETTIMEOFDAY if HAVE_GENERIC_VDSO && 64BIT select GENERIC_IDLE_POLL_SETUP select GENERIC_IOREMAP if MMU select GENERIC_IRQ_IPI if SMP @@ -120,9 +120,9 @@ config RISCV select GENERIC_PCI_IOMAP select GENERIC_SCHED_CLOCK select GENERIC_SMP_IDLE_THREAD - select GENERIC_TIME_VSYSCALL if MMU && 64BIT - select GENERIC_VDSO_DATA_STORE if MMU - select GENERIC_VDSO_TIME_NS if HAVE_GENERIC_VDSO + select GENERIC_TIME_VSYSCALL if GENERIC_GETTIMEOFDAY + select GENERIC_VDSO_DATA_STORE if HAVE_GENERIC_VDSO + select GENERIC_VDSO_TIME_NS if GENERIC_GETTIMEOFDAY select HARDIRQS_SW_RESEND select HAS_IOPORT if MMU select HAVE_ALIGNED_STRUCT_PAGE @@ -165,7 +165,7 @@ config RISCV select HAVE_FUNCTION_ARG_ACCESS_API select HAVE_FUNCTION_ERROR_INJECTION select HAVE_GCC_PLUGINS - select HAVE_GENERIC_VDSO if MMU && 64BIT + select HAVE_GENERIC_VDSO if MMU select HAVE_IRQ_TIME_ACCOUNTING select HAVE_KERNEL_BZIP2 if !XIP_KERNEL && !EFI_ZBOOT select HAVE_KERNEL_GZIP if !XIP_KERNEL && !EFI_ZBOOT @@ -221,7 +221,7 @@ config RISCV select THREAD_INFO_IN_TASK select TRACE_IRQFLAGS_SUPPORT select UACCESS_MEMCPY if !MMU - select VDSO_GETRANDOM if HAVE_GENERIC_VDSO + select VDSO_GETRANDOM if HAVE_GENERIC_VDSO && 64BIT select USER_STACKTRACE_SUPPORT select ZONE_DMA32 if 64BIT
This configuration is never used.
Remove it.
Signed-off-by: Thomas Weißschuh thomas.weissschuh@linutronix.de --- arch/arm/mm/Kconfig | 1 - arch/x86/Kconfig | 1 - lib/vdso/Kconfig | 7 ------- 3 files changed, 9 deletions(-)
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig index 5c1023a6d78c1b4db67b2d62b71af5a79b7e701f..2347988cf6417b91d8d3580387b53e610ed49a00 100644 --- a/arch/arm/mm/Kconfig +++ b/arch/arm/mm/Kconfig @@ -926,7 +926,6 @@ config VDSO default y if ARM_ARCH_TIMER select HAVE_GENERIC_VDSO select GENERIC_TIME_VSYSCALL - select GENERIC_VDSO_32 select GENERIC_GETTIMEOFDAY select GENERIC_VDSO_DATA_STORE help diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 58d890fe2100eb6990880bcf5ba600cdefb0a7d1..4f120070a51bd4e225256440649a2dae17025c41 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -14,7 +14,6 @@ config X86_32 select ARCH_WANT_IPC_PARSE_VERSION select CLKSRC_I8253 select CLONE_BACKWARDS - select GENERIC_VDSO_32 select HAVE_DEBUG_STACKOVERFLOW select KMAP_LOCAL select MODULES_USE_ELF_REL diff --git a/lib/vdso/Kconfig b/lib/vdso/Kconfig index 45df764b49ad62479e6456e00c053e46131936a3..76157c26931d28327750ad53bfcae5109a29d998 100644 --- a/lib/vdso/Kconfig +++ b/lib/vdso/Kconfig @@ -12,13 +12,6 @@ config GENERIC_GETTIMEOFDAY Each architecture that enables this feature has to provide the fallback implementation.
-config GENERIC_VDSO_32 - bool - depends on GENERIC_GETTIMEOFDAY && !64BIT - help - This config option helps to avoid possible performance issues - in 32 bit only architectures. - config GENERIC_COMPAT_VDSO bool help
This configuration is never used.
Remove it.
Signed-off-by: Thomas Weißschuh thomas.weissschuh@linutronix.de --- arch/arm64/Kconfig | 1 - lib/vdso/Kconfig | 5 ----- 2 files changed, 6 deletions(-)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index e9bbfacc35a64d7ef1793a5d7f7ff8db138f2814..5c61b19ea9c80559ca3c4d1aa0732c6126494cb0 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -1782,7 +1782,6 @@ config COMPAT_VDSO bool "Enable vDSO for 32-bit applications" depends on !CPU_BIG_ENDIAN depends on (CC_IS_CLANG && LD_IS_LLD) || "$(CROSS_COMPILE_COMPAT)" != "" - select GENERIC_COMPAT_VDSO default y help Place in the process address space of 32-bit applications an diff --git a/lib/vdso/Kconfig b/lib/vdso/Kconfig index 76157c26931d28327750ad53bfcae5109a29d998..2594dd7185be762a4a94aa38ecec5db016776f85 100644 --- a/lib/vdso/Kconfig +++ b/lib/vdso/Kconfig @@ -12,11 +12,6 @@ config GENERIC_GETTIMEOFDAY Each architecture that enables this feature has to provide the fallback implementation.
-config GENERIC_COMPAT_VDSO - bool - help - This config option enables the compat VDSO layer. - config GENERIC_VDSO_TIME_NS bool help
On Tue, Aug 26, 2025 at 08:17:11AM +0200, Thomas Weißschuh wrote:
This configuration is never used.
Remove it.
Signed-off-by: Thomas Weißschuh thomas.weissschuh@linutronix.de
arch/arm64/Kconfig | 1 - lib/vdso/Kconfig | 5 ----- 2 files changed, 6 deletions(-)
Acked-by: Catalin Marinas catalin.marinas@arm.com
All users of the generic vDSO library also use the generic vDSO datastore.
Remove the now unnecessary kconfig symbol.
Signed-off-by: Thomas Weißschuh thomas.weissschuh@linutronix.de --- arch/Kconfig | 2 +- arch/arm/mm/Kconfig | 1 - arch/arm64/Kconfig | 1 - arch/loongarch/Kconfig | 1 - arch/mips/Kconfig | 1 - arch/powerpc/Kconfig | 1 - arch/riscv/Kconfig | 1 - arch/s390/Kconfig | 1 - arch/x86/Kconfig | 1 - include/asm-generic/vdso/vsyscall.h | 4 ---- include/vdso/datapage.h | 5 +---- lib/vdso/Kconfig | 5 ----- lib/vdso/Makefile | 2 +- lib/vdso/gettimeofday.c | 2 -- 14 files changed, 3 insertions(+), 25 deletions(-)
diff --git a/arch/Kconfig b/arch/Kconfig index d1b4ffd6e085644defd780c1d3aaf6ac53a65055..f6ca7f3031726ee28ebdf9d7874184d7130afce5 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -1609,7 +1609,7 @@ config HAVE_SPARSE_SYSCALL_NR related optimizations for a given architecture.
config ARCH_HAS_VDSO_ARCH_DATA - depends on GENERIC_VDSO_DATA_STORE + depends on HAVE_GENERIC_VDSO bool
config ARCH_HAS_VDSO_TIME_DATA diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig index 2347988cf6417b91d8d3580387b53e610ed49a00..7b27ee9482b3eb34286935eddda136affc5084a7 100644 --- a/arch/arm/mm/Kconfig +++ b/arch/arm/mm/Kconfig @@ -927,7 +927,6 @@ config VDSO select HAVE_GENERIC_VDSO select GENERIC_TIME_VSYSCALL select GENERIC_GETTIMEOFDAY - select GENERIC_VDSO_DATA_STORE help Place in the process address space an ELF shared object providing fast implementations of gettimeofday and diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 5c61b19ea9c80559ca3c4d1aa0732c6126494cb0..b0f007b396c81906d3a0a66f8a240d97e0ae2d88 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -162,7 +162,6 @@ config ARM64 select GENERIC_SMP_IDLE_THREAD select GENERIC_TIME_VSYSCALL select GENERIC_GETTIMEOFDAY - select GENERIC_VDSO_DATA_STORE select GENERIC_VDSO_TIME_NS select HARDIRQS_SW_RESEND select HAS_IOPORT diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig index f0abc38c40ac9ea3026d8e19a851cd31bb5faa9f..d15b201d55f951d95435a38789cf47ea9f0adac9 100644 --- a/arch/loongarch/Kconfig +++ b/arch/loongarch/Kconfig @@ -108,7 +108,6 @@ config LOONGARCH select GENERIC_SCHED_CLOCK select GENERIC_SMP_IDLE_THREAD select GENERIC_TIME_VSYSCALL - select GENERIC_VDSO_DATA_STORE select GENERIC_VDSO_TIME_NS select GPIOLIB select HAS_IOPORT diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index caf508f6e9ec8e725a73f2027d1fc29c8cf808a5..f7e6bbd755e0ed15e408e90a7974d3b161956446 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -51,7 +51,6 @@ config MIPS select GENERIC_SMP_IDLE_THREAD select GENERIC_IDLE_POLL_SETUP select GENERIC_TIME_VSYSCALL - select GENERIC_VDSO_DATA_STORE select GUP_GET_PXX_LOW_HIGH if CPU_MIPS32 && PHYS_ADDR_T_64BIT select HAS_IOPORT if !NO_IOPORT_MAP || ISA select HAVE_ARCH_COMPILER_H diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 93402a1d9c9fc63e2795cf53c5acb248e0358591..78c82af955616c57ab38ea1241e3471eb8d0a65d 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -207,7 +207,6 @@ config PPC select GENERIC_PCI_IOMAP if PCI select GENERIC_SMP_IDLE_THREAD select GENERIC_TIME_VSYSCALL - select GENERIC_VDSO_DATA_STORE select GENERIC_VDSO_TIME_NS select HAS_IOPORT if PCI select HAVE_ARCH_AUDITSYSCALL diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index e4ac0e833ecfdb976134e9009a2cdfdea789f13d..f6cf9180ccf2c9774248fea93a8276de3791ad71 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -121,7 +121,6 @@ config RISCV select GENERIC_SCHED_CLOCK select GENERIC_SMP_IDLE_THREAD select GENERIC_TIME_VSYSCALL if GENERIC_GETTIMEOFDAY - select GENERIC_VDSO_DATA_STORE if HAVE_GENERIC_VDSO select GENERIC_VDSO_TIME_NS if GENERIC_GETTIMEOFDAY select HARDIRQS_SW_RESEND select HAS_IOPORT if MMU diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index bf680c26a33cf7bef2ed5e25cabc061597c131b1..696d2243d64b04e77b9b4631fc8bc301916b48ae 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -167,7 +167,6 @@ config S390 select GENERIC_GETTIMEOFDAY select GENERIC_SMP_IDLE_THREAD select GENERIC_TIME_VSYSCALL - select GENERIC_VDSO_DATA_STORE select GENERIC_VDSO_TIME_NS select GENERIC_IOREMAP if PCI select HAVE_ALIGNED_STRUCT_PAGE diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 4f120070a51bd4e225256440649a2dae17025c41..1e74b2a356e42bdc0ede258f44e18ba29dd90174 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -181,7 +181,6 @@ config X86 select GENERIC_SMP_IDLE_THREAD select GENERIC_TIME_VSYSCALL select GENERIC_GETTIMEOFDAY - select GENERIC_VDSO_DATA_STORE select GENERIC_VDSO_TIME_NS select GENERIC_VDSO_OVERFLOW_PROTECT select GUP_GET_PXX_LOW_HIGH if X86_PAE diff --git a/include/asm-generic/vdso/vsyscall.h b/include/asm-generic/vdso/vsyscall.h index 7fc0b560007dd8f09a2f24ace76ce68579ad17c1..5c6d9799f4e746cc9f0d46a0744c6dcc30fec587 100644 --- a/include/asm-generic/vdso/vsyscall.h +++ b/include/asm-generic/vdso/vsyscall.h @@ -4,8 +4,6 @@
#ifndef __ASSEMBLY__
-#ifdef CONFIG_GENERIC_VDSO_DATA_STORE - #ifndef __arch_get_vdso_u_time_data static __always_inline const struct vdso_time_data *__arch_get_vdso_u_time_data(void) { @@ -20,8 +18,6 @@ static __always_inline const struct vdso_rng_data *__arch_get_vdso_u_rng_data(vo } #endif
-#endif /* CONFIG_GENERIC_VDSO_DATA_STORE */ - #ifndef __arch_update_vdso_clock static __always_inline void __arch_update_vdso_clock(struct vdso_clock *vc) { diff --git a/include/vdso/datapage.h b/include/vdso/datapage.h index 0b1982f15de427723c9ff8502ca1eaa195f9a6a1..23c39b96190fdfc2f31bf76a8614d69a3a98017c 100644 --- a/include/vdso/datapage.h +++ b/include/vdso/datapage.h @@ -31,7 +31,7 @@ struct arch_vdso_time_data {};
#if defined(CONFIG_ARCH_HAS_VDSO_ARCH_DATA) #include <asm/vdso/arch_data.h> -#elif defined(CONFIG_GENERIC_VDSO_DATA_STORE) +#else struct vdso_arch_data { /* Needed for the generic code, never actually used at runtime */ char __unused; @@ -164,7 +164,6 @@ struct vdso_rng_data { * With the hidden visibility, the compiler simply generates a PC-relative * relocation, and this is what we need. */ -#ifdef CONFIG_GENERIC_VDSO_DATA_STORE extern struct vdso_time_data vdso_u_time_data __attribute__((visibility("hidden"))); extern struct vdso_rng_data vdso_u_rng_data __attribute__((visibility("hidden"))); extern struct vdso_arch_data vdso_u_arch_data __attribute__((visibility("hidden"))); @@ -185,8 +184,6 @@ enum vdso_pages { VDSO_NR_PAGES };
-#endif /* CONFIG_GENERIC_VDSO_DATA_STORE */ - /* * The generic vDSO implementation requires that gettimeofday.h * provides: diff --git a/lib/vdso/Kconfig b/lib/vdso/Kconfig index 2594dd7185be762a4a94aa38ecec5db016776f85..48ffb0f6fa413ea7da4e43c7f7a24cb232b38ea1 100644 --- a/lib/vdso/Kconfig +++ b/lib/vdso/Kconfig @@ -31,8 +31,3 @@ config VDSO_GETRANDOM bool help Selected by architectures that support vDSO getrandom(). - -config GENERIC_VDSO_DATA_STORE - bool - help - Selected by architectures that use the generic vDSO data store. diff --git a/lib/vdso/Makefile b/lib/vdso/Makefile index aedd40aaa950c86f1454d095d9d46992b0cc0abd..405f743253d72b8a40c45b7dc8bec347d9e5c8eb 100644 --- a/lib/vdso/Makefile +++ b/lib/vdso/Makefile @@ -1,3 +1,3 @@ # SPDX-License-Identifier: GPL-2.0-only
-obj-$(CONFIG_GENERIC_VDSO_DATA_STORE) += datastore.o +obj-$(CONFIG_HAVE_GENERIC_VDSO) += datastore.o diff --git a/lib/vdso/gettimeofday.c b/lib/vdso/gettimeofday.c index 1e2a40b8d2c6c2356cfc678a1ea441ec1bad181a..95df0153f05ab41c871755e005762f3442ff3ecd 100644 --- a/lib/vdso/gettimeofday.c +++ b/lib/vdso/gettimeofday.c @@ -108,13 +108,11 @@ bool vdso_get_timestamp(const struct vdso_time_data *vd, const struct vdso_clock return true; }
-#ifdef CONFIG_GENERIC_VDSO_DATA_STORE static __always_inline const struct vdso_time_data *__arch_get_vdso_u_timens_data(const struct vdso_time_data *vd) { return (void *)vd + PAGE_SIZE; } -#endif /* CONFIG_GENERIC_VDSO_DATA_STORE */
static __always_inline bool do_hres_timens(const struct vdso_time_data *vdns, const struct vdso_clock *vcns,
On Tue, Aug 26, 2025 at 08:17:12AM +0200, Thomas Weißschuh wrote:
All users of the generic vDSO library also use the generic vDSO datastore.
Remove the now unnecessary kconfig symbol.
Signed-off-by: Thomas Weißschuh thomas.weissschuh@linutronix.de
arch/Kconfig | 2 +- arch/arm/mm/Kconfig | 1 - arch/arm64/Kconfig | 1 -
Acked-by: Catalin Marinas catalin.marinas@arm.com
All architectures implementing time-related functionality in the vDSO are using the generic vDSO library which handles time namespaces properly.
Remove the now unnecessary kconfig symbol.
Enables the use of time namespaces on architectures, which use the generic vDSO but did not enable GENERIC_VDSO_TIME_NS, namely MIPS and arm.
Signed-off-by: Thomas Weißschuh thomas.weissschuh@linutronix.de
--- Technically this is still too restrictive, as it prevents architectures without a real vDSO to enable CONFIG_TIME_NS. Right now this restriction only protects the SPARC vDSO. I have patches to drop it completely, as soon as SPARC is usingthe generic vDSO. --- arch/arm64/Kconfig | 1 - arch/loongarch/Kconfig | 1 - arch/powerpc/Kconfig | 1 - arch/riscv/Kconfig | 1 - arch/s390/Kconfig | 1 - arch/x86/Kconfig | 1 - init/Kconfig | 2 +- lib/vdso/Kconfig | 6 ------ tools/testing/selftests/pidfd/config | 1 - 9 files changed, 1 insertion(+), 14 deletions(-)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index b0f007b396c81906d3a0a66f8a240d97e0ae2d88..e19b006842e223441b87370a5ae23756e0e85883 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -162,7 +162,6 @@ config ARM64 select GENERIC_SMP_IDLE_THREAD select GENERIC_TIME_VSYSCALL select GENERIC_GETTIMEOFDAY - select GENERIC_VDSO_TIME_NS select HARDIRQS_SW_RESEND select HAS_IOPORT select HAVE_MOVE_PMD diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig index d15b201d55f951d95435a38789cf47ea9f0adac9..754626b58b929e605d51c441cfa862bd504b5892 100644 --- a/arch/loongarch/Kconfig +++ b/arch/loongarch/Kconfig @@ -108,7 +108,6 @@ config LOONGARCH select GENERIC_SCHED_CLOCK select GENERIC_SMP_IDLE_THREAD select GENERIC_TIME_VSYSCALL - select GENERIC_VDSO_TIME_NS select GPIOLIB select HAS_IOPORT select HAVE_ARCH_AUDITSYSCALL diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 78c82af955616c57ab38ea1241e3471eb8d0a65d..d715e3d65b5c29e0010b0a5e5821aee34e31e176 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -207,7 +207,6 @@ config PPC select GENERIC_PCI_IOMAP if PCI select GENERIC_SMP_IDLE_THREAD select GENERIC_TIME_VSYSCALL - select GENERIC_VDSO_TIME_NS select HAS_IOPORT if PCI select HAVE_ARCH_AUDITSYSCALL select HAVE_ARCH_HUGE_VMALLOC if HAVE_ARCH_HUGE_VMAP diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index f6cf9180ccf2c9774248fea93a8276de3791ad71..6e5efbeb83d7f0fe556bc04ec9f58b80d2780b43 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -121,7 +121,6 @@ config RISCV select GENERIC_SCHED_CLOCK select GENERIC_SMP_IDLE_THREAD select GENERIC_TIME_VSYSCALL if GENERIC_GETTIMEOFDAY - select GENERIC_VDSO_TIME_NS if GENERIC_GETTIMEOFDAY select HARDIRQS_SW_RESEND select HAS_IOPORT if MMU select HAVE_ALIGNED_STRUCT_PAGE diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 696d2243d64b04e77b9b4631fc8bc301916b48ae..e06ebbd860da93a8c838113c3c1b946d51dfe1b4 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -167,7 +167,6 @@ config S390 select GENERIC_GETTIMEOFDAY select GENERIC_SMP_IDLE_THREAD select GENERIC_TIME_VSYSCALL - select GENERIC_VDSO_TIME_NS select GENERIC_IOREMAP if PCI select HAVE_ALIGNED_STRUCT_PAGE select HAVE_ARCH_AUDITSYSCALL diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 1e74b2a356e42bdc0ede258f44e18ba29dd90174..d1961811e291e8adcf0b46fafbd53f0a44b5d25b 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -181,7 +181,6 @@ config X86 select GENERIC_SMP_IDLE_THREAD select GENERIC_TIME_VSYSCALL select GENERIC_GETTIMEOFDAY - select GENERIC_VDSO_TIME_NS select GENERIC_VDSO_OVERFLOW_PROTECT select GUP_GET_PXX_LOW_HIGH if X86_PAE select HARDIRQS_SW_RESEND diff --git a/init/Kconfig b/init/Kconfig index 83632025121937527523f5977a493bd3ae24ed9f..5c429a184d1b0550dda9f075ffcbffb68c6d8f50 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -1346,7 +1346,7 @@ config UTS_NS
config TIME_NS bool "TIME namespace" - depends on GENERIC_VDSO_TIME_NS + depends on GENERIC_GETTIMEOFDAY default y help In this namespace boottime and monotonic clocks can be set. diff --git a/lib/vdso/Kconfig b/lib/vdso/Kconfig index 48ffb0f6fa413ea7da4e43c7f7a24cb232b38ea1..3d2c2b90d193f984e3a202e701fa7f0bfa8f1938 100644 --- a/lib/vdso/Kconfig +++ b/lib/vdso/Kconfig @@ -12,12 +12,6 @@ config GENERIC_GETTIMEOFDAY Each architecture that enables this feature has to provide the fallback implementation.
-config GENERIC_VDSO_TIME_NS - bool - help - Selected by architectures which support time namespaces in the - VDSO - config GENERIC_VDSO_OVERFLOW_PROTECT bool help diff --git a/tools/testing/selftests/pidfd/config b/tools/testing/selftests/pidfd/config index 6133524710f790c1f83af6f2b628de9b62eee6c3..cf7cc0ce02484e91799b7cb132447283f818d729 100644 --- a/tools/testing/selftests/pidfd/config +++ b/tools/testing/selftests/pidfd/config @@ -4,6 +4,5 @@ CONFIG_USER_NS=y CONFIG_PID_NS=y CONFIG_NET_NS=y CONFIG_TIME_NS=y -CONFIG_GENERIC_VDSO_TIME_NS=y CONFIG_CGROUPS=y CONFIG_CHECKPOINT_RESTORE=y
On Tue, Aug 26, 2025 at 08:17:13AM +0200, Thomas Weißschuh wrote:
All architectures implementing time-related functionality in the vDSO are using the generic vDSO library which handles time namespaces properly.
Remove the now unnecessary kconfig symbol.
Enables the use of time namespaces on architectures, which use the generic vDSO but did not enable GENERIC_VDSO_TIME_NS, namely MIPS and arm.
Signed-off-by: Thomas Weißschuh thomas.weissschuh@linutronix.de
Technically this is still too restrictive, as it prevents architectures without a real vDSO to enable CONFIG_TIME_NS. Right now this restriction only protects the SPARC vDSO. I have patches to drop it completely, as soon as SPARC is usingthe generic vDSO.
arch/arm64/Kconfig | 1 -
Acked-by: Catalin Marinas catalin.marinas@arm.com
All architectures which want to implement getrandom() in the vDSO need to use the generic vDSO library.
Signed-off-by: Thomas Weißschuh thomas.weissschuh@linutronix.de --- lib/vdso/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/vdso/Kconfig b/lib/vdso/Kconfig index 3d2c2b90d193f984e3a202e701fa7f0bfa8f1938..db87ba34ef1928fac0d5c58abca86312687cc159 100644 --- a/lib/vdso/Kconfig +++ b/lib/vdso/Kconfig @@ -19,9 +19,9 @@ config GENERIC_VDSO_OVERFLOW_PROTECT time getter functions for the price of an extra conditional in the hotpath.
-endif - config VDSO_GETRANDOM bool help Selected by architectures that support vDSO getrandom(). + +endif
linux-kselftest-mirror@lists.linaro.org