[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <172788389193.1442.2004408061941208132.tip-bot2@tip-bot2>
Date: Wed, 02 Oct 2024 15:44:51 -0000
From: "tip-bot2 for Thomas Gleixner" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Thomas Gleixner <tglx@...utronix.de>,
"Anna-Maria Behnsen" <anna-maria@...utronix.de>,
John Stultz <jstultz@...gle.com>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [tip: timers/core] ntp: Move time_max/esterror into ntp_data
The following commit has been merged into the timers/core branch of tip:
Commit-ID: 7891cf2961c0e99e026d911cbf1ec4aeb938750d
Gitweb: https://git.kernel.org/tip/7891cf2961c0e99e026d911cbf1ec4aeb938750d
Author: Thomas Gleixner <tglx@...utronix.de>
AuthorDate: Wed, 11 Sep 2024 15:17:47 +02:00
Committer: Thomas Gleixner <tglx@...utronix.de>
CommitterDate: Wed, 02 Oct 2024 16:53:39 +02:00
ntp: Move time_max/esterror into ntp_data
Continue the conversion from static variables to struct based data.
No functional change.
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Signed-off-by: Anna-Maria Behnsen <anna-maria@...utronix.de>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Acked-by: John Stultz <jstultz@...gle.com>
Link: https://lore.kernel.org/all/20240911-devel-anna-maria-b4-timers-ptp-ntp-v1-11-2d52f4e13476@linutronix.de
---
kernel/time/ntp.c | 38 ++++++++++++++++----------------------
1 file changed, 16 insertions(+), 22 deletions(-)
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index 5a6c325..67c4117 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -31,6 +31,9 @@
* @time_status: Clock status bits
* @time_offset: Time adjustment in nanoseconds
* @time_constant: PLL time constant
+ * @time_maxerror: Maximum error in microseconds holding the NTP sync distance
+ * (NTP dispersion + delay / 2)
+ * @time_esterror: Estimated error in microseconds holding NTP dispersion
*
* Protected by the timekeeping locks.
*/
@@ -42,6 +45,8 @@ struct ntp_data {
int time_status;
s64 time_offset;
long time_constant;
+ long time_maxerror;
+ long time_esterror;
};
static struct ntp_data tk_ntp_data = {
@@ -49,6 +54,8 @@ static struct ntp_data tk_ntp_data = {
.time_state = TIME_OK,
.time_status = STA_UNSYNC,
.time_constant = 2,
+ .time_maxerror = NTP_PHASE_LIMIT,
+ .time_esterror = NTP_PHASE_LIMIT,
};
#define SECS_PER_DAY 86400
@@ -57,19 +64,6 @@ static struct ntp_data tk_ntp_data = {
(((MAX_TICKADJ * NSEC_PER_USEC) << NTP_SCALE_SHIFT) / NTP_INTERVAL_FREQ)
#define MAX_TAI_OFFSET 100000
-/*
- * phase-lock loop variables
- *
- * Note: maximum error = NTP sync distance = dispersion + delay / 2;
- * estimated error = NTP dispersion.
- */
-
-/* maximum error (usecs): */
-static long time_maxerror = NTP_PHASE_LIMIT;
-
-/* estimated error (usecs): */
-static long time_esterror = NTP_PHASE_LIMIT;
-
/* frequency offset (scaled nsecs/secs): */
static s64 time_freq;
@@ -332,8 +326,8 @@ static void __ntp_clear(struct ntp_data *ntpdata)
/* Stop active adjtime() */
time_adjust = 0;
ntpdata->time_status |= STA_UNSYNC;
- time_maxerror = NTP_PHASE_LIMIT;
- time_esterror = NTP_PHASE_LIMIT;
+ ntpdata->time_maxerror = NTP_PHASE_LIMIT;
+ ntpdata->time_esterror = NTP_PHASE_LIMIT;
ntp_update_frequency(ntpdata);
@@ -442,9 +436,9 @@ int second_overflow(time64_t secs)
}
/* Bump the maxerror field */
- time_maxerror += MAXFREQ / NSEC_PER_USEC;
- if (time_maxerror > NTP_PHASE_LIMIT) {
- time_maxerror = NTP_PHASE_LIMIT;
+ ntpdata->time_maxerror += MAXFREQ / NSEC_PER_USEC;
+ if (ntpdata->time_maxerror > NTP_PHASE_LIMIT) {
+ ntpdata->time_maxerror = NTP_PHASE_LIMIT;
ntpdata->time_status |= STA_UNSYNC;
}
@@ -730,10 +724,10 @@ static inline void process_adjtimex_modes(struct ntp_data *ntpdata, const struct
}
if (txc->modes & ADJ_MAXERROR)
- time_maxerror = clamp(txc->maxerror, 0, NTP_PHASE_LIMIT);
+ ntpdata->time_maxerror = clamp(txc->maxerror, 0, NTP_PHASE_LIMIT);
if (txc->modes & ADJ_ESTERROR)
- time_esterror = clamp(txc->esterror, 0, NTP_PHASE_LIMIT);
+ ntpdata->time_esterror = clamp(txc->esterror, 0, NTP_PHASE_LIMIT);
if (txc->modes & ADJ_TIMECONST) {
ntpdata->time_constant = clamp(txc->constant, 0, MAXTC);
@@ -806,8 +800,8 @@ int __do_adjtimex(struct __kernel_timex *txc, const struct timespec64 *ts,
txc->freq = shift_right((time_freq >> PPM_SCALE_INV_SHIFT) *
PPM_SCALE_INV, NTP_SCALE_SHIFT);
- txc->maxerror = time_maxerror;
- txc->esterror = time_esterror;
+ txc->maxerror = ntpdata->time_maxerror;
+ txc->esterror = ntpdata->time_esterror;
txc->status = ntpdata->time_status;
txc->constant = ntpdata->time_constant;
txc->precision = 1;
Powered by blists - more mailing lists