Thread: [Linuxptp-users] Should Linux PTP syn the clock used by date between PCs?
PTP IEEE 1588 stack for Linux
Brought to you by:
rcochran
From: Gil G. <Gil...@ha...> - 2015-11-11 07:30:24
|
Hi, If 2 PCs on the same Lan are running Linux PTP, should the clock that is used by "date" be the same after a while? Here is my use case: * I am using 2 Linux CentOs7 PCs. * I have used the date -s @[some value] to make sure they have an offset of few seconds between them. * I am running ptp4l -I eth0 on both of my PCs. * I can see that PC 1 becomes slave, and PC 2 become master using WireShark. * I have disabled NTP on both PCs by stopping the chronyd service (to make sure NTP will not sync my PCs clock). * I am running "while true; do date +%s; sleep 1; done" on both machines to see the time continuously. * I don't see the time being sync between them. * When NTP is enabled, I do see the time being sync between them. Please let me know what I am missing here. Thanks, Gil. |
From: Richard C. <ric...@gm...> - 2015-11-11 09:53:03
|
On Wed, Nov 11, 2015 at 07:15:50AM +0000, Gil Graiber wrote: > Please let me know what I am missing here. You need to run phc2sys as well. See section 22.5 of: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/ch-Configuring_PTP_Using_ptp4l.html Thanks, Richard |
From: Gil G. <Gil...@ha...> - 2015-11-11 10:30:14
|
Thanks. -----Original Message----- From: Richard Cochran [mailto:ric...@gm...] Sent: Wednesday, November 11, 2015 11:53 AM To: Gil Graiber Cc: lin...@li... Subject: Re: [Linuxptp-users] Should Linux PTP syn the clock used by date between PCs? On Wed, Nov 11, 2015 at 07:15:50AM +0000, Gil Graiber wrote: > Please let me know what I am missing here. You need to run phc2sys as well. See section 22.5 of: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/ch-Configuring_PTP_Using_ptp4l.html Thanks, Richard |
From: Gil G. <Gil...@ha...> - 2015-11-11 12:38:46
|
Hi, I run: ptp4l -i eth0 -m The prints looks OK (even after hours). Once I run phc2sys -r -a Or phc2sys -s eth0 -c CLOCK_REALTIME -w After few seconds I get the print "clockcheck: clock jumped forward or running faster than expected!" and the system clock start to drift massively: ptp4l[255560.398]: master offset 676 s2 freq -4570 path delay 69049 ptp4l[255561.498]: master offset -2347 s2 freq -7390 path delay 69049 ptp4l[255562.598]: master offset 976 s2 freq -4771 path delay 68625 ptp4l[255563.698]: master offset 792 s2 freq -4663 path delay 68302 ptp4l[255564.798]: master offset -1660 s2 freq -6877 path delay 68328 ptp4l[255565.898]: master offset 986 s2 freq -4729 path delay 68328 ptp4l[255566.998]: master offset 1813 s2 freq -3606 path delay 68328 ptp4l[255568.098]: master offset -802 s2 freq -5677 path delay 68328 ptp4l[255569.198]: master offset -2512 s2 freq -7628 path delay 68328 ptp4l[255570.257]: master offset 1082 s2 freq -4787 path delay 68328 ptp4l[255571.257]: master offset -979 s2 freq -6524 path delay 68423 ptp4l[255572.257]: master offset 1430 s2 freq -4409 path delay 68023 ptp4l[255573.257]: master offset 1380 s2 freq -4030 path delay 68018 ptp4l[255574.257]: master offset -896 s2 freq -5892 path delay 68258 ptp4l[255575.257]: master offset -1701 s2 freq -6965 path delay 68156 ptp4l[255576.257]: master offset 160 s2 freq -5615 path delay 67869 ptp4l[255577.257]: master offset 1900 s2 freq -3827 path delay 67869 ptp4l[255578.257]: master offset -276 s2 freq -5433 path delay 68156 ptp4l[255579.258]: master offset -16570 s2 freq -21809 path delay 68352 ptp4l[255580.257]: master offset 15759 s2 freq +5549 path delay 68352 ptp4l[255581.257]: master offset 3349 s2 freq -2134 path delay 68352 ptp4l[255582.258]: master offset -37 s2 freq -4515 path delay 68352 ptp4l[255583.258]: master offset 599 s2 freq -3890 path delay 67887 ptp4l[255584.258]: master offset -1495 s2 freq -5804 path delay 67887 ptp4l[255585.258]: master offset -16125 s2 freq -20883 path delay 67887 ptp4l[255586.258]: master offset 13107 s2 freq +3512 path delay 67887 ptp4l[255587.258]: master offset 5316 s2 freq -347 path delay 68576 ptp4l[255588.257]: clockcheck: clock jumped forward or running faster than expected! ptp4l[255588.258]: master offset 70368744178878 s0 freq -347 path delay 68698 ptp4l[255588.258]: port 1: SLAVE to UNCALIBRATED on SYNCHRONIZATION_FAULT ptp4l[255589.298]: master offset 70368744172220 s2 freq -10726 path delay 68803 ptp4l[255589.298]: port 1: UNCALIBRATED to SLAVE on MASTER_CLOCK_SELECTED ptp4l[255590.398]: master offset 70368744177775 s2 freq +599999999 path delay 68571 ptp4l[255591.498]: master offset 70368144943071 s2 freq +599999999 path delay 69310 ptp4l[255592.598]: master offset 70367544898866 s2 freq +599999999 path delay 69537 ptp4l[255593.698]: master offset 70366777805460 s2 freq +599999999 path delay 167158974 ptp4l[255594.799]: master offset 70366112026779 s2 freq +599999999 path delay 232895611 ptp4l[255595.897]: master offset 70365512006329 s2 freq +599999999 path delay 232895611 ptp4l[255596.997]: master offset 70364912009291 s2 freq +599999999 path delay 232895611 ptp4l[255598.097]: master offset 70364316550321 s2 freq +599999999 path delay 228339469 ptp4l[255599.197]: master offset 70363716523526 s2 freq +599999999 path delay 228339469 ptp4l[255600.299]: master offset 70363146133821 s2 freq +599999999 path delay 198722273 ptp4l[255601.399]: master offset 70362614622829 s2 freq +599999999 path delay 130220724 ptp4l[255602.499]: master offset 70362014594252 s2 freq +599999999 path delay 130220724 ptp4l[255603.599]: master offset 70361463936355 s2 freq +599999999 path delay 80864615 ptp4l[255604.699]: master offset 70360821948535 s2 freq +599999999 path delay 122846594 ptp4l[255605.799]: master offset 70360185745813 s2 freq +599999999 path delay 159029525 ptp4l[255606.899]: master offset 70359643657491 s2 freq +599999999 path delay 101100329 ptp4l[255607.999]: master offset 70359043651445 s2 freq +599999999 path delay 101100329 ptp4l[255609.099]: master offset 70358385722044 s2 freq +599999999 path delay 159029525 ptp4l[255610.199]: master offset 70357785694140 s2 freq +599999999 path delay 159029525 ptp4l[255611.299]: master offset 70357185673221 s2 freq +599999999 path delay 159029525 ptp4l[255612.399]: master offset 70356585668163 s2 freq +599999999 path delay 159029525 ptp4l[255613.499]: master offset 70355985670433 s2 freq +599999999 path delay 159029525 ptp4l[255614.599]: master offset 70355385634734 s2 freq +599999999 path delay 159029525 ptp4l[255615.699]: master offset 70354785619993 s2 freq +599999999 path delay 159029525 What can I do to solve this problem? Thanks, Gil. ________________________________________ From: Richard Cochran <ric...@gm...> Sent: Wednesday, November 11, 2015 11:52 AM To: Gil Graiber Cc: lin...@li... Subject: Re: [Linuxptp-users] Should Linux PTP syn the clock used by date between PCs? On Wed, Nov 11, 2015 at 07:15:50AM +0000, Gil Graiber wrote: > Please let me know what I am missing here. You need to run phc2sys as well. See section 22.5 of: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/ch-Configuring_PTP_Using_ptp4l.html Thanks, Richard |
From: Richard C. <ric...@gm...> - 2015-11-11 14:05:52
|
On Wed, Nov 11, 2015 at 12:38:38PM +0000, Gil Graiber wrote: > Hi, > > I run: > ptp4l -i eth0 -m > The prints looks OK (even after hours). > Once I run > phc2sys -r -a > Or > phc2sys -s eth0 -c CLOCK_REALTIME -w Are you perhaps running phc2sys like that on the master? Please show us the phc2sys output, with -m. For example, on my PC, I run ptp4l, and it locks to my GPS/PTP master with output like what you posted. Then, I start phc2sys, also on my PC, and I see: # ./phc2sys -m -q -r -a phc2sys[19289.292]: reconfiguring after port state change phc2sys[19289.293]: selecting CLOCK_REALTIME for synchronization phc2sys[19289.293]: selecting eth6 as the master clock phc2sys[19289.293]: phc offset 61893 s0 freq +11746 delay 5743 phc2sys[19290.293]: phc offset 61937 s1 freq +11790 delay 5698 phc2sys[19291.293]: phc offset 674 s2 freq +12464 delay 5574 phc2sys[19292.293]: phc offset 715 s2 freq +12707 delay 5694 phc2sys[19293.293]: phc offset -209 s2 freq +11998 delay 5748 phc2sys[19294.294]: phc offset -546 s2 freq +11598 delay 5575 phc2sys[19295.294]: phc offset 293 s2 freq +12273 delay 5758 phc2sys[19296.294]: phc offset 174 s2 freq +12242 delay 5719 and so on. Thanks, Richard |
From: Gil G. <Gil...@ha...> - 2015-11-11 14:44:31
|
I run phc2sys like this on the master and the slave. I guess I don't really know how to run and what to run on each PC. My goal is to sync the system clock between both PCs, what do Ineed to do on each of them to do that? here is the log you asked for: [root@localhost ~]# phc2sys -m -q -r -a phc2sys[263300.449]: reconfiguring after port state change phc2sys[263300.449]: selecting CLOCK_REALTIME for synchronization phc2sys[263300.449]: selecting eth0 as the master clock phc2sys[263300.449]: phc offset 97993134 s0 freq -18158 delay 2235 phc2sys[263301.450]: phc offset 97996456 s1 freq -14837 delay 2305 phc2sys[263302.450]: phc offset 19470 s2 freq +4633 delay 2374 phc2sys[263303.450]: phc offset 15047 s2 freq +6051 delay 2374 phc2sys[263304.450]: phc offset 6788 s2 freq +2307 delay 2305 phc2sys[263305.450]: phc offset -1351 s2 freq -3796 delay 2304 phc2sys[263306.451]: phc offset -5743 s2 freq -8593 delay 2305 phc2sys[263307.451]: phc offset -11472 s2 freq -16045 delay 2305 phc2sys[263308.451]: phc offset 8490 s2 freq +475 delay 2374 phc2sys[263309.451]: phc offset 7564 s2 freq +2096 delay 2305 phc2sys[263310.451]: phc offset -1164 s2 freq -4363 delay 2374 phc2sys[263311.451]: phc offset -9589 s2 freq -13137 delay 2235 phc2sys[263312.452]: phc offset 9205 s2 freq +2780 delay 2305 phc2sys[263313.452]: phc offset 4075 s2 freq +412 delay 2304 phc2sys[263314.452]: phc offset -8 s2 freq -2449 delay 2305 phc2sys[263315.452]: phc offset -4963 s2 freq -7406 delay 2305 phc2sys[263316.452]: phc offset -12206 s2 freq -16138 delay 2305 phc2sys[263317.453]: phc offset 8407 s2 freq +813 delay 2305 phc2sys[263318.453]: phc offset 3129 s2 freq -1943 delay 2305 phc2sys[263319.453]: phc offset -11670 s2 freq -15803 delay 2304 phc2sys[263320.453]: phc offset -717 s2 freq -8351 delay 2305 phc2sys[263321.453]: phc offset 16022 s2 freq +8173 delay 2305 phc2sys[263322.453]: phc offset 7991 s2 freq +4949 delay 2304 phc2sys[263323.454]: phc offset -901 s2 freq -1546 delay 2305 phc2sys[263324.454]: phc offset -5239 s2 freq -6154 delay 2305 phc2sys[263325.454]: phc offset -3604 s2 freq -6091 delay 2374 phc2sys[263326.454]: phc offset -2364 s2 freq -5932 delay 2304 phc2sys[263327.454]: phc offset -900 s2 freq -5177 delay 2305 phc2sys[263328.454]: phc offset 74 s2 freq -4473 delay 2235 phc2sys[263329.455]: phc offset -70368744178346 s2 freq -100000000 delay 2375 phc2sys[263330.473]: port fcaa14.fffe.705813-1 changed state phc2sys[263330.473]: reconfiguring after port state change phc2sys[263330.473]: master clock not ready, waiting... phc2sys[263331.484]: port fcaa14.fffe.705813-1 changed state phc2sys[263331.484]: reconfiguring after port state change phc2sys[263331.484]: selecting CLOCK_REALTIME for synchronization phc2sys[263331.484]: selecting eth0 as the master clock phc2sys[263331.484]: phc offset -70368560279091 s2 freq -100000000 delay 2535 phc2sys[263332.485]: phc offset -70368469338890 s2 freq -100000000 delay 2536 phc2sys[263333.495]: phc offset -70367843327064 s2 freq -100000000 delay 2535 phc2sys[263334.505]: phc offset -70367200755567 s2 freq -100000000 delay 2459 phc2sys[263335.595]: phc offset -70366506841458 s2 freq -100000000 delay 2612 phc2sys[263336.611]: phc offset -70365860214766 s2 freq -100000000 delay 2535 phc2sys[263337.628]: phc offset -70365213078895 s2 freq -100000000 delay 2458 phc2sys[263338.642]: phc offset -70364567712097 s2 freq -100000000 delay 2612 phc2sys[263339.656]: phc offset -70363922799511 s2 freq -100000000 delay 2535 phc2sys[263340.668]: phc offset -70363278531449 s2 freq -100000000 delay 2535 phc2sys[263341.679]: phc offset -70362635113063 s2 freq -100000000 delay 2535 phc2sys[263342.689]: phc offset -70361992822666 s2 freq -100000000 delay 2535 phc2sys[263343.696]: phc offset -70361351911962 s2 freq -100000000 delay 2535 phc2sys[263344.702]: phc offset -70360711215837 s2 freq -100000000 delay 2535 phc2sys[263345.704]: phc offset -70360074141392 s2 freq -100000000 delay 2535 phc2sys[263346.704]: phc offset -70359437587138 s2 freq -100000000 delay 2535 phc2sys[263347.791]: phc offset -70358745478137 s2 freq -100000000 delay 2535 phc2sys[263348.856]: phc offset -70358068325985 s2 freq -100000000 delay 2459 phc2sys[263349.858]: phc offset -70357430511310 s2 freq -100000000 delay 2536 phc2sys[263350.940]: phc offset -70356741846988 s2 freq -100000000 delay 2536 phc2sys[263351.940]: phc offset -70356105187998 s2 freq -100000000 delay 2536 phc2sys[263352.965]: phc offset -70355453047006 s2 freq -100000000 delay 2535 phc2sys[263353.967]: phc offset -70354815788362 s2 freq -100000000 delay 2535 phc2sys[263355.023]: phc offset -70354143449305 s2 freq -100000000 delay 2535 phc2sys[263356.030]: phc offset -70353502918268 s2 freq -100000000 delay 2535 phc2sys[263357.036]: phc offset -70352862758153 s2 freq -100000000 delay 2535 phc2sys[263358.062]: phc offset -70352209533328 s2 freq -100000000 delay 2535 phc2sys[263359.063]: phc offset -70351572755646 s2 freq -100000000 delay 2535 phc2sys[263360.079]: phc offset -70350926122291 s2 freq -100000000 delay 2535 ^Cphc2sys[263360.774]: phc offset -70350483892841 s2 freq -100000000 delay 2459 Thanks, Gil. ________________________________________ From: Richard Cochran <ric...@gm...> Sent: Wednesday, November 11, 2015 4:05 PM To: Gil Graiber Cc: lin...@li... Subject: Re: [Linuxptp-users] Should Linux PTP syn the clock used by date between PCs? On Wed, Nov 11, 2015 at 12:38:38PM +0000, Gil Graiber wrote: > Hi, > > I run: > ptp4l -i eth0 -m > The prints looks OK (even after hours). > Once I run > phc2sys -r -a > Or > phc2sys -s eth0 -c CLOCK_REALTIME -w Are you perhaps running phc2sys like that on the master? Please show us the phc2sys output, with -m. For example, on my PC, I run ptp4l, and it locks to my GPS/PTP master with output like what you posted. Then, I start phc2sys, also on my PC, and I see: # ./phc2sys -m -q -r -a phc2sys[19289.292]: reconfiguring after port state change phc2sys[19289.293]: selecting CLOCK_REALTIME for synchronization phc2sys[19289.293]: selecting eth6 as the master clock phc2sys[19289.293]: phc offset 61893 s0 freq +11746 delay 5743 phc2sys[19290.293]: phc offset 61937 s1 freq +11790 delay 5698 phc2sys[19291.293]: phc offset 674 s2 freq +12464 delay 5574 phc2sys[19292.293]: phc offset 715 s2 freq +12707 delay 5694 phc2sys[19293.293]: phc offset -209 s2 freq +11998 delay 5748 phc2sys[19294.294]: phc offset -546 s2 freq +11598 delay 5575 phc2sys[19295.294]: phc offset 293 s2 freq +12273 delay 5758 phc2sys[19296.294]: phc offset 174 s2 freq +12242 delay 5719 and so on. Thanks, Richard |
From: Richard C. <ric...@gm...> - 2015-11-11 15:21:08
|
On Wed, Nov 11, 2015 at 02:44:22PM +0000, Gil Graiber wrote: > I run phc2sys like this on the master and the slave. It is not best practice to use the system for a PTP master. However, you *can* do this if you really, truly want to. On the master, you need to repeat the '-r' phc2sys option in order to confirm the unusual configuration. Master: ptp4l -i eth0 phc2sys -a -r -r Slave: ptp4l -i eth0 -s phc2sys -a -r That should work better for you. Thanks, Richard |
From: Gil G. <Gil...@ha...> - 2015-11-11 15:39:56
|
So if it is not best practice, how else can I sync the system clock on the master and the slaves? I would like all system clocks on the Lan to be synced to the master hardware clock on the master NIC. -----Original Message----- From: Richard Cochran [mailto:ric...@gm...] Sent: Wednesday, November 11, 2015 5:21 PM To: Gil Graiber Cc: lin...@li... Subject: Re: [Linuxptp-users] Should Linux PTP syn the clock used by date between PCs? On Wed, Nov 11, 2015 at 02:44:22PM +0000, Gil Graiber wrote: > I run phc2sys like this on the master and the slave. It is not best practice to use the system for a PTP master. However, you *can* do this if you really, truly want to. On the master, you need to repeat the '-r' phc2sys option in order to confirm the unusual configuration. Master: ptp4l -i eth0 phc2sys -a -r -r Slave: ptp4l -i eth0 -s phc2sys -a -r That should work better for you. Thanks, Richard |
From: Keller, J. E <jac...@in...> - 2015-11-11 17:35:55
|
For master, you need to use phc2sys to sync the kernel time to the PHC on the NIC doing the timestamping, on the slave you do the reverse, which is what the "-r -r" option is for. Best practice is to use a different piece of hardware as a grand master, rather than using one of the NICs directly as master. Regards, Jake On Wed, 2015-11-11 at 15:25 +0000, Gil Graiber wrote: > So if it is not best practice, how else can I sync the system clock > on the master and the slaves? > I would like all system clocks on the Lan to be synced to the master > hardware clock on the master NIC. > > -----Original Message----- > From: Richard Cochran [mailto:ric...@gm...] > Sent: Wednesday, November 11, 2015 5:21 PM > To: Gil Graiber > Cc: lin...@li... > Subject: Re: [Linuxptp-users] Should Linux PTP syn the clock used by > date between PCs? > > On Wed, Nov 11, 2015 at 02:44:22PM +0000, Gil Graiber wrote: > > I run phc2sys like this on the master and the slave. > > It is not best practice to use the system for a PTP master. However, > you *can* do this if you really, truly want to. On the master, you > need to repeat the '-r' phc2sys option in order to confirm the > unusual configuration. > > Master: > ptp4l -i eth0 > phc2sys -a -r -r > > Slave: > ptp4l -i eth0 -s > phc2sys -a -r > > That should work better for you. > > Thanks, > Richard > > ------------------------------------------------------------------- > ----------- > _______________________________________________ > Linuxptp-users mailing list > Lin...@li... > https://lists.sourceforge.net/lists/listinfo/linuxptp-users |
From: Gil G. <Gil...@ha...> - 2015-11-11 17:38:15
|
Thanks. -----Original Message----- From: Keller, Jacob E [mailto:jac...@in...] Sent: Wednesday, November 11, 2015 7:35 PM To: ric...@gm...; Gil Graiber Cc: lin...@li... Subject: Re: [Linuxptp-users] Should Linux PTP syn the clock used by date between PCs? For master, you need to use phc2sys to sync the kernel time to the PHC on the NIC doing the timestamping, on the slave you do the reverse, which is what the "-r -r" option is for. Best practice is to use a different piece of hardware as a grand master, rather than using one of the NICs directly as master. Regards, Jake On Wed, 2015-11-11 at 15:25 +0000, Gil Graiber wrote: > So if it is not best practice, how else can I sync the system clock on > the master and the slaves? > I would like all system clocks on the Lan to be synced to the master > hardware clock on the master NIC. > > -----Original Message----- > From: Richard Cochran [mailto:ric...@gm...] > Sent: Wednesday, November 11, 2015 5:21 PM > To: Gil Graiber > Cc: lin...@li... > Subject: Re: [Linuxptp-users] Should Linux PTP syn the clock used by > date between PCs? > > On Wed, Nov 11, 2015 at 02:44:22PM +0000, Gil Graiber wrote: > > I run phc2sys like this on the master and the slave. > > It is not best practice to use the system for a PTP master. However, > you *can* do this if you really, truly want to. On the master, you > need to repeat the '-r' phc2sys option in order to confirm the unusual > configuration. > > Master: > ptp4l -i eth0 > phc2sys -a -r -r > > Slave: > ptp4l -i eth0 -s > phc2sys -a -r > > That should work better for you. > > Thanks, > Richard > > ------------------------------------------------------------------- > ----------- > _______________________________________________ > Linuxptp-users mailing list > Lin...@li... > https://lists.sourceforge.net/lists/listinfo/linuxptp-users |
From: Richard C. <ric...@gm...> - 2015-11-11 18:11:20
|
On Wed, Nov 11, 2015 at 05:35:18PM +0000, Keller, Jacob E wrote: > For master, you need to use phc2sys to sync the kernel time to the PHC > on the NIC doing the timestamping, on the slave you do the reverse, > which is what the "-r -r" option is for. The double -r is for the master. Actually, if you don't care which node is master/slave, then you can leave off '-s' (slave only) from ptp4l and put the double -r on every node's phc2sys command line. > Best practice is to use a different piece of hardware as a grand > master, rather than using one of the NICs directly as master. Yep. Thanks, Richard |
From: Gil G. <Gil...@ha...> - 2015-11-11 18:17:43
|
Thanks. -----Original Message----- From: Richard Cochran [ric...@gm...] Received: Wednesday, 11 Nov 2015, 20:11 To: Keller, Jacob E [jac...@in...] CC: Gil Graiber [Gil...@ha...]; lin...@li... [lin...@li...] Subject: Re: [Linuxptp-users] Should Linux PTP syn the clock used by date between PCs? On Wed, Nov 11, 2015 at 05:35:18PM +0000, Keller, Jacob E wrote: > For master, you need to use phc2sys to sync the kernel time to the PHC > on the NIC doing the timestamping, on the slave you do the reverse, > which is what the "-r -r" option is for. The double -r is for the master. Actually, if you don't care which node is master/slave, then you can leave off '-s' (slave only) from ptp4l and put the double -r on every node's phc2sys command line. > Best practice is to use a different piece of hardware as a grand > master, rather than using one of the NICs directly as master. Yep. Thanks, Richard |