From 3901a5c88a43bbcc8666401aab9754164fe4d29a Mon Sep 17 00:00:00 2001 From: AlmaLinux RelEng Bot Date: Wed, 5 Aug 2026 14:45:00 -0400 Subject: [PATCH] import Oracle_OSS linuxptp-4.4-4.el9_8.1 --- SOURCES/linuxptp-ppsmiss.patch | 79 ----------------------------- SOURCES/linuxptp-rtnlinit.patch | 33 ++++++++++++ SOURCES/linuxptp-staticreconf.patch | 67 ++++++++++++++++++++++++ SPECS/linuxptp.spec | 11 ++-- 4 files changed, 106 insertions(+), 84 deletions(-) delete mode 100644 SOURCES/linuxptp-ppsmiss.patch create mode 100644 SOURCES/linuxptp-staticreconf.patch diff --git a/SOURCES/linuxptp-ppsmiss.patch b/SOURCES/linuxptp-ppsmiss.patch deleted file mode 100644 index b7ec927..0000000 --- a/SOURCES/linuxptp-ppsmiss.patch +++ /dev/null @@ -1,79 +0,0 @@ -commit 4e172c83520852d41e5c2ec3ae324d50c42a0416 -Author: Miroslav Lichvar -Date: Thu Aug 28 15:14:01 2025 +0200 - - ts2phc: Better handle missing pulses with multiple sinks. - - The ts2phc_pps_sink_poll() function waits until it has collected pulses - for all active sinks, or a timeout of 2 seconds between events is - reached. - - If a sink missed a pulse (e.g. after a port state change and switching - PPS signal direction in the external PPS mode) and the next pulse of - that sink came before pulses of the other sinks, it was mixed with - events of the previous pulse and the measured offset had an error of - 1/rate seconds. - - To avoid mixing events corresponding to different pulses, adjust the - poll() timeout so that it waits only up to a third of the pulse period - after the first received event. - - (Rebased to 4.4) - - Reviewed-by: Jacob Keller - Signed-off-by: Miroslav Lichvar - -diff --git a/ts2phc_pps_sink.c b/ts2phc_pps_sink.c -index 9076de9..72d8ea4 100644 ---- a/ts2phc_pps_sink.c -+++ b/ts2phc_pps_sink.c -@@ -381,10 +381,11 @@ void ts2phc_pps_sink_cleanup(struct ts2phc_private *priv) - int ts2phc_pps_sink_poll(struct ts2phc_private *priv) - { - struct ts2phc_sink_array *polling_array = priv->polling_array; -+ bool first_poll = true, ignore_any = false; - bool all_sinks_have_events = false; -- bool ignore_any = false; -+ struct timespec first_ts = {0}, ts; -+ int cnt, timeout; - unsigned int i; -- int cnt; - - for (i = 0; i < priv->n_sinks; i++) - polling_array->collected_events[i] = 0; -@@ -395,7 +396,22 @@ int ts2phc_pps_sink_poll(struct ts2phc_private *priv) - if (!is_running()) - return 0; - -- cnt = poll(polling_array->pfd, priv->n_sinks, 2000); -+ /* -+ * Collect only events within a third of the pulse period to -+ * avoid mixing events corresponding to different pulses. -+ */ -+ if (first_poll) { -+ timeout = 2000; -+ } else { -+ clock_gettime(CLOCK_MONOTONIC, &ts); -+ timeout = 333; -+ timeout -= (ts.tv_sec - first_ts.tv_sec) * 1000 + -+ (ts.tv_nsec - first_ts.tv_nsec) / 1000000; -+ if (timeout < 0) -+ timeout = 0; -+ } -+ -+ cnt = poll(polling_array->pfd, priv->n_sinks, timeout); - if (cnt < 0) { - if (errno == EINTR) { - return 0; -@@ -408,6 +424,11 @@ int ts2phc_pps_sink_poll(struct ts2phc_private *priv) - return 0; - } - -+ if (first_poll) { -+ clock_gettime(CLOCK_MONOTONIC, &first_ts); -+ first_poll = false; -+ } -+ - for (i = 0; i < priv->n_sinks; i++) { - if (polling_array->pfd[i].revents & POLLERR) { - sink = polling_array->sink[i]; diff --git a/SOURCES/linuxptp-rtnlinit.patch b/SOURCES/linuxptp-rtnlinit.patch index 60e011d..cb9b81c 100644 --- a/SOURCES/linuxptp-rtnlinit.patch +++ b/SOURCES/linuxptp-rtnlinit.patch @@ -73,3 +73,36 @@ index 7f945ac..1bb407c 100644 } } +commit 84c2d7f4ef7c0ff9353909194ae03e5a09aa0a12 +Author: Miroslav Lichvar (via linuxptp-devel Mailing List) +Date: Mon May 4 15:32:46 2026 +0200 + + port: Don't request sde on repeated link down event. + + When the link goes down, request a state decision event only when the + link status actually changed (the same status can be received multiple + times due to unrelated events or refresh). + + This fixes an infinite loop when the link is down and BMCA is set to + "noop" due to bmc_state_decision() copying the FAULTY state and + causing port_dispatch() to be called with EV_FAULT_DETECTED, which + triggers an rntl_link_status() call. The netlink response (with no + change in the link status) no longer forces a new state decision event. + + Fixes: a1eae149f519 ("port: Refresh link status on faults.") + Reported-by: Martin Pecka + Signed-off-by: Miroslav Lichvar + +diff --git a/port.c b/port.c +index 90b0860..05aabea 100644 +--- a/port.c ++++ b/port.c +@@ -3042,7 +3042,7 @@ void port_link_status(void *ctx, int linkup, int ts_index) + * A port going down can affect the BMCA result. + * Force a state decision event. + */ +- if (p->link_status & LINK_DOWN) ++ if (p->link_status & LINK_STATE_CHANGED && p->link_status & LINK_DOWN) + clock_set_sde(p->clock, 1); + } + diff --git a/SOURCES/linuxptp-staticreconf.patch b/SOURCES/linuxptp-staticreconf.patch new file mode 100644 index 0000000..9a34b20 --- /dev/null +++ b/SOURCES/linuxptp-staticreconf.patch @@ -0,0 +1,67 @@ +commit bed9f4725de56c2c8518482105a11fb40bbec5df +Author: Miroslav Lichvar +Date: Tue Jun 23 14:54:43 2026 +0200 + + phc2sys: Don't reconfigure static domain. + + When phc2sys is started without the -a and -O options, it creates a + single static domain and uses the pmc agent only to get the TAI-UTC + offset and watch for leap seconds without subscribing to the port state + changes. + + If ptp4l stopped responding to pmc requests for a sufficiently long + interval for the pmc agent to time out (3 missed responses - 180 + seconds), phc2sys logged "Lost connection to ptp4l #1" and stopped + synchronizing the sink clocks. It was stuck in this state even after ptp4l + started responding again. This was caused by the reconfiguration of the + domain, which sets the source clock to NULL when the pmc agent is not + getting updates. + + Add a new parameter to do_loop() to indicate that the domain + configuration is fully static and disable the reconfiguration to avoid + unsetting the source clock. This fixes phc2sys to keep synchronizing the + clocks even when ptp4l is not responding. + + Signed-off-by: Miroslav Lichvar + +diff --git a/phc2sys.c b/phc2sys.c +index 1269d18..ad24db9 100644 +--- a/phc2sys.c ++++ b/phc2sys.c +@@ -845,7 +845,7 @@ static int update_domain_clocks(struct domain *domain) + return 0; + } + +-static int do_loop(struct domain *domains, int n_domains) ++static int do_loop(struct domain *domains, int n_domains, int static_config) + { + int i, state_changed, prev_sub; + struct timespec interval; +@@ -890,7 +890,8 @@ static int do_loop(struct domain *domains, int n_domains) + } + + if (state_changed) { +- reconfigure(domains, n_domains); ++ if (!static_config) ++ reconfigure(domains, n_domains); + state_changed = 0; + } + +@@ -1535,7 +1536,7 @@ int main(int argc, char *argv[]) + goto end; + } + +- r = do_loop(domains, n_domains); ++ r = do_loop(domains, n_domains, 0); + goto end; + } + +@@ -1601,7 +1602,7 @@ int main(int argc, char *argv[]) + servo_sync_interval(dst->servo, 1.0); + r = do_pps_loop(&domains[0], dst, pps_fd); + } else { +- r = do_loop(&domains[0], 1); ++ r = do_loop(&domains[0], 1, 1); + } + + end: diff --git a/SPECS/linuxptp.spec b/SPECS/linuxptp.spec index e9f141d..ed890b1 100644 --- a/SPECS/linuxptp.spec +++ b/SPECS/linuxptp.spec @@ -4,7 +4,7 @@ Name: linuxptp Version: 4.4 -Release: 4%{?dist} +Release: 4%{?dist}.1 Summary: PTP implementation for Linux License: GPL-2.0-or-later @@ -43,8 +43,8 @@ Patch10: linuxptp-rtnlinit.patch Patch11: linuxptp-unirecover.patch # check for EL-specific kernels with vclock support Patch12: linuxptp-vclock.patch -# handle missing pulses in ts2phc -Patch13: linuxptp-ppsmiss.patch +# fix phc2sys to not get stuck in static mode +Patch15: linuxptp-staticreconf.patch BuildRequires: gcc gcc-c++ gnutls-devel make systemd @@ -127,8 +127,9 @@ PATH=..:$PATH ./run %{_mandir}/man8/*.8* %changelog -* Tue Sep 23 2025 Miroslav Lichvar 4.4-4 -- handle missing pulses in ts2phc (RHEL-112193) +* Wed Jul 01 2026 Miroslav Lichvar 4.4-4.el9_8.1 +- fix high CPU usage by ptp4l when link is down (RHEL-191410) +- fix phc2sys to not get stuck in static mode (RHEL-187949) * Wed May 28 2025 Miroslav Lichvar 4.4-3 - fix unicast server to recover after port fault (RHEL-93496)