From: "tip-bot2 for Thomas Gleixner" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>,
John Stultz <jstultz@google.com>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: timers/ptp] ntp: Add support for auxiliary timekeepers
Date: Wed, 25 Jun 2025 16:16:04 -0000 [thread overview]
Message-ID: <175086816451.406.15644609316106911557.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20250519083025.969000914@linutronix.de>
The following commit has been merged into the timers/ptp branch of tip:
Commit-ID: 8515714b0f88a698a4c26f0f0ce7d43ad14dce16
Gitweb: https://git.kernel.org/tip/8515714b0f88a698a4c26f0f0ce7d43ad14dce16
Author: Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Mon, 19 May 2025 10:33:21 +02:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Thu, 19 Jun 2025 14:28:22 +02:00
ntp: Add support for auxiliary timekeepers
If auxiliary clocks are enabled, provide an array of NTP data so that the
auxiliary timekeepers can be steered independently of the core timekeeper.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: John Stultz <jstultz@google.com>
Link: https://lore.kernel.org/all/20250519083025.969000914@linutronix.de
---
kernel/time/ntp.c | 41 ++++++++++++++++++++++-------------------
1 file changed, 22 insertions(+), 19 deletions(-)
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index b837d3d..5b5a0f7 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -18,6 +18,7 @@
#include <linux/module.h>
#include <linux/rtc.h>
#include <linux/audit.h>
+#include <linux/timekeeper_internal.h>
#include "ntp_internal.h"
#include "timekeeping_internal.h"
@@ -86,14 +87,16 @@ struct ntp_data {
#endif
};
-static struct ntp_data tk_ntp_data = {
- .tick_usec = USER_TICK_USEC,
- .time_state = TIME_OK,
- .time_status = STA_UNSYNC,
- .time_constant = 2,
- .time_maxerror = NTP_PHASE_LIMIT,
- .time_esterror = NTP_PHASE_LIMIT,
- .ntp_next_leap_sec = TIME64_MAX,
+static struct ntp_data tk_ntp_data[TIMEKEEPERS_MAX] = {
+ [ 0 ... TIMEKEEPERS_MAX - 1 ] = {
+ .tick_usec = USER_TICK_USEC,
+ .time_state = TIME_OK,
+ .time_status = STA_UNSYNC,
+ .time_constant = 2,
+ .time_maxerror = NTP_PHASE_LIMIT,
+ .time_esterror = NTP_PHASE_LIMIT,
+ .ntp_next_leap_sec = TIME64_MAX,
+ },
};
#define SECS_PER_DAY 86400
@@ -351,13 +354,13 @@ static void __ntp_clear(struct ntp_data *ntpdata)
*/
void ntp_clear(void)
{
- __ntp_clear(&tk_ntp_data);
+ __ntp_clear(&tk_ntp_data[TIMEKEEPER_CORE]);
}
u64 ntp_tick_length(void)
{
- return tk_ntp_data.tick_length;
+ return tk_ntp_data[TIMEKEEPER_CORE].tick_length;
}
/**
@@ -368,7 +371,7 @@ u64 ntp_tick_length(void)
*/
ktime_t ntp_get_next_leap(void)
{
- struct ntp_data *ntpdata = &tk_ntp_data;
+ struct ntp_data *ntpdata = &tk_ntp_data[TIMEKEEPER_CORE];
ktime_t ret;
if ((ntpdata->time_state == TIME_INS) && (ntpdata->time_status & STA_INS))
@@ -389,7 +392,7 @@ ktime_t ntp_get_next_leap(void)
*/
int second_overflow(time64_t secs)
{
- struct ntp_data *ntpdata = &tk_ntp_data;
+ struct ntp_data *ntpdata = &tk_ntp_data[TIMEKEEPER_CORE];
s64 delta;
int leap = 0;
s32 rem;
@@ -605,7 +608,7 @@ static inline int update_rtc(struct timespec64 *to_set, unsigned long *offset_ns
*/
static inline bool ntp_synced(void)
{
- return !(tk_ntp_data.time_status & STA_UNSYNC);
+ return !(tk_ntp_data[TIMEKEEPER_CORE].time_status & STA_UNSYNC);
}
/*
@@ -762,7 +765,7 @@ static inline void process_adjtimex_modes(struct ntp_data *ntpdata, const struct
int __do_adjtimex(struct __kernel_timex *txc, const struct timespec64 *ts,
s32 *time_tai, struct audit_ntp_data *ad)
{
- struct ntp_data *ntpdata = &tk_ntp_data;
+ struct ntp_data *ntpdata = &tk_ntp_data[TIMEKEEPER_CORE];
int result;
if (txc->modes & ADJ_ADJTIME) {
@@ -1031,8 +1034,8 @@ static void hardpps_update_phase(struct ntp_data *ntpdata, long error)
*/
void __hardpps(const struct timespec64 *phase_ts, const struct timespec64 *raw_ts)
{
+ struct ntp_data *ntpdata = &tk_ntp_data[TIMEKEEPER_CORE];
struct pps_normtime pts_norm, freq_norm;
- struct ntp_data *ntpdata = &tk_ntp_data;
pts_norm = pps_normalize_ts(*phase_ts);
@@ -1083,18 +1086,18 @@ void __hardpps(const struct timespec64 *phase_ts, const struct timespec64 *raw_t
static int __init ntp_tick_adj_setup(char *str)
{
- int rc = kstrtos64(str, 0, &tk_ntp_data.ntp_tick_adj);
+ int rc = kstrtos64(str, 0, &tk_ntp_data[TIMEKEEPER_CORE].ntp_tick_adj);
if (rc)
return rc;
- tk_ntp_data.ntp_tick_adj <<= NTP_SCALE_SHIFT;
+ tk_ntp_data[TIMEKEEPER_CORE].ntp_tick_adj <<= NTP_SCALE_SHIFT;
return 1;
}
-
__setup("ntp_tick_adj=", ntp_tick_adj_setup);
void __init ntp_init(void)
{
- ntp_clear();
+ for (int id = 0; id < TIMEKEEPERS_MAX; id++)
+ __ntp_clear(tk_ntp_data + id);
ntp_init_cmos_sync();
}
next prev parent reply other threads:[~2025-06-25 16:16 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-19 8:33 [patch V2 00/26] timekeeping: Provide " Thomas Gleixner
2025-05-19 8:33 ` [patch V2 01/26] timekeeping: Remove hardcoded access to tk_core Thomas Gleixner
2025-06-12 22:34 ` John Stultz
2025-06-25 16:16 ` [tip: timers/ptp] " tip-bot2 for Thomas Gleixner
2025-05-19 8:33 ` [patch V2 02/26] timekeeping: Cleanup kernel doc of __ktime_get_real_seconds() Thomas Gleixner
2025-06-12 22:36 ` John Stultz
2025-06-25 16:16 ` [tip: timers/ptp] " tip-bot2 for Thomas Gleixner
2025-05-19 8:33 ` [patch V2 03/26] timekeeping: Avoid double notification in do_adjtimex() Thomas Gleixner
2025-06-25 16:16 ` [tip: timers/ptp] " tip-bot2 for Thomas Gleixner
2025-05-19 8:33 ` [patch V2 04/26] timekeeping: Introduce timekeeper ID Thomas Gleixner
2025-06-13 0:03 ` John Stultz
2025-06-25 16:16 ` [tip: timers/ptp] " tip-bot2 for Anna-Maria Behnsen
2025-05-19 8:33 ` [patch V2 05/26] time: Introduce auxiliary POSIX clocks Thomas Gleixner
2025-06-13 0:06 ` John Stultz
2025-06-25 16:16 ` [tip: timers/ptp] " tip-bot2 for Anna-Maria Behnsen
2025-05-19 8:33 ` [patch V2 06/26] ntp: Add support for auxiliary timekeepers Thomas Gleixner
2025-06-13 0:14 ` John Stultz
2025-06-13 6:32 ` Thomas Weißschuh
2025-06-25 16:16 ` tip-bot2 for Thomas Gleixner [this message]
2025-05-19 8:33 ` [patch V2 07/26] ntp: Add timekeeper ID arguments to public functions Thomas Gleixner
2025-06-13 0:20 ` John Stultz
2025-06-25 16:16 ` [tip: timers/ptp] " tip-bot2 for Thomas Gleixner
2025-05-19 8:33 ` [patch V2 08/26] ntp: Rename __do_adjtimex() to ntp_adjtimex() Thomas Gleixner
2025-06-13 0:20 ` John Stultz
2025-06-25 16:16 ` [tip: timers/ptp] " tip-bot2 for Thomas Gleixner
2025-05-19 8:33 ` [patch V2 09/26] timekeeping: Make __timekeeping_advance() reusable Thomas Gleixner
2025-06-13 0:23 ` John Stultz
2025-06-25 16:16 ` [tip: timers/ptp] " tip-bot2 for Anna-Maria Behnsen
2025-05-19 8:33 ` [patch V2 10/26] timekeeping: Prepare timekeeping_update_from_shadow() Thomas Gleixner
2025-06-25 16:16 ` [tip: timers/ptp] " tip-bot2 for Thomas Gleixner
2025-05-19 8:33 ` [patch V2 11/26] timekeeping: Add clock_valid flag to timekeeper Thomas Gleixner
2025-06-13 4:05 ` John Stultz
2025-06-25 16:15 ` [tip: timers/ptp] " tip-bot2 for Thomas Gleixner
2025-05-19 8:33 ` [patch V2 12/26] timekeeping: Introduce auxiliary timekeepers Thomas Gleixner
2025-06-14 2:41 ` John Stultz
2025-06-25 16:15 ` [tip: timers/ptp] " tip-bot2 for Anna-Maria Behnsen
2025-05-19 8:33 ` [patch V2 13/26] timekeeping: Provide ktime_get_ntp_seconds() Thomas Gleixner
2025-06-25 16:15 ` [tip: timers/ptp] " tip-bot2 for Thomas Gleixner
2025-05-19 8:33 ` [patch V2 14/26] ntp: Use ktime_get_ntp_seconds() Thomas Gleixner
2025-06-25 16:15 ` [tip: timers/ptp] " tip-bot2 for Thomas Gleixner
2025-05-19 8:33 ` [patch V2 15/26] timekeeping: Add AUX offset to struct timekeeper Thomas Gleixner
2025-06-14 2:44 ` John Stultz
2025-06-25 16:15 ` [tip: timers/ptp] " tip-bot2 for Thomas Gleixner
2025-05-19 8:33 ` [patch V2 16/26] timekeeping: Update auxiliary timekeepers on clocksource change Thomas Gleixner
2025-05-19 8:33 ` [patch V2 17/26] timekeeping: Provide time getters for auxiliary clocks Thomas Gleixner
2025-06-14 2:51 ` John Stultz
2025-06-14 7:18 ` Thomas Gleixner
2025-05-19 8:33 ` [patch V2 18/26] timekeeping: Add minimal posix-timers support " Thomas Gleixner
2025-05-19 8:33 ` [patch V2 19/26] timekeeping: Provide time setter " Thomas Gleixner
2025-05-19 8:33 ` [patch V2 20/26] timekeeping: Make timekeeping_inject_offset() reusable Thomas Gleixner
2025-05-19 8:33 ` [patch V2 21/26] timekeeping: Add auxiliary clock support to __timekeeping_inject_offset() Thomas Gleixner
2025-05-19 8:33 ` [patch V2 22/26] timekeeping: Make do_adjtimex() reusable Thomas Gleixner
2025-05-19 8:33 ` [patch V2 23/26] timekeeping: Prepare do_adtimex() for auxiliary clocks Thomas Gleixner
2025-05-19 8:33 ` [patch V2 24/26] timekeeping: Provide adjtimex() " Thomas Gleixner
2025-05-19 8:33 ` [patch V2 25/26] timekeeping: Provide update for auxiliary timekeepers Thomas Gleixner
2025-05-19 8:33 ` [patch V2 26/26] timekeeping: Provide interface to control auxiliary clocks Thomas Gleixner
2025-06-13 7:18 ` Thomas Weißschuh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=175086816451.406.15644609316106911557.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=jstultz@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®