integ/base/linuxptp/debian/patches/0031-pmc_agent-Let-the-update-method-poll-for-push-events.patch
Cole Walker aca42c6d4c Implement logic to skip updates with offset spike in ts2phc.
This change allows ts2phc to be configured to ignore timing updates that
have a large offset spike in order to mitigate the resulting timing
skew.

In some circumstances on realtime systems with high CPU load, the
timestamp consumed by ts2phc can be delayed in reaching ts2phc and
results in the offset calculation attempting to speed the clock up by a
large margin.

This change causes ts2phc to ignore updates that would greatly skew the
clock when ts2phc is already in a synchronized state.

The global configuration option "max_phc_update_skip_cnt" is provided to
allow users to specify how many consecutive offset spike incidents will
be ignored before adjusting the clock. The default value is 120. The
behaviour can be disabled by setting max_phc_update_skip_cnt to 0.

This code is ported from a proposed upstream patch found here:
https://sourceforge.net/p/linuxptp/mailman/message/44114092/

Test-plan:
Pass: Verify linuxptp package build
Pass: Deploy ts2phc binary and verify system time sync
Pass: Manually trigger offset spike and verify that ts2phc maintains
stable time sync

Closes-bug: https://bugs.launchpad.net/starlingx/+bug/2059955

Change-Id: I13cd5c3440682ec9256e11449fe62d5fe28f66fa
Signed-off-by: Cole Walker <cole.walker@windriver.com>
2024-04-01 14:53:06 -04:00

58 lines
1.6 KiB
Diff

From 25d6be54bba7b2e9871da9700103a483ff355892 Mon Sep 17 00:00:00 2001
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Mon, 12 Jun 2023 17:32:27 -0300
Subject: [PATCH 31/58] pmc_agent: Let the update method poll for push events.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
[commit c4a5eef1f4763805e6e2a2d25eb1d436018d4745 upstream]
Signed-off-by: Andre Mauricio Zelak <andre.zelak@windriver.com>
---
pmc_agent.c | 3 +++
pmc_agent.h | 5 +++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/pmc_agent.c b/pmc_agent.c
index aa2347d..6e6627d 100644
--- a/pmc_agent.c
+++ b/pmc_agent.c
@@ -390,6 +390,7 @@ int pmc_agent_subscribe(struct pmc_agent *node, int timeout)
int pmc_agent_update(struct pmc_agent *node)
{
+ struct ptp_message *msg;
struct timespec tp;
uint64_t ts;
@@ -411,6 +412,8 @@ int pmc_agent_update(struct pmc_agent *node)
}
}
+ run_pmc(node, 0, -1, &msg);
+
return 0;
}
diff --git a/pmc_agent.h b/pmc_agent.h
index f0e2c7a..dd34d30 100644
--- a/pmc_agent.h
+++ b/pmc_agent.h
@@ -141,11 +141,12 @@ void pmc_agent_set_sync_offset(struct pmc_agent *agent, int offset);
int pmc_agent_subscribe(struct pmc_agent *agent, int timeout);
/**
- * Queries the local ptp4l instance to update the TAI-UTC offset and
- * the current leap second flags.
+ * Polls for push notifications from the local ptp4l service.
*
* In addition:
*
+ * - Queries the local ptp4l instance to update the TAI-UTC offset and
+ * the current leap second flags.
* - Any active port state subscription will be renewed.
* - The port state notification callback might be invoked.
*
--
2.30.2