mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/3] vdso/gettimeofday: Add support for ALARM clocks
@ 2026-09-21  9:53 Thomas Weißschuh
  2026-09-21  9:54 ` [PATCH 1/3] selftests: vDSO: vdso_test_abi: Also test " Thomas Weißschuh
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Thomas Weißschuh @ 2026-09-21  9:53 UTC (permalink / raw)
  To: Andy Lutomirski, Thomas Gleixner, Vincenzo Frascino, Shuah Khan
  Cc: linux-kernel, linux-kselftest, Thomas Weißschuh

Extend the generic vDSO library to also handle CLOCK_BOOTTIME_ALARM
and CLOCK_REALTIME_ALARM. This does not introduce any runtime overhead
in the userspace fast path and only memory copies in the tick update
path.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
Thomas Weißschuh (3):
      selftests: vDSO: vdso_test_abi: Also test ALARM clocks
      vdso/gettimeofday: Add support for CLOCK_BOOTTIME_ALARM
      vdso/gettimeofday: Add support for CLOCK_REALTIME_ALARM

 include/vdso/datapage.h                      | 2 ++
 kernel/time/vsyscall.c                       | 7 +++++++
 tools/testing/selftests/vDSO/vdso_test_abi.c | 4 +++-
 3 files changed, 12 insertions(+), 1 deletion(-)
---
base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
change-id: 20260921-vdso-alarm-clocks-6502a551ad5c

Best regards,
--  
Thomas Weißschuh <linux@weissschuh.net>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] selftests: vDSO: vdso_test_abi: Also test ALARM clocks
  2026-09-21  9:53 [PATCH 0/3] vdso/gettimeofday: Add support for ALARM clocks Thomas Weißschuh
@ 2026-09-21  9:54 ` Thomas Weißschuh
  2026-09-21  9:54 ` [PATCH 2/3] vdso/gettimeofday: Add support for CLOCK_BOOTTIME_ALARM Thomas Weißschuh
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Thomas Weißschuh @ 2026-09-21  9:54 UTC (permalink / raw)
  To: Andy Lutomirski, Thomas Gleixner, Vincenzo Frascino, Shuah Khan
  Cc: linux-kernel, linux-kselftest, Thomas Weißschuh

Extend the tests to also handle CLOCK_REALTIME_ALARM and
CLOCK_BOOTTIME_ALARM. These are currently not handled by the vDSO,
so will fall through to the system call and succeed.

The tests will become useful when the vDSO will start handling these
clocks in later patches.
---
 tools/testing/selftests/vDSO/vdso_test_abi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/vDSO/vdso_test_abi.c b/tools/testing/selftests/vDSO/vdso_test_abi.c
index b162a4ba9c4f..4f538928e1d4 100644
--- a/tools/testing/selftests/vDSO/vdso_test_abi.c
+++ b/tools/testing/selftests/vDSO/vdso_test_abi.c
@@ -261,7 +261,7 @@ static inline void vdso_test_clock(clockid_t clock_id)
 	vdso_test_clock_getres_time64(clock_id);
 }
 
-#define VDSO_TEST_PLAN	38
+#define VDSO_TEST_PLAN	46
 
 int main(int argc, char **argv)
 {
@@ -284,7 +284,9 @@ int main(int argc, char **argv)
 	vdso_test_gettimeofday();
 
 	vdso_test_clock(CLOCK_REALTIME);
+	vdso_test_clock(CLOCK_REALTIME_ALARM);
 	vdso_test_clock(CLOCK_BOOTTIME);
+	vdso_test_clock(CLOCK_BOOTTIME_ALARM);
 	vdso_test_clock(CLOCK_TAI);
 	vdso_test_clock(CLOCK_REALTIME_COARSE);
 	vdso_test_clock(CLOCK_MONOTONIC);

-- 
2.55.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/3] vdso/gettimeofday: Add support for CLOCK_BOOTTIME_ALARM
  2026-09-21  9:53 [PATCH 0/3] vdso/gettimeofday: Add support for ALARM clocks Thomas Weißschuh
  2026-09-21  9:54 ` [PATCH 1/3] selftests: vDSO: vdso_test_abi: Also test " Thomas Weißschuh
@ 2026-09-21  9:54 ` Thomas Weißschuh
  2026-09-21  9:54 ` [PATCH 3/3] vdso/gettimeofday: Add support for CLOCK_REALTIME_ALARM Thomas Weißschuh
  2026-09-29 19:12 ` [PATCH 0/3] vdso/gettimeofday: Add support for ALARM clocks Thomas Gleixner
  3 siblings, 0 replies; 5+ messages in thread
From: Thomas Weißschuh @ 2026-09-21  9:54 UTC (permalink / raw)
  To: Andy Lutomirski, Thomas Gleixner, Vincenzo Frascino, Shuah Khan
  Cc: linux-kernel, linux-kselftest, Thomas Weißschuh

CLOCK_BOOTTIME_ALARM behaves exactly as CLOCK_BOOTTIME 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.

The namespace offset is already set correctly, although it was not
used before.

Reuse the CLOCK_BOOTTIME basetime for CLOCK_BOOTTIME_ALARM and update
the userspace hres clock mask to include CLOCK_BOOTTIME_ALARM.
---
 include/vdso/datapage.h | 1 +
 kernel/time/vsyscall.c  | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/include/vdso/datapage.h b/include/vdso/datapage.h
index 09897f76ae07..33297b5e2521 100644
--- a/include/vdso/datapage.h
+++ b/include/vdso/datapage.h
@@ -35,6 +35,7 @@ struct vdso_arch_data {
 #define VDSO_HRES	(BIT(CLOCK_REALTIME)		| \
 			 BIT(CLOCK_MONOTONIC)		| \
 			 BIT(CLOCK_BOOTTIME)		| \
+			 BIT(CLOCK_BOOTTIME_ALARM)	| \
 			 BIT(CLOCK_TAI))
 #define VDSO_COARSE	(BIT(CLOCK_REALTIME_COARSE)	| \
 			 BIT(CLOCK_MONOTONIC_COARSE))
diff --git a/kernel/time/vsyscall.c b/kernel/time/vsyscall.c
index aa59919b8f2c..24082b9d7869 100644
--- a/kernel/time/vsyscall.c
+++ b/kernel/time/vsyscall.c
@@ -63,6 +63,9 @@ static inline void update_vdso_time_data(struct vdso_time_data *vdata, struct ti
 	}
 	vdso_ts->nsec	= nsec;
 
+	/* CLOCK_BOOTTIME_ALARM, copy of CLOCK_BOOTIME */
+	vc[CS_HRES_COARSE].basetime[CLOCK_BOOTTIME_ALARM] = *vdso_ts;
+
 	/* CLOCK_MONOTONIC_RAW */
 	vdso_ts		= &vc[CS_RAW].basetime[CLOCK_MONOTONIC_RAW];
 	vdso_ts->sec	= tk->raw_sec;

-- 
2.55.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 3/3] vdso/gettimeofday: Add support for CLOCK_REALTIME_ALARM
  2026-09-21  9:53 [PATCH 0/3] vdso/gettimeofday: Add support for ALARM clocks Thomas Weißschuh
  2026-09-21  9:54 ` [PATCH 1/3] selftests: vDSO: vdso_test_abi: Also test " Thomas Weißschuh
  2026-09-21  9:54 ` [PATCH 2/3] vdso/gettimeofday: Add support for CLOCK_BOOTTIME_ALARM Thomas Weißschuh
@ 2026-09-21  9:54 ` Thomas Weißschuh
  2026-09-29 19:12 ` [PATCH 0/3] vdso/gettimeofday: Add support for ALARM clocks Thomas Gleixner
  3 siblings, 0 replies; 5+ messages in thread
From: Thomas Weißschuh @ 2026-09-21  9:54 UTC (permalink / raw)
  To: Andy Lutomirski, Thomas Gleixner, Vincenzo Frascino, Shuah Khan
  Cc: linux-kernel, linux-kselftest, Thomas Weißschuh

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/3] vdso/gettimeofday: Add support for ALARM clocks
  2026-09-21  9:53 [PATCH 0/3] vdso/gettimeofday: Add support for ALARM clocks Thomas Weißschuh
                   ` (2 preceding siblings ...)
  2026-09-21  9:54 ` [PATCH 3/3] vdso/gettimeofday: Add support for CLOCK_REALTIME_ALARM Thomas Weißschuh
@ 2026-09-29 19:12 ` Thomas Gleixner
  3 siblings, 0 replies; 5+ messages in thread
From: Thomas Gleixner @ 2026-09-29 19:12 UTC (permalink / raw)
  To: Thomas Weißschuh, Andy Lutomirski, Vincenzo Frascino, Shuah Khan
  Cc: linux-kernel, linux-kselftest, Thomas Weißschuh

On Mon, Sep 21 2026 at 11:53, Thomas Weißschuh wrote:
> Extend the generic vDSO library to also handle CLOCK_BOOTTIME_ALARM
> and CLOCK_REALTIME_ALARM. This does not introduce any runtime overhead
> in the userspace fast path and only memory copies in the tick update
> path.
>
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
> Thomas Weißschuh (3):
>       selftests: vDSO: vdso_test_abi: Also test ALARM clocks
>       vdso/gettimeofday: Add support for CLOCK_BOOTTIME_ALARM
>       vdso/gettimeofday: Add support for CLOCK_REALTIME_ALARM

Patch "selftests: vDSO: vdso_test_abi: Also test ALARM clocks" has no SOB
Patch "vdso/gettimeofday: Add support for CLOCK_BOOTTIME_ALARM" has no SOB
Patch "vdso/gettimeofday: Add support for CLOCK_REALTIME_ALARM" has no SOB

Please try again.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-09-29 19:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-21  9:53 [PATCH 0/3] vdso/gettimeofday: Add support for ALARM clocks Thomas Weißschuh
2026-09-21  9:54 ` [PATCH 1/3] selftests: vDSO: vdso_test_abi: Also test " Thomas Weißschuh
2026-09-21  9:54 ` [PATCH 2/3] vdso/gettimeofday: Add support for CLOCK_BOOTTIME_ALARM Thomas Weißschuh
2026-09-21  9:54 ` [PATCH 3/3] vdso/gettimeofday: Add support for CLOCK_REALTIME_ALARM Thomas Weißschuh
2026-09-29 19:12 ` [PATCH 0/3] vdso/gettimeofday: Add support for ALARM clocks Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®