Thread (42 messages) flat view 42 messages, 3 authors, 2025-06-14
STALE419d LANDED

Landed in mainline as ffa0519baaed on 2025-06-19.

[patch V2 13/26] timekeeping: Provide ktime_get_ntp_seconds()

From: Thomas Gleixner <hidden>
Date: 2025-05-19 08:33:31
Also in: lkml

ntp_adjtimex() requires access to the actual time keeper per timekeeper
ID. Provide an interface.

Signed-off-by: Thomas Gleixner <redacted>

---
 kernel/time/timekeeping.c          |    9 +++++++++
 kernel/time/timekeeping_internal.h |    3 +++
 2 files changed, 12 insertions(+)
---
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -2627,6 +2627,15 @@ int do_adjtimex(struct __kernel_timex *t
 	return ret;
 }
 
+/*
+ * Invoked from NTP with the time keeper lock held, so lockless access is
+ * fine.
+ */
+long ktime_get_ntp_seconds(unsigned int id)
+{
+	return timekeeper_data[id].timekeeper.xtime_sec;
+}
+
 #ifdef CONFIG_NTP_PPS
 /**
  * hardpps() - Accessor function to NTP __hardpps function
--- a/kernel/time/timekeeping_internal.h
+++ b/kernel/time/timekeeping_internal.h
@@ -45,4 +45,7 @@ static inline u64 clocksource_delta(u64
 unsigned long timekeeper_lock_irqsave(void);
 void timekeeper_unlock_irqrestore(unsigned long flags);
 
+/* NTP specific interface to access the current seconds value */
+long ktime_get_ntp_seconds(unsigned int id);
+
 #endif /* _TIMEKEEPING_INTERNAL_H */
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help