Files
integ/base/linuxptp/debian/bullseye/patches/0009-sysoff-Retry-on-EBUSY-when-probing-supported-ioctls.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

50 lines
1.4 KiB
Diff

From: Miroslav Lichvar <mlichvar@redhat.com>
Date: Wed, 18 May 2022 11:33:37 +0200
Subject: [PATCH 09/67] sysoff: Retry on EBUSY when probing supported ioctls.
Handle EBUSY when probing support for a PTP_SYS_OFFSET ioctl. Try each
ioctl up to three times before giving up on it to make the detection
more reliable.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
[commit dadd2593c7beaee9eba5828a7bd8a0b5849dd8bb upstream]
Signed-off-by: Douglas Henrique Koerich <douglashenrique.koerich@windriver.com>
Signed-off-by: Andre Mauricio Zelak <andre.zelak@windriver.com>
---
sysoff.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/sysoff.c b/sysoff.c
index a425275..fc1f7ca 100644
--- a/sysoff.c
+++ b/sysoff.c
@@ -145,8 +145,8 @@ int sysoff_measure(int fd, int method, int n_samples,
int sysoff_probe(int fd, int n_samples)
{
int64_t junk, delay;
+ int i, j, err;
uint64_t ts;
- int i;
if (n_samples > PTP_MAX_SAMPLES) {
fprintf(stderr, "warning: %d exceeds kernel max readings %d\n",
@@ -156,9 +156,15 @@ int sysoff_probe(int fd, int n_samples)
}
for (i = 0; i < SYSOFF_LAST; i++) {
- if (sysoff_measure(fd, i, n_samples, &junk, &ts, &delay) < 0)
- continue;
- return i;
+ for (j = 0; j < 3; j++) {
+ err = sysoff_measure(fd, i, n_samples, &junk, &ts,
+ &delay);
+ if (err == -EBUSY)
+ continue;
+ if (err)
+ break;
+ return i;
+ }
}
return SYSOFF_RUN_TIME_MISSING;