From 91d2a1a916a96bc0ed542704c4e20a84ff2cf554 Mon Sep 17 00:00:00 2001 From: Thomas Weißschuh Date: Tue, 19 May 2026 08:26:15 +0200 Subject: riscv: vdso: Drop CONFIG_GENERIC_TIME_VSYSCALL guard around syscall fallbacks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The syscall definitions can be built just fine for 32-bit systems. Also the guard does not cover __arch_get_hw_counter() which is always used together with those system call fallbacks. Also this header is unused when no vDSO is built anyways. Drop the ifdeffery. The logic will be simpler to understand. Furthermore this prepares the complete removal of CONFIG_GENERIC_TIME_VSYSCALL. Signed-off-by: Thomas Weißschuh Signed-off-by: Thomas Gleixner Link: https://patch.msgid.link/20260519-vdso-generic_time_vsyscal-v1-1-5c2a5905d5f5@linutronix.de --- arch/riscv/include/asm/vdso/gettimeofday.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/arch/riscv/include/asm/vdso/gettimeofday.h b/arch/riscv/include/asm/vdso/gettimeofday.h index 9ec08fa04d35..61cb3cbab143 100644 --- a/arch/riscv/include/asm/vdso/gettimeofday.h +++ b/arch/riscv/include/asm/vdso/gettimeofday.h @@ -9,12 +9,6 @@ #include #include -/* - * 32-bit land is lacking generic time vsyscalls as well as the legacy 32-bit - * time syscalls like gettimeofday. Skip these definitions since on 32-bit. - */ -#ifdef CONFIG_GENERIC_TIME_VSYSCALL - #define VDSO_HAS_CLOCK_GETRES 1 static __always_inline @@ -66,8 +60,6 @@ int clock_getres_fallback(clockid_t _clkid, struct __kernel_timespec *_ts) return ret; } -#endif /* CONFIG_GENERIC_TIME_VSYSCALL */ - static __always_inline u64 __arch_get_hw_counter(s32 clock_mode, const struct vdso_time_data *vd) { -- cgit v1.2.3 From bf8f968a63159661acc20254ccdf0dc3c9f1bac2 Mon Sep 17 00:00:00 2001 From: Thomas Weißschuh Date: Tue, 19 May 2026 08:26:16 +0200 Subject: vdso/vsyscall: Gate update_vsyscall() behind CONFIG_GENERIC_GETTIMEOFDAY MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both the compilation of kernel/time/vsyscall.c, which contains the real definition of update_vsyscall() and the other vDSO definitions in timekeeper_internal.h use CONFIG_GENERIC_GETTIMEOFDAY and not CONFIG_GENERIC_TIME_VSYSCALL. Align the code to use a single Kconfig symbol. Signed-off-by: Thomas Weißschuh Signed-off-by: Thomas Gleixner Link: https://patch.msgid.link/20260519-vdso-generic_time_vsyscal-v1-2-5c2a5905d5f5@linutronix.de --- include/linux/timekeeper_internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/timekeeper_internal.h b/include/linux/timekeeper_internal.h index e36d11e33e0c..4486dfd5d0de 100644 --- a/include/linux/timekeeper_internal.h +++ b/include/linux/timekeeper_internal.h @@ -190,7 +190,7 @@ struct timekeeper { s32 tai_offset; }; -#ifdef CONFIG_GENERIC_TIME_VSYSCALL +#ifdef CONFIG_GENERIC_GETTIMEOFDAY extern void update_vsyscall(struct timekeeper *tk); extern void update_vsyscall_tz(void); -- cgit v1.2.3 From 96942092d5e67c71af246fa3bc1422cdf80a5dc9 Mon Sep 17 00:00:00 2001 From: Thomas Weißschuh Date: Tue, 19 May 2026 08:26:17 +0200 Subject: vdso/treewide: Drop GENERIC_TIME_VSYSCALL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This Kconfig symbol is not used anymore, remove it. Signed-off-by: Thomas Weißschuh Signed-off-by: Thomas Gleixner Link: https://patch.msgid.link/20260519-vdso-generic_time_vsyscal-v1-3-5c2a5905d5f5@linutronix.de --- 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/sparc/Kconfig | 1 - arch/x86/Kconfig | 1 - kernel/time/Kconfig | 4 ---- 10 files changed, 13 deletions(-) diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig index 7b27ee9482b3..871bd58d2ccc 100644 --- a/arch/arm/mm/Kconfig +++ b/arch/arm/mm/Kconfig @@ -925,7 +925,6 @@ config VDSO depends on AEABI && MMU && CPU_V7 default y if ARM_ARCH_TIMER select HAVE_GENERIC_VDSO - select GENERIC_TIME_VSYSCALL select GENERIC_GETTIMEOFDAY help Place in the process address space an ELF shared object diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index fe60738e5943..7e331b4f480a 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -140,7 +140,6 @@ config ARM64 select GENERIC_PCI_IOMAP select GENERIC_SCHED_CLOCK select GENERIC_SMP_IDLE_THREAD - select GENERIC_TIME_VSYSCALL select GENERIC_GETTIMEOFDAY select HARDIRQS_SW_RESEND select HAS_IOPORT diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig index 606597da46b8..3f69c5d7e48e 100644 --- a/arch/loongarch/Kconfig +++ b/arch/loongarch/Kconfig @@ -110,7 +110,6 @@ config LOONGARCH select GENERIC_PCI_IOMAP select GENERIC_SCHED_CLOCK select GENERIC_SMP_IDLE_THREAD - select GENERIC_TIME_VSYSCALL if GENERIC_GETTIMEOFDAY select GPIOLIB select HAS_IOPORT select HAVE_ALIGNED_STRUCT_PAGE if 64BIT diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 4364f3dba688..3249880650da 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -51,7 +51,6 @@ config MIPS select GENERIC_SCHED_CLOCK if !CAVIUM_OCTEON_SOC select GENERIC_SMP_IDLE_THREAD select GENERIC_IDLE_POLL_SETUP - select GENERIC_TIME_VSYSCALL 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 e93df95b79e7..c99fd8335ddc 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -213,7 +213,6 @@ config PPC select GENERIC_IRQ_SHOW_LEVEL select GENERIC_PCI_IOMAP if PCI select GENERIC_SMP_IDLE_THREAD - select GENERIC_TIME_VSYSCALL 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 c5754942cf85..195ebc21049a 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -123,7 +123,6 @@ config RISCV select GENERIC_PCI_IOMAP select GENERIC_SCHED_CLOCK select GENERIC_SMP_IDLE_THREAD - select GENERIC_TIME_VSYSCALL 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 ecbcbb781e40..2a5e78465fb8 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -177,7 +177,6 @@ config S390 select GENERIC_ENTRY select GENERIC_GETTIMEOFDAY select GENERIC_SMP_IDLE_THREAD - select GENERIC_TIME_VSYSCALL select GENERIC_IOREMAP if PCI select HAVE_ALIGNED_STRUCT_PAGE select HAVE_ARCH_AUDITSYSCALL diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index a6b787efc2c4..f83d5065c3cf 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -103,7 +103,6 @@ config SPARC64 select HAVE_REGS_AND_STACK_ACCESS_API select ARCH_USE_QUEUED_RWLOCKS select ARCH_USE_QUEUED_SPINLOCKS - select GENERIC_TIME_VSYSCALL select ARCH_HAS_PTE_SPECIAL select PCI_DOMAINS if PCI select ARCH_HAS_GIGANTIC_PAGE diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index f3f7cb01d69d..43d8105068f4 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -180,7 +180,6 @@ config X86 select GENERIC_IRQ_SHOW select GENERIC_PENDING_IRQ if SMP select GENERIC_SMP_IDLE_THREAD - select GENERIC_TIME_VSYSCALL select GENERIC_GETTIMEOFDAY select GENERIC_VDSO_OVERFLOW_PROTECT select GUP_GET_PXX_LOW_HIGH if X86_PAE diff --git a/kernel/time/Kconfig b/kernel/time/Kconfig index 02aac7c5aa76..d098ac39bde4 100644 --- a/kernel/time/Kconfig +++ b/kernel/time/Kconfig @@ -16,10 +16,6 @@ config ARCH_CLOCKSOURCE_INIT config ARCH_WANTS_CLOCKSOURCE_READ_INLINE bool -# Timekeeping vsyscall support -config GENERIC_TIME_VSYSCALL - bool - # The generic clock events infrastructure config GENERIC_CLOCKEVENTS def_bool !LEGACY_TIMER_TICK -- cgit v1.2.3 From 1d453fff35806b1108ae7709de0521bd42770b13 Mon Sep 17 00:00:00 2001 From: Thomas Weißschuh Date: Tue, 19 May 2026 08:14:20 +0200 Subject: vdso/gettimeofday: Rename __arch_get_vdso_u_timens_data() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Originally this function was supposed to work the same way as __arch_get_vdso_u_time_data() and be overridden on some architectures. However the actually used implementation, which just adds PAGE_SIZE, does not need this override mechanism. Adjust the name to reflect the true nature of the function. Signed-off-by: Thomas Weißschuh Signed-off-by: Thomas Gleixner Link: https://patch.msgid.link/20260519-vdso-arch_get_vdso_u_timens_data-v1-1-43f0d62716e8@linutronix.de --- lib/vdso/gettimeofday.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/vdso/gettimeofday.c b/lib/vdso/gettimeofday.c index da224011fafd..e0f289d3d110 100644 --- a/lib/vdso/gettimeofday.c +++ b/lib/vdso/gettimeofday.c @@ -126,7 +126,7 @@ bool vdso_get_timestamp(const struct vdso_time_data *vd, const struct vdso_clock } static __always_inline -const struct vdso_time_data *__arch_get_vdso_u_timens_data(const struct vdso_time_data *vd) +const struct vdso_time_data *vdso_timens_data(const struct vdso_time_data *vd) { return (void *)vd + PAGE_SIZE; } @@ -135,7 +135,7 @@ 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) { - const struct vdso_time_data *vd = __arch_get_vdso_u_timens_data(vdns); + const struct vdso_time_data *vd = vdso_timens_data(vdns); const struct timens_offset *offs = &vcns->offset[clk]; const struct vdso_clock *vc = vd->clock_data; u32 seq; @@ -191,7 +191,7 @@ 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) { - const struct vdso_time_data *vd = __arch_get_vdso_u_timens_data(vdns); + const struct vdso_time_data *vd = vdso_timens_data(vdns); const struct timens_offset *offs = &vcns->offset[clk]; const struct vdso_clock *vc = vd->clock_data; const struct vdso_timestamp *vdso_ts; @@ -250,7 +250,7 @@ bool do_aux(const struct vdso_time_data *vd, clockid_t clock, struct __kernel_ti do { while (vdso_read_begin_timens(vc, &seq)) { /* Re-read from the real time data page, reload seq by looping */ - vd = __arch_get_vdso_u_timens_data(vd); + vd = vdso_timens_data(vd); vc = &vd->aux_clock_data[idx]; } @@ -360,7 +360,7 @@ __cvdso_gettimeofday_data(const struct vdso_time_data *vd, if (unlikely(tz != NULL)) { if (vdso_is_timens_clock(vc)) - vd = __arch_get_vdso_u_timens_data(vd); + vd = vdso_timens_data(vd); tz->tz_minuteswest = vd[CS_HRES_COARSE].tz_minuteswest; tz->tz_dsttime = vd[CS_HRES_COARSE].tz_dsttime; @@ -383,7 +383,7 @@ __cvdso_time_data(const struct vdso_time_data *vd, __kernel_old_time_t *time) __kernel_old_time_t t; if (vdso_is_timens_clock(vc)) { - vd = __arch_get_vdso_u_timens_data(vd); + vd = vdso_timens_data(vd); vc = vd->clock_data; } @@ -414,7 +414,7 @@ bool __cvdso_clock_getres_common(const struct vdso_time_data *vd, clockid_t cloc return false; if (vdso_is_timens_clock(vc)) - vd = __arch_get_vdso_u_timens_data(vd); + vd = vdso_timens_data(vd); /* * Convert the clockid to a bitmask and use it to check which -- cgit v1.2.3 From facdd1b82a41092f7f7c69f2881b946d74ede997 Mon Sep 17 00:00:00 2001 From: Thomas Weißschuh Date: Thu, 21 May 2026 08:53:15 +0200 Subject: MAINTAINERS: Add include/linux/vdso_datastore.h to vDSO block MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This file is part of the generic vDSO subsystem. Signed-off-by: Thomas Weißschuh Signed-off-by: Thomas Gleixner Link: https://patch.msgid.link/20260521-vdso-mips-kconfig-v1-1-2f79dcd6c78f@linutronix.de --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 9ec290e38b44..65b2336f4fae 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -10870,6 +10870,7 @@ L: linux-kernel@vger.kernel.org S: Maintained T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/vdso F: include/asm-generic/vdso/vsyscall.h +F: include/linux/vdso_datastore.h F: include/vdso/ F: kernel/time/namespace_vdso.c F: kernel/time/vsyscall.c -- cgit v1.2.3 From 551f209164c4d2cb8d5542351f145e8257c44702 Mon Sep 17 00:00:00 2001 From: Thomas Weißschuh Date: Thu, 21 May 2026 08:53:16 +0200 Subject: vdso/datastore: Always provide symbol declarations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allow callers to easily reference these symbols in code that is built even when the generic datastore is disabled. As there are no good default no-op variants of these symbols, do not provide stubs but require users to have their own fallback handling using IS_ENABLED(CONFIG_HAVE_GENERIC_VDSO). Signed-off-by: Thomas Weißschuh Signed-off-by: Thomas Gleixner Link: https://patch.msgid.link/20260521-vdso-mips-kconfig-v1-2-2f79dcd6c78f@linutronix.de --- include/linux/vdso_datastore.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/vdso_datastore.h b/include/linux/vdso_datastore.h index 0b530428db71..3dfba9502d78 100644 --- a/include/linux/vdso_datastore.h +++ b/include/linux/vdso_datastore.h @@ -2,12 +2,12 @@ #ifndef _LINUX_VDSO_DATASTORE_H #define _LINUX_VDSO_DATASTORE_H -#ifdef CONFIG_HAVE_GENERIC_VDSO #include extern const struct vm_special_mapping vdso_vvar_mapping; struct vm_area_struct *vdso_install_vvar_mapping(struct mm_struct *mm, unsigned long addr); +#ifdef CONFIG_HAVE_GENERIC_VDSO void __init vdso_setup_data_pages(void); #else /* !CONFIG_HAVE_GENERIC_VDSO */ static inline void vdso_setup_data_pages(void) { } -- cgit v1.2.3 From 60ad2f1158577b4923987f0a410456cfccd0fd23 Mon Sep 17 00:00:00 2001 From: Thomas Weißschuh Date: Thu, 21 May 2026 08:53:17 +0200 Subject: MIPS: Introduce Kconfig MIPS_GENERIC_GETTIMEOFDAY MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The logic to enable the generic vDSO Kconfig symbols is about to become more complex. Introduce a new helper symbol to keep the configuration readable. Signed-off-by: Thomas Weißschuh Signed-off-by: Thomas Gleixner Cc: Thomas Bogendoerfer Link: https://patch.msgid.link/20260521-vdso-mips-kconfig-v1-3-2f79dcd6c78f@linutronix.de --- arch/mips/Kconfig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 3249880650da..b041d3daf7c7 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -38,7 +38,6 @@ config MIPS select GENERIC_BUILTIN_DTB if BUILTIN_DTB select GENERIC_CMOS_UPDATE select GENERIC_CPU_AUTOPROBE - select GENERIC_GETTIMEOFDAY select GENERIC_IRQ_PROBE select GENERIC_IRQ_SHOW select GENERIC_ISA_DMA if EISA @@ -3169,6 +3168,10 @@ endmenu config MIPS_EXTERNAL_TIMER bool +config MIPS_GENERIC_GETTIMEOFDAY + def_bool y + select GENERIC_GETTIMEOFDAY + menu "CPU Power Management" if CPU_SUPPORTS_CPUFREQ && MIPS_EXTERNAL_TIMER -- cgit v1.2.3 From 8ea920c48d82a0ef031bedfb649d4d8c77ef3d1c Mon Sep 17 00:00:00 2001 From: Thomas Weißschuh Date: Thu, 21 May 2026 08:53:18 +0200 Subject: MIPS: VDSO: Only map the data pages when the vDSO is used MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A future change will make it possible to disable the time-related vDSO. In that case there is no point in calling into the datastore. Signed-off-by: Thomas Weißschuh Signed-off-by: Thomas Gleixner Cc: Thomas Bogendoerfer Link: https://patch.msgid.link/20260521-vdso-mips-kconfig-v1-4-2f79dcd6c78f@linutronix.de --- arch/mips/Kconfig | 2 +- arch/mips/kernel/vdso.c | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index b041d3daf7c7..f56e1a5f5cd9 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -74,7 +74,6 @@ config MIPS select HAVE_FUNCTION_GRAPH_TRACER select HAVE_FUNCTION_TRACER select HAVE_GCC_PLUGINS - select HAVE_GENERIC_VDSO select HAVE_IOREMAP_PROT select HAVE_IRQ_EXIT_ON_IRQ_STACK select HAVE_IRQ_TIME_ACCOUNTING @@ -3171,6 +3170,7 @@ config MIPS_EXTERNAL_TIMER config MIPS_GENERIC_GETTIMEOFDAY def_bool y select GENERIC_GETTIMEOFDAY + select HAVE_GENERIC_VDSO menu "CPU Power Management" diff --git a/arch/mips/kernel/vdso.c b/arch/mips/kernel/vdso.c index 2fa4df3e46e4..bd1fc17d3975 100644 --- a/arch/mips/kernel/vdso.c +++ b/arch/mips/kernel/vdso.c @@ -129,7 +129,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) * This ensures that when the kernel updates the VDSO data userland * will observe it without requiring cache invalidations. */ - if (cpu_has_dc_aliases) { + if (cpu_has_dc_aliases && IS_ENABLED(CONFIG_HAVE_GENERIC_VDSO)) { base = __ALIGN_MASK(base, shm_align_mask); base += ((unsigned long)vdso_k_time_data - gic_size) & shm_align_mask; } @@ -137,10 +137,12 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) data_addr = base + gic_size; vdso_addr = data_addr + VDSO_NR_PAGES * PAGE_SIZE; - vma = vdso_install_vvar_mapping(mm, data_addr); - if (IS_ERR(vma)) { - ret = PTR_ERR(vma); - goto out; + if (IS_ENABLED(CONFIG_HAVE_GENERIC_VDSO)) { + vma = vdso_install_vvar_mapping(mm, data_addr); + if (IS_ERR(vma)) { + ret = PTR_ERR(vma); + goto out; + } } /* Map GIC user page. */ -- cgit v1.2.3 From f3dc8fb24f90fa2901a87fb5273edabcc4e8f2ed Mon Sep 17 00:00:00 2001 From: Thomas Weißschuh Date: Thu, 21 May 2026 08:53:19 +0200 Subject: MIPS: csrc-r4k: Only use VDSO_CLOCKMODE_R4K when it is a available MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit VDSO_CLOCKMODE_R4K is only defined if CONFIG_GENERIC_GETTIMEOFDAY is enabled. Right now this is always the case, but it will change soon. Prepare for the potential unavailability of VDSO_CLOCKMODE_R4K. Signed-off-by: Thomas Weißschuh Signed-off-by: Thomas Gleixner Cc: Thomas Bogendoerfer Link: https://patch.msgid.link/20260521-vdso-mips-kconfig-v1-5-2f79dcd6c78f@linutronix.de --- arch/mips/kernel/csrc-r4k.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/mips/kernel/csrc-r4k.c b/arch/mips/kernel/csrc-r4k.c index 59eca397f297..241a934543a8 100644 --- a/arch/mips/kernel/csrc-r4k.c +++ b/arch/mips/kernel/csrc-r4k.c @@ -126,12 +126,14 @@ int __init init_r4k_clocksource(void) clocksource_mips.rating = 200; clocksource_mips.rating += clamp(mips_hpt_frequency / 10000000, 0, 99); +#ifdef CONFIG_GENERIC_GETTIMEOFDAY /* * R2 onwards makes the count accessible to user mode so it can be used * by the VDSO (HWREna is configured by configure_hwrena()). */ if (cpu_has_mips_r2_r6 && rdhwr_count_usable()) clocksource_mips.vdso_clock_mode = VDSO_CLOCKMODE_R4K; +#endif clocksource_register_hz(&clocksource_mips, mips_hpt_frequency); -- cgit v1.2.3 From 66e0b2e3e3817efe0e0f283c04a9dd773ec4ac5e Mon Sep 17 00:00:00 2001 From: Thomas Weißschuh Date: Thu, 21 May 2026 08:53:20 +0200 Subject: clocksource/drivers/mips-gic-timer: Only use VDSO_CLOCKMODE_GIC when it is a available MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit VDSO_CLOCKMODE_GIC is only defined if CONFIG_GENERIC_GETTIMEOFDAY is enabled. Right now this is always the case, but it will change soon. Prepare for the potential unavailability of VDSO_CLOCKMODE_GIC. Signed-off-by: Thomas Weißschuh Signed-off-by: Thomas Gleixner Cc: Thomas Bogendoerfer Link: https://patch.msgid.link/20260521-vdso-mips-kconfig-v1-6-2f79dcd6c78f@linutronix.de --- drivers/clocksource/mips-gic-timer.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/clocksource/mips-gic-timer.c b/drivers/clocksource/mips-gic-timer.c index 1501c7db9a8e..a1669266c94d 100644 --- a/drivers/clocksource/mips-gic-timer.c +++ b/drivers/clocksource/mips-gic-timer.c @@ -198,7 +198,9 @@ static struct clocksource gic_clocksource = { .name = "GIC", .read = gic_hpt_read, .flags = CLOCK_SOURCE_IS_CONTINUOUS, +#ifdef CONFIG_GENERIC_GETTIMEOFDAY .vdso_clock_mode = VDSO_CLOCKMODE_GIC, +#endif }; static void gic_clocksource_unstable(char *reason) -- cgit v1.2.3 From 51512c216e1d2ab4822282c9ecdd40f43fa1484c Mon Sep 17 00:00:00 2001 From: Thomas Weißschuh Date: Thu, 21 May 2026 08:53:21 +0200 Subject: MIPS: VDSO: Fold MIPS_DISABLE_VDSO into MIPS_GENERIC_GETTIMEOFDAY MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The currently used MIPS_DISABLE_VDSO will disable only the userspace bits of the time-related vDSO. The kernel part is still pointlessly built and running. Remove MIPS_DISABLE_VDSO and fold its usecase into MIPS_GENERIC_GETTIMEOFDAY, which works correctly. Signed-off-by: Thomas Weißschuh Signed-off-by: Thomas Gleixner Cc: Thomas Bogendoerfer Cc: Daniel Lezcano Cc: Thomas Gleixner Cc: Andy Lutomirski Cc: Vincenzo Frascino Cc: Arnd Bergmann Cc: linux-mips@vger.kernel.org Link: https://patch.msgid.link/20260521-vdso-mips-kconfig-v1-7-2f79dcd6c78f@linutronix.de --- arch/mips/Kconfig | 6 ++++-- arch/mips/vdso/Kconfig | 6 ------ arch/mips/vdso/Makefile | 7 ++----- arch/mips/vdso/vdso.lds.S | 2 +- 4 files changed, 7 insertions(+), 14 deletions(-) delete mode 100644 arch/mips/vdso/Kconfig diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index f56e1a5f5cd9..6463b0b1e165 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -3171,6 +3171,10 @@ config MIPS_GENERIC_GETTIMEOFDAY def_bool y select GENERIC_GETTIMEOFDAY select HAVE_GENERIC_VDSO + # GCC (at least up to version 9.2) appears to emit function calls that make use + # of the GOT when targeting microMIPS, which we can't use in the VDSO due to + # the lack of relocations. As such, we disable the VDSO for microMIPS builds. + depends on !CPU_MICROMIPS menu "CPU Power Management" @@ -3183,5 +3187,3 @@ source "drivers/cpuidle/Kconfig" endmenu source "arch/mips/kvm/Kconfig" - -source "arch/mips/vdso/Kconfig" diff --git a/arch/mips/vdso/Kconfig b/arch/mips/vdso/Kconfig deleted file mode 100644 index 70140248da72..000000000000 --- a/arch/mips/vdso/Kconfig +++ /dev/null @@ -1,6 +0,0 @@ -# GCC (at least up to version 9.2) appears to emit function calls that make use -# of the GOT when targeting microMIPS, which we can't use in the VDSO due to -# the lack of relocations. As such, we disable the VDSO for microMIPS builds. - -config MIPS_DISABLE_VDSO - def_bool CPU_MICROMIPS diff --git a/arch/mips/vdso/Makefile b/arch/mips/vdso/Makefile index 69d4593f64fe..00d3ba2c482a 100644 --- a/arch/mips/vdso/Makefile +++ b/arch/mips/vdso/Makefile @@ -4,7 +4,7 @@ # Include the generic Makefile to check the built vdso. include $(srctree)/lib/vdso/Makefile.include -obj-vdso-y := elf.o vgettimeofday.o sigreturn.o +obj-vdso-y := elf.o sigreturn.o # Common compiler flags between ABIs. ccflags-vdso := \ @@ -36,6 +36,7 @@ aflags-vdso := $(ccflags-vdso) \ -D__ASSEMBLY__ -Wa,-gdwarf-2 ifneq ($(c-gettimeofday-y),) +obj-vdso-y += vgettimeofday.o CFLAGS_vgettimeofday.o = -include $(c-gettimeofday-y) # config-n32-o32-env.c prepares the environment to build a 32bit vDSO @@ -47,10 +48,6 @@ endif CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) -ifdef CONFIG_MIPS_DISABLE_VDSO - obj-vdso-y := $(filter-out vgettimeofday.o, $(obj-vdso-y)) -endif - # VDSO linker flags. ldflags-y := -Bsymbolic --no-undefined -soname=linux-vdso.so.1 \ $(filter -E%,$(KBUILD_CFLAGS)) -shared \ diff --git a/arch/mips/vdso/vdso.lds.S b/arch/mips/vdso/vdso.lds.S index 5d08be3a6b85..fd263b05d3e7 100644 --- a/arch/mips/vdso/vdso.lds.S +++ b/arch/mips/vdso/vdso.lds.S @@ -94,7 +94,7 @@ PHDRS VERSION { LINUX_2.6 { -#ifndef CONFIG_MIPS_DISABLE_VDSO +#ifdef CONFIG_GENERIC_GETTIMEOFDAY global: __vdso_clock_gettime; #ifdef CONFIG_MIPS_CLOCK_VSYSCALL -- cgit v1.2.3 From d051ede1adeeb8ccc9314bac00f33e013deedbf5 Mon Sep 17 00:00:00 2001 From: Thomas Weißschuh Date: Thu, 21 May 2026 08:53:22 +0200 Subject: MIPS: VDSO: Gate microMIPS restriction on GCC version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As explained in the comment, the problematic GOT references are only emitted by old versions of GCC. Limit the restriction to those compilers. Signed-off-by: Thomas Weißschuh Signed-off-by: Thomas Gleixner Cc: Thomas Bogendoerfer Link: https://patch.msgid.link/20260521-vdso-mips-kconfig-v1-8-2f79dcd6c78f@linutronix.de --- arch/mips/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 6463b0b1e165..ccc66e3df1f9 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -3174,7 +3174,7 @@ config MIPS_GENERIC_GETTIMEOFDAY # GCC (at least up to version 9.2) appears to emit function calls that make use # of the GOT when targeting microMIPS, which we can't use in the VDSO due to # the lack of relocations. As such, we disable the VDSO for microMIPS builds. - depends on !CPU_MICROMIPS + depends on !(CPU_MICROMIPS && CC_IS_GCC && GCC_VERSION < 90300) menu "CPU Power Management" -- cgit v1.2.3 From 8d563bd7904734c05a4f2abf4ecca0e4fe764b50 Mon Sep 17 00:00:00 2001 From: Thomas Weißschuh Date: Thu, 21 May 2026 08:53:23 +0200 Subject: MIPS: VDSO: Fold MIPS_CLOCK_VSYSCALL into MIPS_GENERIC_GETTIMEOFDAY MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This configuration option exists so "that we don't provide the symbol when there's no possibility of there being a usable clocksource". However it only covers __vdso_gettimeofday() and none of the other vDSO functions which should be affected by the same circumstances.slightly slightly. Remove MIPS_CLOCK_VSYSCALL and fold its usecase into MIPS_GENERIC_GETTIMEOFDAY, which works correctly. Signed-off-by: Thomas Weißschuh Signed-off-by: Thomas Gleixner Cc: Thomas Bogendoerfer Cc: Daniel Lezcano Cc: Thomas Gleixner Cc: Andy Lutomirski Cc: Vincenzo Frascino Cc: Arnd Bergmann Cc: linux-mips@vger.kernel.org Link: https://patch.msgid.link/20260521-vdso-mips-kconfig-v1-9-2f79dcd6c78f@linutronix.de --- arch/mips/Kconfig | 4 +--- arch/mips/vdso/vdso.lds.S | 2 -- arch/mips/vdso/vgettimeofday.c | 20 -------------------- 3 files changed, 1 insertion(+), 25 deletions(-) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index ccc66e3df1f9..323ca084e79a 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -1133,9 +1133,6 @@ config CSRC_R4K config CSRC_SB1250 bool -config MIPS_CLOCK_VSYSCALL - def_bool CSRC_R4K || CLKSRC_MIPS_GIC - config GPIO_TXX9 select GPIOLIB bool @@ -3171,6 +3168,7 @@ config MIPS_GENERIC_GETTIMEOFDAY def_bool y select GENERIC_GETTIMEOFDAY select HAVE_GENERIC_VDSO + depends on CSRC_R4K || CLKSRC_MIPS_GIC # GCC (at least up to version 9.2) appears to emit function calls that make use # of the GOT when targeting microMIPS, which we can't use in the VDSO due to # the lack of relocations. As such, we disable the VDSO for microMIPS builds. diff --git a/arch/mips/vdso/vdso.lds.S b/arch/mips/vdso/vdso.lds.S index fd263b05d3e7..05badf3ae0ff 100644 --- a/arch/mips/vdso/vdso.lds.S +++ b/arch/mips/vdso/vdso.lds.S @@ -97,9 +97,7 @@ VERSION #ifdef CONFIG_GENERIC_GETTIMEOFDAY global: __vdso_clock_gettime; -#ifdef CONFIG_MIPS_CLOCK_VSYSCALL __vdso_gettimeofday; -#endif __vdso_clock_getres; #if _MIPS_SIM != _MIPS_SIM_ABI64 __vdso_clock_gettime64; diff --git a/arch/mips/vdso/vgettimeofday.c b/arch/mips/vdso/vgettimeofday.c index 1d236215e8f6..00f9fcfc327e 100644 --- a/arch/mips/vdso/vgettimeofday.c +++ b/arch/mips/vdso/vgettimeofday.c @@ -18,22 +18,12 @@ int __vdso_clock_gettime(clockid_t clock, return __cvdso_clock_gettime32(clock, ts); } -#ifdef CONFIG_MIPS_CLOCK_VSYSCALL - -/* - * This is behind the ifdef so that we don't provide the symbol when there's no - * possibility of there being a usable clocksource, because there's nothing we - * can do without it. When libc fails the symbol lookup it should fall back on - * the standard syscall path. - */ int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz) { return __cvdso_gettimeofday(tv, tz); } -#endif /* CONFIG_MIPS_CLOCK_VSYSCALL */ - int __vdso_clock_getres(clockid_t clock_id, struct old_timespec32 *res) { @@ -59,22 +49,12 @@ int __vdso_clock_gettime(clockid_t clock, return __cvdso_clock_gettime(clock, ts); } -#ifdef CONFIG_MIPS_CLOCK_VSYSCALL - -/* - * This is behind the ifdef so that we don't provide the symbol when there's no - * possibility of there being a usable clocksource, because there's nothing we - * can do without it. When libc fails the symbol lookup it should fall back on - * the standard syscall path. - */ int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz) { return __cvdso_gettimeofday(tv, tz); } -#endif /* CONFIG_MIPS_CLOCK_VSYSCALL */ - int __vdso_clock_getres(clockid_t clock_id, struct __kernel_timespec *res) { -- cgit v1.2.3