fix high CPU usage by ptp4l when link is down (RHEL-173418)

Resolves: RHEL-173418
This commit is contained in:
Miroslav Lichvar 2026-05-20 10:36:07 +02:00
parent 761eff8cc7
commit b5bde8168d

View File

@ -73,3 +73,36 @@ index 7f945ac..1bb407c 100644
}
}
commit 7fa512ad83302dc139215d02c527e03269319b57
Author: Miroslav Lichvar (via linuxptp-devel Mailing List) <linuxptp-devel@lists.nwtime.org>
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 <peckama2@fel.cvut.cz>
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
diff --git a/port.c b/port.c
index 5eea2f2..b2e588f 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);
}