summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-10-21 11:33:33 -1000
committerLinus Torvalds <torvalds@linux-foundation.org>2026-10-21 11:33:33 -1000
commitccc4d9f8912a5d9f519a34c3633fe53c8f9b429e (patch)
tree6b3f0245c4dc1c345f095a541cc6fc65da18e196 /lib
parent1ae0ee1ba729a0c55c2eb8593fa708c23b66e1b3 (diff)
parent8d17190fae2caab89cd5df19257ed9dac0739e3b (diff)
Merge tag 'timers-vdso-2026-10-20' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull VDSO updates from Thomas Gleixner: "Updates for the VDSO subsystem: - Ensure that the CLOCK_AUX base calculations are properly scaled against the base timekeeper. The update function failed to take the fractional nanosecond part into account, which results in a rounding error. - Cleanup and consolidate the vsyscall headers to get rid of pointless copies all over the architectures. - Replace a runtime conditional in the time getter function for namespaced clocks by simple pointer arithmetic which speeds up the read function" * tag 'timers-vdso-2026-10-20' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: vdso/vsyscall: Keep the CLOCK_AUX base scaled vdso/math64: Add and use __iter_div64_u64_rem() vdso/math64: Use OPTIMIZER_HIDE_VAR() in __iter_div_u64_rem() vdso/gettimeofday: Avoid runtime conditional in do_hres_timens() vdso: Remove __ASSEMBLER__ guards from vsyscall.h vdso: Add asm-generic/vdso/vsyscall.h vdso: Remove unnecessary vdso/vsyscall.h includes riscv/hwprobe: Include vdso/datapage.h arm64/vdso: Delete asm/vdso/vsyscall.h inclusions x86/vdso: Delete asm/vdso/vsyscall.h inclusions sparc/vdso: Delete asm/vdso/vsyscall.h inclusion s390/vdso: Delete asm/vdso/vsyscall.h inclusions sparc/vdso: Move __VDSO_PAGES to asm/vdso.h x86/vdso: Move vDSO page definitions to asm/vdso.h vdso: Delete asm-generic/vdso/vsyscall.h vdso/vsyscall: Define fallback time synchronization functions in vsyscall.c vdso/getrandom: Define fallback __arch_get_vdso_u_rng_data() in getrandom.c vdso/gettimeofday: Define fallback __arch_get_vdso_u_time_data() in gettimeofday.c vdso: Move the kernel-side time update helpers to a new header
Diffstat (limited to 'lib')
-rw-r--r--lib/vdso/getrandom.c8
-rw-r--r--lib/vdso/gettimeofday.c23
2 files changed, 20 insertions, 11 deletions
diff --git a/lib/vdso/getrandom.c b/lib/vdso/getrandom.c
index 2851afa9154f..e0fa10bbefc9 100644
--- a/lib/vdso/getrandom.c
+++ b/lib/vdso/getrandom.c
@@ -16,8 +16,12 @@
#include <uapi/linux/mman.h>
#include <uapi/linux/random.h>
-/* Bring in default accessors */
-#include <vdso/vsyscall.h>
+#ifndef __arch_get_vdso_u_rng_data
+static __always_inline const struct vdso_rng_data *__arch_get_vdso_u_rng_data(void)
+{
+ return &vdso_u_rng_data;
+}
+#endif
#define MEMCPY_AND_ZERO_SRC(type, dst, src, len) do { \
while (len >= sizeof(type)) { \
diff --git a/lib/vdso/gettimeofday.c b/lib/vdso/gettimeofday.c
index f7a591aba59f..c0e81996532d 100644
--- a/lib/vdso/gettimeofday.c
+++ b/lib/vdso/gettimeofday.c
@@ -27,9 +27,6 @@
#include <linux/build_bug.h>
-/* Bring in default accessors */
-#include <vdso/vsyscall.h>
-
#ifndef vdso_calc_ns
#ifdef VDSO_DELTA_NOMASK
@@ -93,6 +90,13 @@ static inline bool vdso_cycles_ok(u64 cycles)
}
#endif
+#ifndef __arch_get_vdso_u_time_data
+static __always_inline const struct vdso_time_data *__arch_get_vdso_u_time_data(void)
+{
+ return &vdso_u_time_data;
+}
+#endif
+
static __always_inline bool vdso_clockid_valid(clockid_t clock)
{
/* Check for negative values or invalid clocks */
@@ -136,21 +140,22 @@ const struct vdso_time_data *vdso_timens_data(const struct vdso_time_data *vd)
}
static __always_inline
+const struct vdso_clock *vdso_timens_clock(const struct vdso_clock *vc)
+{
+ return (void *)vc + PAGE_SIZE;
+}
+
+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 = vdso_timens_data(vdns);
+ const struct vdso_clock *vc = vdso_timens_clock(vcns);
const struct timens_offset *offs = &vcns->offset[clk];
- const struct vdso_clock *vc = vd->clock_data;
u32 seq;
s64 sec;
u64 ns;
- if (clk != CLOCK_MONOTONIC_RAW)
- vc = &vc[CS_HRES_COARSE];
- else
- vc = &vc[CS_RAW];
-
do {
seq = vdso_read_begin(vc);