[tip: timers/vdso] vdso/gettimeofday: Add support for CLOCK_REALTIME_ALARM
From: tip-bot2 for Thomas Weißschuh
Date: Mon Nov 30 2026 - 15:28:14 EST
The following commit has been merged into the timers/vdso branch of tip:
Commit-ID: c18138e0f879f98b30de2e6e1ffa916d28630c0a
Gitweb: https://git.kernel.org/tip/c18138e0f879f98b30de2e6e1ffa916d28630c0a
Author: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
AuthorDate: Tue, 10 Nov 2026 13:19:35
Committer: Thomas Gleixner <tglx@xxxxxxxxxx>
CommitterDate: Mon, 30 Nov 2026 18:05:19 +01:00
vdso/gettimeofday: Add support for CLOCK_REALTIME_ALARM
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.
Signed-off-by: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxx>
Link: https://patch.msgid.link/20261110-vdso-alarm-clocks-v3-4-8f3c0c5b5a11@xxxxxxxxxxxxxx
---
include/vdso/datapage.h | 3 ++-
kernel/time/vsyscall.c | 4 ++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/include/vdso/datapage.h b/include/vdso/datapage.h
index 98084b4..07aa420 100644
--- a/include/vdso/datapage.h
+++ b/include/vdso/datapage.h
@@ -40,7 +40,8 @@ struct vdso_arch_data {
BIT(CLOCK_MONOTONIC_COARSE))
#define VDSO_RAW (BIT(CLOCK_MONOTONIC_RAW))
#define VDSO_AUX __GENMASK(CLOCK_AUX_LAST, CLOCK_AUX)
-#define VDSO_ALARM BIT(CLOCK_BOOTTIME_ALARM)
+#define VDSO_ALARM (BIT(CLOCK_BOOTTIME_ALARM) | \
+ BIT(CLOCK_REALTIME_ALARM))
/**
* struct vdso_timestamp - basetime per clock_id
diff --git a/kernel/time/vsyscall.c b/kernel/time/vsyscall.c
index 4231b04..2125c46 100644
--- a/kernel/time/vsyscall.c
+++ b/kernel/time/vsyscall.c
@@ -81,6 +81,10 @@ static inline void update_vdso_time_data(struct vdso_time_data *vdata, struct ti
vdso_ts = &vdata->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 = &vdata->hres_coarse.basetime[CLOCK_REALTIME_ALARM];
+ *vdso_ts = vdata->hres_coarse.basetime[CLOCK_REALTIME];
}
void update_vsyscall(struct timekeeper *tk)