Re: [Linuxptp-devel] Stepping the time backwards with phc2sys
On Tue, Jan 23, 2018 at 07:38:57AM -0600, Mike Lynch wrote: > Unless I'm missing something, without rebooting devices A and/or B, how does > setting the time in the boot scripts for devices A and/or B fix this? The issue is not the large backwards jump but rather trying to jump back before 1970, hm? Thanks, Richard -- 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
Re: [Linuxptp-devel] Stepping the time backwards with phc2sys
On 1/22/2018 9:56 PM, Richard Cochran wrote: On Mon, Jan 15, 2018 at 04:59:13PM +, Loy, Matthias wrote: 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 wy 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. I doubt your patch would find acceptance on the lkml. The check is a sanity check that makes sense for most use cases. You can work around this issue by setting some arbitrary date, like 1984, as part of your boot scripts. Thanks, Richard -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://atpscan.global.hornetsecurity.com/index.php?atp_str=Xe-YjC9OASLZ0J6-KhBFV2LpYIC_NJr0MMTvDNq4058DtJ6eiEsHK9FWviDmAHe0FYADXT5opOuddfBv9ZTqUZup4VkEU5InRMKtVmOONsxd-SdDJOz8koLkDTPpLVFhsOtHdnMB3PkiB96m_9POZkUy2vnl7UCxmpGYhLXc0JkLGHB80Fr9zCWRtaoJU3AN7toG-rPI-fL0qNL1kE9U0r-M2UwPiAAG_0aejfFIw1HN19k4bsGtikQs5DoVsCedpQfQD8I9LoqyHgG4Xz-7Jhc_KkGBIjIqW4ShXsQUPH32lxYuIzo6IzFkZGFkZTMyYzFkNCM6OiM9qfMAzRxlmQkc0BE-WjLN ___ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel I'm not sure how that workaround fixes the issue. As I understand it Mathias' issue is the following: Device A PTP synchronized to Device B (time is now) Device C comes on line and becomes PTP master (time is way in the past) Device A (and probably B) can not set their clocks due to the large negative jump. Unless I'm missing something, without rebooting devices A and/or B, how does setting the time in the boot scripts for devices A and/or B fix this? Mike -- 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
Re: [Linuxptp-devel] Stepping the time backwards with phc2sys
On Mon, Jan 15, 2018 at 04:59:13PM +, Loy, Matthias wrote: > 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 wy 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. I doubt your patch would find acceptance on the lkml. The check is a sanity check that makes sense for most use cases. You can work around this issue by setting some arbitrary date, like 1984, as part of your boot scripts. Thanks, Richard -- 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
[Linuxptp-devel] Stepping the time backwards with phc2sys
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 wy 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 LoyDate: 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(>wall_to_monotonic, ) > 0 || - !timespec64_valid_strict()) { + if (!timespec64_valid_strict()) { 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