Hello,

we are syncronizing devices using ptp. The absolute time is not
relevant but all devices should be close to each other.

Furthermore devices are connected and disconnected at any time and most
of the time there is no real grandmaster clock with higher priority.

As a result, a new connected device may became ptp grandmaster and all
others adjust there time.

If the new grandmaster is waaaay back in time, phc2sys refuses to set
the clock. I found the reason in the kernel and created a patch you can
find attached.

What do you think about that? For my understanding it would be okay to
step the realtime clock backwards even below 0 because the value
holding the sceonds is a signed int variable.


Best regards,
Matthias

Hottinger Baldwin Messtechnik GmbH, Im Tiefen See 45, 64293 Darmstadt, Germany 
| www.hbm.com

Registered as GmbH (German limited liability corporation) in the commercial 
register at the local court of Darmstadt, HRB 1147
Company domiciled in Darmstadt | Managing Director: Andreas Huellhorst | 
Chairman of the board: Eoghan O�Lionaird

Als Gesellschaft mit beschraenkter Haftung eingetragen im Handelsregister des 
Amtsgerichts Darmstadt unter HRB 1147
Sitz der Gesellschaft: Darmstadt | Geschaeftsfuehrung: Andreas Huellhorst | 
Aufsichtsratsvorsitzender: Eoghan O�Lionaird

The information in this email is confidential. It is intended solely for the 
addressee. If you are not the intended recipient, please let me know and delete 
this email.

Die in dieser E-Mail enthaltene Information ist vertraulich und lediglich fuer 
den Empfaenger bestimmt. Sollten Sie nicht der eigentliche Empfaenger sein, 
informieren Sie mich bitte kurz und loeschen diese E-Mail.
From 7de00c7bfb577964ec04ba4e25d1fe686116ff40 Mon Sep 17 00:00:00 2001
From: Matthias Loy <matthias....@hbm.com>
Date: Sat, 13 Jan 2018 17:14:26 +0100
Subject: [PATCH] timekeeping-allow-jump-backwards-or-with-zero-distance

---
 kernel/time/timekeeping.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 5018482..a49eb1f 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -1274,9 +1274,9 @@ int timekeeping_inject_offset(struct timespec *ts)
 	timekeeping_forward_now(tk);
 
 	/* Make sure the proposed value is valid */
+	/* HBM: Allow to go backward in time or setting the same value */
 	tmp = timespec64_add(tk_xtime(tk),  ts64);
-	if (timespec64_compare(&tk->wall_to_monotonic, &ts64) > 0 ||
-	    !timespec64_valid_strict(&tmp)) {
+	if (!timespec64_valid_strict(&tmp)) {
 		ret = -EINVAL;
 		goto error;
 	}
-- 
2.14.1

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to