Files
integ/base/linuxptp/debian/bullseye/patches/0057-Fix-uninitialized-variable-in-nmea_scan_rmc.patch
Andre Mauricio Zelak 1fff0107f2 phc2sys: Downgrade log message about timeout reading pmc dds,
tpd and pds

Depending upon system load, the read pmc call can timeout. When
it happens the corresponding data set is reset, allowing the HA
algorithm to switch over the current source.

Although the read timeout is undesirable, the error message is
misleading because the failure is mitigated. Downgrade the error
message to notice to disable it in the default log level.

Test Plan:
PASS: Deploy T-BC with single PTP4L instance
 - Load system (stress -c 64 -m 5 -t 60)
   check user.log, phc2sys not showing the error message
   phc2sys: notice [1200995.017] phc-inst2 pmc agent index 0, timeout reading pmc tpd

PASS: Deploy T-BC with single PTP4L instance
 - Adjust the log to debug level
 system ptp-instance-parameter-add phc-inst2 logging_level=7
 - Load system (stress -c 64 -m 5 -t 60)
   check user.log, phc2sys eventually shows the error message
   phc2sys: notice [1215208.628] phc-inst2 pmc agent index 0, timeout reading pmc tpd

PASS: Build linuxptp package

Closes-Bug: 2132273

Change-Id: I3e05de4006c0e35b725178d9e56eaf8c72d52747
Signed-off-by: Andre Mauricio Zelak <andre.zelak@windriver.com>
2025-11-25 17:07:25 -03:00

32 lines
1.0 KiB
Diff

From: cwalker <cole.walker@windriver.com>
Date: Fri, 1 Mar 2024 17:50:29 +0000
Subject: [PATCH 57/67] Fix uninitialized variable in nmea_scan_rmc
Initialize the tm_isdst variable to ensure that mktime does not fail on
recent versions of glibc.
This change initializes tm_isdst to 0 for compatibility with UTC.
Previously, a positive value in the uninitialized tm_isdst would cause
mktime to fail and ts2phc would repeatedly log "invalid master time
stamp". This resulted in intermittent synchronization errors.
[commit 63fc1ef4fd5e5fc45dd4de3bf27920bb109a4357 upstream]
Signed-off-by: cwalker <cole.walker@windriver.com>
---
nmea.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/nmea.c b/nmea.c
index dc865d0..44c7c01 100644
--- a/nmea.c
+++ b/nmea.c
@@ -157,6 +157,7 @@ static int nmea_scan_rmc(struct nmea_parser *np, struct nmea_rmc *result)
}
tm.tm_year += 100;
tm.tm_mon--;
+ tm.tm_isdst = 0;
result->ts.tv_sec = mktime(&tm);
result->ts.tv_nsec = msec * 1000000UL;
result->fix_valid = status == 'A' ? true : false;