From 8445cd91a10817b3fc95fb0a0ce967b1b2b695e2 Mon Sep 17 00:00:00 2001 From: Jim Somerville Date: Thu, 2 Sep 2021 13:56:33 -0400 Subject: [PATCH] Uprev linuxptp to version 3.1.1-1 We use the CentOS 8 version of the source package and apply the same six patches that we applied to the previous version, with one caveat. Patch 3 had an additional test in it of the uncalibrated state, and this test does not exist in the upstream version of the patch. Now patch 3 is identical to the upstream version. All five upstream patches have been refreshed to what was actually accepted upstream and thus now contain proper git headers. The logic of those five patches remain as they were, with the one exception noted in the previous paragraph. Patch 6 has also now been given a proper git header. Change-Id: Ifd44680d2f190dc0c5662bd05bd214fccf50a2fd Story: 2009130 Task: 43199 Signed-off-by: Jim Somerville --- ...te-package-versioning-for-STX-format.patch | 22 ++--- ...-for-default_sync-and-BC-performance.patch | 52 ++++++------ ...e-when-switching-port-with-same-best.patch | 36 ++++++++ ...hen-switching-port-with-same-best-cl.patch | 25 ------ ...lock-check-on-best-clock-port-change.patch | 78 +++++++++++++++++ ...lock-check-on-best-clock-port-change.patch | 67 --------------- ...mestamps-from-uncalibrated-and-slave.patch | 35 -------- ...heck-timestamps-from-non-slave-ports.patch | 39 +++++++++ ...4-Do-not-renew-raw-transport-sockets.patch | 31 ------- .../0004-port-Don-t-renew-raw-transport.patch | 45 ++++++++++ ...clockcheck-Increase-minimum-interval.patch | 36 ++++++++ ...minimum-clockcheck-interval-for-stab.patch | 25 ------ ...sable-default-port-selection-in-phc2.patch | 84 ++++++++++++------- base/linuxptp/centos/srpm_path | 2 +- centos_srpms_3rdparties.lst | 1 + 15 files changed, 330 insertions(+), 248 deletions(-) create mode 100644 base/linuxptp/centos/patches/0001-clock-Reset-state-when-switching-port-with-same-best.patch delete mode 100644 base/linuxptp/centos/patches/0001-p1-Reset-state-when-switching-port-with-same-best-cl.patch create mode 100644 base/linuxptp/centos/patches/0002-clock-Reset-clock-check-on-best-clock-port-change.patch delete mode 100644 base/linuxptp/centos/patches/0002-p2-Reset-clock-check-on-best-clock-port-change.patch delete mode 100644 base/linuxptp/centos/patches/0003-p3-Only-check-timestamps-from-uncalibrated-and-slave.patch create mode 100644 base/linuxptp/centos/patches/0003-port-Don-t-check-timestamps-from-non-slave-ports.patch delete mode 100644 base/linuxptp/centos/patches/0004-p4-Do-not-renew-raw-transport-sockets.patch create mode 100644 base/linuxptp/centos/patches/0004-port-Don-t-renew-raw-transport.patch create mode 100644 base/linuxptp/centos/patches/0005-clockcheck-Increase-minimum-interval.patch delete mode 100644 base/linuxptp/centos/patches/0005-p5-Increase-the-minimum-clockcheck-interval-for-stab.patch diff --git a/base/linuxptp/centos/meta_patches/0001-Update-package-versioning-for-STX-format.patch b/base/linuxptp/centos/meta_patches/0001-Update-package-versioning-for-STX-format.patch index ccade0a34..485fa38b3 100644 --- a/base/linuxptp/centos/meta_patches/0001-Update-package-versioning-for-STX-format.patch +++ b/base/linuxptp/centos/meta_patches/0001-Update-package-versioning-for-STX-format.patch @@ -1,25 +1,27 @@ -From dce66cbf8eb0a132592039934629f4ceea6fed6f Mon Sep 17 00:00:00 2001 +From da79b26cb5749800112c38cb55b1135f78c3433a Mon Sep 17 00:00:00 2001 +Message-Id: From: Cole Walker Date: Mon, 21 Jun 2021 15:24:03 -0400 -Subject: [PATCH] Update package versioning for STX format +Subject: [PATCH 1/2] Update package versioning for STX format +Signed-off-by: Jim Somerville --- SPECS/linuxptp.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SPECS/linuxptp.spec b/SPECS/linuxptp.spec -index 6d97f12..60f340f 100644 +index 5ec953e..903eb79 100644 --- a/SPECS/linuxptp.spec +++ b/SPECS/linuxptp.spec -@@ -3,7 +3,7 @@ - %global clknetsim_ver 8b4842 +@@ -4,7 +4,7 @@ + Name: linuxptp - Version: 2.0 --Release: 2%{?dist} -+Release: 2%{?_tis_dist}.%{tis_patch_ver} + Version: 3.1.1 +-Release: 1%{?dist} ++Release: 1%{?_tis_dist}.%{tis_patch_ver} Summary: PTP implementation for Linux - + Group: System Environment/Base --- +-- 2.29.2 diff --git a/base/linuxptp/centos/meta_patches/0002-STX-patches-for-default_sync-and-BC-performance.patch b/base/linuxptp/centos/meta_patches/0002-STX-patches-for-default_sync-and-BC-performance.patch index 410d7905a..c3e6afd15 100644 --- a/base/linuxptp/centos/meta_patches/0002-STX-patches-for-default_sync-and-BC-performance.patch +++ b/base/linuxptp/centos/meta_patches/0002-STX-patches-for-default_sync-and-BC-performance.patch @@ -1,48 +1,52 @@ -From 2b59f59616f4c9d27ee094f5099011f3015d90c8 Mon Sep 17 00:00:00 2001 +From 51312938b7608b0d5bfff283360f0b9dc52c6ba8 Mon Sep 17 00:00:00 2001 +Message-Id: <51312938b7608b0d5bfff283360f0b9dc52c6ba8.1630421052.git.Jim.Somerville@windriver.com> +In-Reply-To: +References: From: Cole Walker Date: Wed, 23 Jun 2021 13:21:58 -0400 -Subject: [PATCH] STX patches for default_sync and BC performance +Subject: [PATCH 2/2] STX patches for default_sync and BC performance +Signed-off-by: Jim Somerville --- SPECS/linuxptp.spec | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/SPECS/linuxptp.spec b/SPECS/linuxptp.spec -index 3f91582..63c4246 100644 +index 903eb79..e4c01a8 100644 --- a/SPECS/linuxptp.spec +++ b/SPECS/linuxptp.spec -@@ -34,6 +34,18 @@ Patch5: linuxptp-team.patch - Patch6: linuxptp-addreq.patch - # don't leak memory when allocation fails - Patch7: linuxptp-msgput.patch +@@ -37,6 +37,18 @@ Patch7: linuxptp-manfix.patch + Patch8: linuxptp-fclose.patch + # fix handling of zero-length messages + Patch9: linuxptp-zerolength.patch +# StarlingX -+Patch8: 0001-p1-Reset-state-when-switching-port-with-same-best-cl.patch ++Patch10: 0001-clock-Reset-state-when-switching-port-with-same-best.patch +# StarlingX -+Patch9: 0002-p2-Reset-clock-check-on-best-clock-port-change.patch ++Patch11: 0002-clock-Reset-clock-check-on-best-clock-port-change.patch +# StarlingX -+Patch10: 0003-p3-Only-check-timestamps-from-uncalibrated-and-slave.patch ++Patch12: 0003-port-Don-t-check-timestamps-from-non-slave-ports.patch +# StarlingX -+Patch11: 0004-p4-Do-not-renew-raw-transport-sockets.patch ++Patch13: 0004-port-Don-t-renew-raw-transport.patch +# StarlingX -+Patch12: 0005-p5-Increase-the-minimum-clockcheck-interval-for-stab.patch ++Patch14: 0005-clockcheck-Increase-minimum-interval.patch +# StarlingX -+Patch13: 0006-Add-option-to-disable-default-port-selection-in-phc2.patch - - BuildRequires: kernel-headers > 3.10.0-1002 - BuildRequires: systemd-units -@@ -58,6 +70,12 @@ Supporting legacy APIs and other platforms is not a goal. - %patch5 -p1 -b .team - %patch6 -p1 -b .addreq - %patch7 -p1 -b .msgput -+%patch8 -p1 -+%patch9 -p1 ++Patch15: 0006-Add-option-to-disable-default-port-selection-in-phc2.patch + + BuildRequires: kernel-headers > 4.18.0-87 + BuildRequires: systemd +@@ -60,6 +72,12 @@ Supporting legacy APIs and other platforms is not a goal. + %patch7 -p1 -b .manfix + %patch8 -p1 -b .fclose + %patch9 -p1 -b .zerolength +%patch10 -p1 +%patch11 -p1 +%patch12 -p1 +%patch13 -p1 ++%patch14 -p1 ++%patch15 -p1 mv linuxptp-testsuite-%{testsuite_ver}* testsuite mv clknetsim-%{clknetsim_ver}* testsuite/clknetsim - --- + +-- 2.29.2 diff --git a/base/linuxptp/centos/patches/0001-clock-Reset-state-when-switching-port-with-same-best.patch b/base/linuxptp/centos/patches/0001-clock-Reset-state-when-switching-port-with-same-best.patch new file mode 100644 index 000000000..5d5452b10 --- /dev/null +++ b/base/linuxptp/centos/patches/0001-clock-Reset-state-when-switching-port-with-same-best.patch @@ -0,0 +1,36 @@ +From 0389752e3aecf8d2b2743f16ce1408a58088bea9 Mon Sep 17 00:00:00 2001 +Message-Id: <0389752e3aecf8d2b2743f16ce1408a58088bea9.1630418391.git.Jim.Somerville@windriver.com> +From: Miroslav Lichvar +Date: Mon, 31 May 2021 11:07:52 +0200 +Subject: [PATCH 1/6] clock: Reset state when switching port with same best + clock. + +When the best port is changed, but the ID of the best clock doesn't +change (e.g. a passive port is activated on link failure), reset the +current delay and other master/link-specific state to avoid the switch +throwing the clock off. + +Reviewed-by: Jacob Keller +Signed-off-by: Miroslav Lichvar +[commit 7e8eba5332671abfd95d06dd191059eded1d2cca upstream] +Signed-off-by: Jim Somerville +--- + clock.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/clock.c b/clock.c +index c1b0287..d955710 100644 +--- a/clock.c ++++ b/clock.c +@@ -1909,7 +1909,7 @@ static void handle_state_decision_event(struct clock *c) + best_id = c->dds.clockIdentity; + } + +- if (!cid_eq(&best_id, &c->best_id)) { ++ if (!cid_eq(&best_id, &c->best_id) || best != c->best) { + clock_freq_est_reset(c); + tsproc_reset(c->tsproc, 1); + if (!tmv_is_zero(c->initial_delay)) +-- +2.29.2 + diff --git a/base/linuxptp/centos/patches/0001-p1-Reset-state-when-switching-port-with-same-best-cl.patch b/base/linuxptp/centos/patches/0001-p1-Reset-state-when-switching-port-with-same-best-cl.patch deleted file mode 100644 index 8a7f39820..000000000 --- a/base/linuxptp/centos/patches/0001-p1-Reset-state-when-switching-port-with-same-best-cl.patch +++ /dev/null @@ -1,25 +0,0 @@ -From fe89b71514d21e296988c540ed8a11f98307c36c Mon Sep 17 00:00:00 2001 -From: Cole Walker -Date: Wed, 23 Jun 2021 10:20:19 -0400 -Subject: [PATCH 1/6] p1 Reset state when switching port with same best clock - ---- - clock.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/clock.c b/clock.c -index 9bbcefa..9fad542 100644 ---- a/clock.c -+++ b/clock.c -@@ -1737,7 +1737,7 @@ static void handle_state_decision_event(struct clock *c) - cid2str(&best_id)); - } - -- if (!cid_eq(&best_id, &c->best_id)) { -+ if (!cid_eq(&best_id, &c->best_id) || best != c->best) { - clock_freq_est_reset(c); - tsproc_reset(c->tsproc, 1); - if (!tmv_is_zero(c->initial_delay)) --- -2.29.2 - diff --git a/base/linuxptp/centos/patches/0002-clock-Reset-clock-check-on-best-clock-port-change.patch b/base/linuxptp/centos/patches/0002-clock-Reset-clock-check-on-best-clock-port-change.patch new file mode 100644 index 000000000..e37c53295 --- /dev/null +++ b/base/linuxptp/centos/patches/0002-clock-Reset-clock-check-on-best-clock-port-change.patch @@ -0,0 +1,78 @@ +From 1779482f39e6513995b13fdbd350f7aee8495b7e Mon Sep 17 00:00:00 2001 +Message-Id: <1779482f39e6513995b13fdbd350f7aee8495b7e.1630418391.git.Jim.Somerville@windriver.com> +In-Reply-To: <0389752e3aecf8d2b2743f16ce1408a58088bea9.1630418391.git.Jim.Somerville@windriver.com> +References: <0389752e3aecf8d2b2743f16ce1408a58088bea9.1630418391.git.Jim.Somerville@windriver.com> +From: Miroslav Lichvar +Date: Mon, 31 May 2021 11:07:53 +0200 +Subject: [PATCH 2/6] clock: Reset clock check on best clock/port change. + +Reset the clock check when the best clock or port changes, together with +the other state like current estimated delay and frequency. This avoids +false positives if the clock is controlled by an external process when +not synchronized by PTP (e.g. phc2sys -rr). + +Reviewed-by: Jacob Keller +Signed-off-by: Miroslav Lichvar +[commit 262a49b07eaccc0f0237e3cd4df01b185b8f664f upstream] +Signed-off-by: Jim Somerville +--- + clock.c | 2 ++ + clockcheck.c | 9 ++++++++- + clockcheck.h | 6 ++++++ + 3 files changed, 16 insertions(+), 1 deletion(-) + +diff --git a/clock.c b/clock.c +index d955710..49bd4a9 100644 +--- a/clock.c ++++ b/clock.c +@@ -1911,6 +1911,8 @@ static void handle_state_decision_event(struct clock *c) + + if (!cid_eq(&best_id, &c->best_id) || best != c->best) { + clock_freq_est_reset(c); ++ if (c->sanity_check) ++ clockcheck_reset(c->sanity_check); + tsproc_reset(c->tsproc, 1); + if (!tmv_is_zero(c->initial_delay)) + tsproc_set_delay(c->tsproc, c->initial_delay); +diff --git a/clockcheck.c b/clockcheck.c +index d48a578..d0b4714 100644 +--- a/clockcheck.c ++++ b/clockcheck.c +@@ -47,9 +47,16 @@ struct clockcheck *clockcheck_create(int freq_limit) + if (!cc) + return NULL; + cc->freq_limit = freq_limit; ++ clockcheck_reset(cc); ++ return cc; ++} ++ ++void clockcheck_reset(struct clockcheck *cc) ++{ ++ cc->freq_known = 0; + cc->max_freq = -CHECK_MAX_FREQ; + cc->min_freq = CHECK_MAX_FREQ; +- return cc; ++ cc->last_ts = 0; + } + + int clockcheck_sample(struct clockcheck *cc, uint64_t ts) +diff --git a/clockcheck.h b/clockcheck.h +index 78aca48..1ff86eb 100644 +--- a/clockcheck.h ++++ b/clockcheck.h +@@ -33,6 +33,12 @@ struct clockcheck; + */ + struct clockcheck *clockcheck_create(int freq_limit); + ++/** ++ * Reset a clock check. ++ * @param cc Pointer to a clock check obtained via @ref clockcheck_create(). ++ */ ++void clockcheck_reset(struct clockcheck *cc); ++ + /** + * Perform the sanity check on a time stamp. + * @param cc Pointer to a clock check obtained via @ref clockcheck_create(). +-- +2.29.2 + diff --git a/base/linuxptp/centos/patches/0002-p2-Reset-clock-check-on-best-clock-port-change.patch b/base/linuxptp/centos/patches/0002-p2-Reset-clock-check-on-best-clock-port-change.patch deleted file mode 100644 index 2665647a4..000000000 --- a/base/linuxptp/centos/patches/0002-p2-Reset-clock-check-on-best-clock-port-change.patch +++ /dev/null @@ -1,67 +0,0 @@ -From da48222456566d63a940810733ff369895777bda Mon Sep 17 00:00:00 2001 -From: Cole Walker -Date: Wed, 23 Jun 2021 10:21:45 -0400 -Subject: [PATCH 2/6] p2 Reset clock check on best clock port change - ---- - clock.c | 2 ++ - clockcheck.c | 9 ++++++++- - clockcheck.h | 7 +++++++ - 3 files changed, 17 insertions(+), 1 deletion(-) - -diff --git a/clock.c b/clock.c -index 9fad542..7a66770 100644 ---- a/clock.c -+++ b/clock.c -@@ -1739,6 +1739,8 @@ static void handle_state_decision_event(struct clock *c) - - if (!cid_eq(&best_id, &c->best_id) || best != c->best) { - clock_freq_est_reset(c); -+ if (c->sanity_check) -+ clockcheck_reset(c->sanity_check); - tsproc_reset(c->tsproc, 1); - if (!tmv_is_zero(c->initial_delay)) - tsproc_set_delay(c->tsproc, c->initial_delay); -diff --git a/clockcheck.c b/clockcheck.c -index d48a578..544ce9b 100644 ---- a/clockcheck.c -+++ b/clockcheck.c -@@ -47,9 +47,16 @@ struct clockcheck *clockcheck_create(int freq_limit) - if (!cc) - return NULL; - cc->freq_limit = freq_limit; -+ clockcheck_reset(cc); -+ return cc; -+} -+ -+void clockcheck_reset(struct clockcheck *cc) -+{ -+ cc->freq_known = 0; - cc->max_freq = -CHECK_MAX_FREQ; - cc->min_freq = CHECK_MAX_FREQ; -- return cc; -+ cc->last_ts = 0; - } - - int clockcheck_sample(struct clockcheck *cc, uint64_t ts) -diff --git a/clockcheck.h b/clockcheck.h -index 78aca48..6c02ce3 100644 ---- a/clockcheck.h -+++ b/clockcheck.h -@@ -33,6 +33,13 @@ struct clockcheck; - */ - struct clockcheck *clockcheck_create(int freq_limit); - -+/** -+ * Reset a clock check. -+ * @param cc Pointer to a clock check obtained via @ref clockcheck_create(). -+ */ -+void clockcheck_reset(struct clockcheck *cc); -+ -+ - /** - * Perform the sanity check on a time stamp. - * @param cc Pointer to a clock check obtained via @ref clockcheck_create(). --- -2.29.2 - diff --git a/base/linuxptp/centos/patches/0003-p3-Only-check-timestamps-from-uncalibrated-and-slave.patch b/base/linuxptp/centos/patches/0003-p3-Only-check-timestamps-from-uncalibrated-and-slave.patch deleted file mode 100644 index 03374af34..000000000 --- a/base/linuxptp/centos/patches/0003-p3-Only-check-timestamps-from-uncalibrated-and-slave.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 8b4e9d4aad5e3b997838e1186b00403393309d35 Mon Sep 17 00:00:00 2001 -From: Cole Walker -Date: Wed, 23 Jun 2021 10:25:11 -0400 -Subject: [PATCH 3/6] p3 Only check timestamps from uncalibrated and slave - ports - ---- - port.c | 11 +++++++---- - 1 file changed, 7 insertions(+), 4 deletions(-) - -diff --git a/port.c b/port.c -index c945c13..affa48b 100644 ---- a/port.c -+++ b/port.c -@@ -2541,10 +2541,13 @@ static enum fsm_event bc_event(struct port *p, int fd_index) - msg_put(msg); - return EV_NONE; - } -- if (msg_sots_valid(msg)) { -- ts_add(&msg->hwts.ts, -p->rx_timestamp_offset); -- clock_check_ts(p->clock, tmv_to_nanoseconds(msg->hwts.ts)); -- } -+ if (msg_sots_valid(msg)) { -+ ts_add(&msg->hwts.ts, -p->rx_timestamp_offset); -+ if (p->state == PS_SLAVE || p->state == PS_UNCALIBRATED) { -+ clock_check_ts(p->clock, -+ tmv_to_nanoseconds(msg->hwts.ts)); -+ } -+ } - - switch (msg_type(msg)) { - case SYNC: --- -2.29.2 - diff --git a/base/linuxptp/centos/patches/0003-port-Don-t-check-timestamps-from-non-slave-ports.patch b/base/linuxptp/centos/patches/0003-port-Don-t-check-timestamps-from-non-slave-ports.patch new file mode 100644 index 000000000..f3dcde6c6 --- /dev/null +++ b/base/linuxptp/centos/patches/0003-port-Don-t-check-timestamps-from-non-slave-ports.patch @@ -0,0 +1,39 @@ +From a1ed560a712d611edf8b47756bc56542a57bff7d Mon Sep 17 00:00:00 2001 +Message-Id: +In-Reply-To: <0389752e3aecf8d2b2743f16ce1408a58088bea9.1630418391.git.Jim.Somerville@windriver.com> +References: <0389752e3aecf8d2b2743f16ce1408a58088bea9.1630418391.git.Jim.Somerville@windriver.com> +From: Miroslav Lichvar +Date: Mon, 31 May 2021 11:07:54 +0200 +Subject: [PATCH 3/6] port: Don't check timestamps from non-slave ports. + +Don't perform the sanity check on receive timestamps from ports in +non-slave states to avoid false positives in the jbod mode, where +the timestamps can be generated by different clocks. + +Reviewed-by: Jacob Keller +Signed-off-by: Miroslav Lichvar +[commit e117e37e379556fa23337db2518bb44d8793e039 upstream] +Signed-off-by: Jim Somerville +--- + port.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/port.c b/port.c +index 9e9d484..387d5a2 100644 +--- a/port.c ++++ b/port.c +@@ -2731,7 +2731,10 @@ static enum fsm_event bc_event(struct port *p, int fd_index) + } + if (msg_sots_valid(msg)) { + ts_add(&msg->hwts.ts, -p->rx_timestamp_offset); +- clock_check_ts(p->clock, tmv_to_nanoseconds(msg->hwts.ts)); ++ if (p->state == PS_SLAVE) { ++ clock_check_ts(p->clock, ++ tmv_to_nanoseconds(msg->hwts.ts)); ++ } + } + + switch (msg_type(msg)) { +-- +2.29.2 + diff --git a/base/linuxptp/centos/patches/0004-p4-Do-not-renew-raw-transport-sockets.patch b/base/linuxptp/centos/patches/0004-p4-Do-not-renew-raw-transport-sockets.patch deleted file mode 100644 index 372ec2467..000000000 --- a/base/linuxptp/centos/patches/0004-p4-Do-not-renew-raw-transport-sockets.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 9587b2ed9460a6c5fc50166d94cb43814c4c3a32 Mon Sep 17 00:00:00 2001 -From: Cole Walker -Date: Wed, 23 Jun 2021 10:32:41 -0400 -Subject: [PATCH 4/6] p4 Do not renew raw transport sockets - ---- - port.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/port.c b/port.c -index affa48b..c96389a 100644 ---- a/port.c -+++ b/port.c -@@ -1650,6 +1650,14 @@ static int port_renew_transport(struct port *p) - if (!port_is_enabled(p)) { - return 0; - } -+ -+ -+ /* Closing and binding of raw sockets is too slow and unnecessary */ -+ if (transport_type(p->trp) == TRANS_IEEE_802_3) { -+ return 0; -+ } -+ -+ - transport_close(p->trp, &p->fda); - port_clear_fda(p, FD_FIRST_TIMER); - res = transport_open(p->trp, p->iface, &p->fda, p->timestamping); --- -2.29.2 - diff --git a/base/linuxptp/centos/patches/0004-port-Don-t-renew-raw-transport.patch b/base/linuxptp/centos/patches/0004-port-Don-t-renew-raw-transport.patch new file mode 100644 index 000000000..0675f3d99 --- /dev/null +++ b/base/linuxptp/centos/patches/0004-port-Don-t-renew-raw-transport.patch @@ -0,0 +1,45 @@ +From 5caa4d0a9161e6a33e269c8e445b322e4437e6b3 Mon Sep 17 00:00:00 2001 +Message-Id: <5caa4d0a9161e6a33e269c8e445b322e4437e6b3.1630418391.git.Jim.Somerville@windriver.com> +In-Reply-To: <0389752e3aecf8d2b2743f16ce1408a58088bea9.1630418391.git.Jim.Somerville@windriver.com> +References: <0389752e3aecf8d2b2743f16ce1408a58088bea9.1630418391.git.Jim.Somerville@windriver.com> +From: Miroslav Lichvar +Date: Mon, 31 May 2021 11:07:55 +0200 +Subject: [PATCH 4/6] port: Don't renew raw transport. + +Renewing of the transport on announce/sync timeout is needed in the +client-only mode to avoid getting stuck with a broken multicast socket +when the link goes down. + +This shouldn't be necessary with the raw transport. Closing and binding +of raw sockets can apparently be so slow that it triggers a false +positive in the clock check. + +Reported-by: Amar Subramanyam +Signed-off-by: Miroslav Lichvar +Reviewed-by: Jacob Keller +[commit 6df84259647757bc53818a039734f8ff85618c02 upstream] +Signed-off-by: Jim Somerville +--- + port.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/port.c b/port.c +index 387d5a2..d26b87f 100644 +--- a/port.c ++++ b/port.c +@@ -1805,6 +1805,12 @@ static int port_renew_transport(struct port *p) + if (!port_is_enabled(p)) { + return 0; + } ++ ++ /* Closing and binding of raw sockets is too slow and unnecessary */ ++ if (transport_type(p->trp) == TRANS_IEEE_802_3) { ++ return 0; ++ } ++ + transport_close(p->trp, &p->fda); + port_clear_fda(p, FD_FIRST_TIMER); + res = transport_open(p->trp, p->iface, &p->fda, p->timestamping); +-- +2.29.2 + diff --git a/base/linuxptp/centos/patches/0005-clockcheck-Increase-minimum-interval.patch b/base/linuxptp/centos/patches/0005-clockcheck-Increase-minimum-interval.patch new file mode 100644 index 000000000..eca0fdc2c --- /dev/null +++ b/base/linuxptp/centos/patches/0005-clockcheck-Increase-minimum-interval.patch @@ -0,0 +1,36 @@ +From 3bf4f1784fa0a03a252961f400a78d963773f8f5 Mon Sep 17 00:00:00 2001 +Message-Id: <3bf4f1784fa0a03a252961f400a78d963773f8f5.1630611367.git.Jim.Somerville@windriver.com> +In-Reply-To: <0389752e3aecf8d2b2743f16ce1408a58088bea9.1630611367.git.Jim.Somerville@windriver.com> +References: <0389752e3aecf8d2b2743f16ce1408a58088bea9.1630611367.git.Jim.Somerville@windriver.com> +From: Miroslav Lichvar +Date: Mon, 31 May 2021 11:07:56 +0200 +Subject: [PATCH 5/6] clockcheck: Increase minimum interval. + +Increase the minimum check interval to 1 second to measure the frequency +offset more accurately and with default configuration make false +positives less likely due to a heavily overloaded system. + +Signed-off-by: Miroslav Lichvar +Reviewed-by: Jacob Keller +[commit a082bcd700e4955ebaa00d7039bf4bce92048ac4 upstream] +Signed-off-by: Jim Somerville +--- + clockcheck.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/clockcheck.c b/clockcheck.c +index d0b4714..f0141be 100644 +--- a/clockcheck.c ++++ b/clockcheck.c +@@ -23,7 +23,7 @@ + #include "clockcheck.h" + #include "print.h" + +-#define CHECK_MIN_INTERVAL 100000000 ++#define CHECK_MIN_INTERVAL 1000000000 + #define CHECK_MAX_FREQ 900000000 + + struct clockcheck { +-- +2.29.2 + diff --git a/base/linuxptp/centos/patches/0005-p5-Increase-the-minimum-clockcheck-interval-for-stab.patch b/base/linuxptp/centos/patches/0005-p5-Increase-the-minimum-clockcheck-interval-for-stab.patch deleted file mode 100644 index b608a0760..000000000 --- a/base/linuxptp/centos/patches/0005-p5-Increase-the-minimum-clockcheck-interval-for-stab.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 6463b1a125e270d7bdb58d2bf4bc1156bf4aa993 Mon Sep 17 00:00:00 2001 -From: Cole Walker -Date: Wed, 23 Jun 2021 10:33:35 -0400 -Subject: [PATCH 5/6] p5 Increase the minimum clockcheck interval for stability - ---- - clockcheck.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/clockcheck.c b/clockcheck.c -index 544ce9b..2588f7b 100644 ---- a/clockcheck.c -+++ b/clockcheck.c -@@ -23,7 +23,7 @@ - #include "clockcheck.h" - #include "print.h" - --#define CHECK_MIN_INTERVAL 100000000 -+#define CHECK_MIN_INTERVAL 1000000000 - #define CHECK_MAX_FREQ 900000000 - - struct clockcheck { --- -2.29.2 - diff --git a/base/linuxptp/centos/patches/0006-Add-option-to-disable-default-port-selection-in-phc2.patch b/base/linuxptp/centos/patches/0006-Add-option-to-disable-default-port-selection-in-phc2.patch index f8f106d69..f609cd1a8 100644 --- a/base/linuxptp/centos/patches/0006-Add-option-to-disable-default-port-selection-in-phc2.patch +++ b/base/linuxptp/centos/patches/0006-Add-option-to-disable-default-port-selection-in-phc2.patch @@ -1,47 +1,75 @@ -From 9f3a0a3df4346fa15ed6573cc57092baba37354e Mon Sep 17 00:00:00 2001 +From 3a6de7b6208ccc64a20474db15abaac08e99d10b Mon Sep 17 00:00:00 2001 +Message-Id: <3a6de7b6208ccc64a20474db15abaac08e99d10b.1630418391.git.Jim.Somerville@windriver.com> +In-Reply-To: <0389752e3aecf8d2b2743f16ce1408a58088bea9.1630418391.git.Jim.Somerville@windriver.com> +References: <0389752e3aecf8d2b2743f16ce1408a58088bea9.1630418391.git.Jim.Somerville@windriver.com> From: Cole Walker Date: Wed, 23 Jun 2021 11:14:41 -0400 Subject: [PATCH 6/6] Add option to disable default port selection in phc2sys +This change serves to address an issue in phc2sys +where the local ptp clocks are not synced together properly if the local +time is far behind the reference time. This issue occurs when phc2sys +starts and there is no client port currently synced to a grandmaster. In +the original behaviour, phc2sys selects the first configured port and +proceeds to sync all of the other clocks to it by performing the +first_step operation. + +Then ptp4l will evenually lock to the Grandmaster clock, and that +single port will have its time updated to the correct value, but +phc2sys has already performed the first_step operation and will not +step the other clocks again. + +This solution provides an option to disable the selection of a +default port by phc2sys. When no default port is selected, phc2sys waits +for ptp4l to sync to the Grandmaster before bringing the other clocks +into sync with the first_step operation. + +This option is configured via the default_sync +parameter or the -D flag. The default_sync parameter is set to on by +default in order to keep the behaviour the same as upstream linuxptp +but can be configured by users via +system service-parameter-add ptp global default_sync=0 + +Signed-off-by: Jim Somerville --- config.c | 1 + - phc2sys.c | 19 ++++++++++++++----- - 2 files changed, 15 insertions(+), 5 deletions(-) + phc2sys.c | 15 ++++++++++++--- + 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/config.c b/config.c -index 7914ba4..de5e68e 100644 +index ef5e833..cab7e4f 100644 --- a/config.c +++ b/config.c -@@ -273,6 +273,7 @@ struct config_item config_tab[] = { - GLOB_ITEM_STR("userDescription", ""), +@@ -333,6 +333,7 @@ struct config_item config_tab[] = { GLOB_ITEM_INT("utc_offset", CURRENT_UTC_OFFSET, 0, INT_MAX), GLOB_ITEM_INT("verbose", 0, 0, 1), + GLOB_ITEM_INT("write_phase_mode", 0, 0, 1), + GLOB_ITEM_INT("default_sync", 1, 0, 1), }; - + static struct unicast_master_table *current_uc_mtab; diff --git a/phc2sys.c b/phc2sys.c -index b8f1ea0..45dba55 100644 +index a36cbe0..44d6872 100644 --- a/phc2sys.c +++ b/phc2sys.c -@@ -120,6 +120,7 @@ struct node { +@@ -120,6 +120,7 @@ struct phc2sys_private { LIST_HEAD(clock_head, clock) clocks; LIST_HEAD(dst_clock_head, clock) dst_clocks; struct clock *master; + int default_sync; }; - + static struct config *phc2sys_config; -@@ -465,7 +466,7 @@ static void reconfigure(struct node *node) +@@ -437,7 +438,7 @@ static void reconfigure(struct phc2sys_private *priv) } last = c; } - if (dst_cnt > 1 && !src) { -+ if (dst_cnt > 1 && !src && node->default_sync) { ++ if (dst_cnt > 1 && !src && priv->default_sync) { if (!rt || rt->dest_only) { - node->master = last; + priv->master = last; /* Reset to original state in next reconfiguration. */ -@@ -1363,6 +1364,7 @@ static void usage(char *progname) +@@ -1344,6 +1345,7 @@ static void usage(char *progname) " -N [num] number of master clock readings per update (5)\n" " -L [limit] sanity frequency limit in ppb (200000000)\n" " -M [num] NTP SHM segment number (0)\n" @@ -49,7 +77,7 @@ index b8f1ea0..45dba55 100644 " -u [num] number of clock updates in summary stats (0)\n" " -n [num] domain number (0)\n" " -x apply leap seconds by servo instead of kernel\n" -@@ -1383,7 +1385,7 @@ int main(int argc, char *argv[]) +@@ -1364,7 +1366,7 @@ int main(int argc, char *argv[]) struct clock *src, *dst; struct config *cfg; struct option *opts; @@ -57,8 +85,8 @@ index b8f1ea0..45dba55 100644 + int autocfg = 0, c, domain_number = 0, default_sync = 1, index, ntpshm_segment; int pps_fd = -1, print_level = LOG_INFO, r = -1, rt = 0, wait_sync = 0; double phc_rate, tmp; - struct node node = { -@@ -1407,7 +1409,7 @@ int main(int argc, char *argv[]) + struct phc2sys_private priv = { +@@ -1388,7 +1390,7 @@ int main(int argc, char *argv[]) progname = strrchr(argv[0], '/'); progname = progname ? 1+progname : argv[0]; while (EOF != (c = getopt_long(argc, argv, @@ -67,7 +95,7 @@ index b8f1ea0..45dba55 100644 opts, &index))) { switch (c) { case 0: -@@ -1559,6 +1561,12 @@ int main(int argc, char *argv[]) +@@ -1540,6 +1542,12 @@ int main(int argc, char *argv[]) version_show(stdout); config_destroy(cfg); return 0; @@ -80,18 +108,14 @@ index b8f1ea0..45dba55 100644 case 'h': usage(progname); config_destroy(cfg); -@@ -1607,8 +1615,9 @@ int main(int argc, char *argv[]) +@@ -1588,6 +1596,7 @@ int main(int argc, char *argv[]) } - node.kernel_leap = config_get_int(cfg, NULL, "kernel_leap"); - node.sanity_freq_limit = config_get_int(cfg, NULL, "sanity_freq_limit"); -- -- if (autocfg) { -+ node.default_sync = config_get_int(cfg, NULL, "default_sync"); -+ -+ if (autocfg) { - if (init_pmc(cfg, &node)) - goto end; - if (auto_init_ports(&node, rt) < 0) --- + priv.kernel_leap = config_get_int(cfg, NULL, "kernel_leap"); + priv.sanity_freq_limit = config_get_int(cfg, NULL, "sanity_freq_limit"); ++ priv.default_sync = config_get_int(cfg, NULL, "default_sync"); + + if (autocfg) { + if (init_pmc(cfg, &priv)) +-- 2.29.2 diff --git a/base/linuxptp/centos/srpm_path b/base/linuxptp/centos/srpm_path index f65c44822..c35978776 100644 --- a/base/linuxptp/centos/srpm_path +++ b/base/linuxptp/centos/srpm_path @@ -1 +1 @@ -mirror:Source/linuxptp-2.0-2.el7.src.rpm +mirror:Source/linuxptp-3.1.1-1.el8.src.rpm diff --git a/centos_srpms_3rdparties.lst b/centos_srpms_3rdparties.lst index a8b14279b..00afdc8e0 100644 --- a/centos_srpms_3rdparties.lst +++ b/centos_srpms_3rdparties.lst @@ -1,2 +1,3 @@ libvirt-python-4.7.0-1.fc28.src.rpm#https://libvirt.org/sources/python/libvirt-python-4.7.0-1.fc28.src.rpm +linuxptp-3.1.1-1.el8.src.rpm#http://vault.centos.org/8-stream/AppStream/Source/SPackages/linuxptp-3.1.1-1.el8.src.rpm python-daemon-2.2.3-7.el8.src.rpm#http://vault.centos.org/8.0.1905/virt/Source/ovirt-44/python-daemon-2.2.3-7.el8.src.rpm