[PATCH 3/3] vdso/gettimeofday: Add support for CLOCK_REALTIME_ALARM
From: Thomas Weißschuh
Date: Mon Sep 21 2026 - 06:31:44 EST
CLOCK_REALTIME_ALARM behaves exactly as CLOCK_REALTIME as far as the
vDSO is concerned. The vDSO library can handle it automatically
correctly. Only the basetime needs to be maintained during the tick.
Reuse the CLOCK_REALTIME basetime for CLOCK_REALTIME_ALARM and update
the userspace hres clock mask to include CLOCK_REALTIME_ALARM.
---
include/vdso/datapage.h | 1 +
kernel/time/vsyscall.c | 4 ++++
2 files changed, 5 insertions(+)
diff --git a/include/vdso/datapage.h b/include/vdso/datapage.h
index 33297b5e2521..0aa28a484dcd 100644
--- a/include/vdso/datapage.h
+++ b/include/vdso/datapage.h
@@ -33,6 +33,7 @@ struct vdso_arch_data {
#define VDSO_BASES (CLOCK_TAI + 1)
#define VDSO_BASE_AUX 0
#define VDSO_HRES (BIT(CLOCK_REALTIME) | \
+ BIT(CLOCK_REALTIME_ALARM) | \
BIT(CLOCK_MONOTONIC) | \
BIT(CLOCK_BOOTTIME) | \
BIT(CLOCK_BOOTTIME_ALARM) | \
diff --git a/kernel/time/vsyscall.c b/kernel/time/vsyscall.c
index 24082b9d7869..b32bfded7d53 100644
--- a/kernel/time/vsyscall.c
+++ b/kernel/time/vsyscall.c
@@ -75,6 +75,10 @@ static inline void update_vdso_time_data(struct vdso_time_data *vdata, struct ti
vdso_ts = &vc[CS_HRES_COARSE].basetime[CLOCK_TAI];
vdso_ts->sec = tk->xtime_sec + (s64)tk->tai_offset;
vdso_ts->nsec = tk->tkr_mono.xtime_nsec;
+
+ /* CLOCK_REALTIME_ALARM, copy of CLOCK_REALTIME */
+ vdso_ts = &vc[CS_HRES_COARSE].basetime[CLOCK_REALTIME_ALARM];
+ *vdso_ts = vc[CS_HRES_COARSE].basetime[CLOCK_REALTIME];
}
void update_vsyscall(struct timekeeper *tk)
--
2.55.0