Skip to contentSkip to conversation

package: linuxptp: bump to the latest GIT version

PATCH New Petr Kulhavy 3 participants 10 messages Jan 28, 2018 – Oct 21, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 package: linuxptp: bump to the latest GIT version

---
 package/linuxptp/linuxptp.hash | 2 +-
 package/linuxptp/linuxptp.mk   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
package/linuxptp/linuxptp.hash +1 -1
index 91144df..ef2db56 100644
@@ -1,2 +1,2 @@
 # Locally computed:
-sha256	40844a69df82853113732f15498f9bce2666d5052293a3d5d40a1983e7b7b6a6  linuxptp-17c9787b1d6891636b5be9e4e5a08278b44e9a7a.tar.gz
+sha256 d0ccc4591966e21819cdc248765ebbe02456bc8ca37845eb7c23c2d1ff9bcf6b  linuxptp-303b08cbf55096aba55bd08a314e0701e5c33482.tar.gz
package/linuxptp/linuxptp.mk +1 -1
index 38d8e09..f43fee6 100644
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-LINUXPTP_VERSION = 17c9787b1d6891636b5be9e4e5a08278b44e9a7a
+LINUXPTP_VERSION = 303b08cbf55096aba55bd08a314e0701e5c33482
 LINUXPTP_SITE_METHOD = git
 LINUXPTP_SITE = git://git.code.sf.net/p/linuxptp/code
 LINUXPTP_LICENSE = GPL-2.0+
Signature · 1 line
2.7.4
#1 lore raw

PATCH 2/3 package: linuxptp: enhance systemd service

linuxptp now pulls in the time-sync.target
phc2sys (linuxptp-system-clock.service) starts after ptp4l (linuxptp.service)

---
 package/linuxptp/linuxptp-system-clock.service | 2 +-
 package/linuxptp/linuxptp.service              | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)
package/linuxptp/linuxptp-system-clock.service +1 -1
index 7327254..a4436a3 100644
@@ -1,6 +1,6 @@
 [Unit]
 Description=Precision Time Protocol system clock synchronization
-After=syslog.target network.target
+After=linuxptp.service
 
 [Service]
 ExecStart=/usr/sbin/phc2sys -s /dev/ptp0 -c CLOCK_REALTIME -w -S 1.0
package/linuxptp/linuxptp.service +2 -0
index f690430..14e9814 100644
@@ -1,6 +1,8 @@
 [Unit]
 Description=Precision Time Protocol daemon
 After=syslog.target network.target
+Before=time-sync.target
+Wants=time-sync.target
 Wants=linuxptp-system-clock.service
 
 [Service]
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/3 package: linuxptp: enhance systemd service

Hello,

Quoted 26 lines · Petr Kulhavy

linuxptp now pulls in the time-sync.target
phc2sys (linuxptp-system-clock.service) starts after ptp4l (linuxptp.service)

---
 package/linuxptp/linuxptp-system-clock.service | 2 +-
 package/linuxptp/linuxptp.service              | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)
package/linuxptp/linuxptp-system-clock.service +1 -1
index 7327254..a4436a3 100644
@@ -1,6 +1,6 @@
 [Unit]
 Description=Precision Time Protocol system clock synchronization
-After=syslog.target network.target
+After=linuxptp.service
 
 [Service]
 ExecStart=/usr/sbin/phc2sys -s /dev/ptp0 -c CLOCK_REALTIME -w -S 1.0
package/linuxptp/linuxptp.service +0 -0
index f690430..14e9814 100644

package/linuxptp/linuxptp.service line 8

Quoted 8 lines
package/linuxptp/linuxptp.service +2 -0
@@ -1,6 +1,8 @@
 [Unit]
 Description=Precision Time Protocol daemon
 After=syslog.target network.target
+Before=time-sync.target
+Wants=time-sync.target
 Wants=linuxptp-system-clock.service
 
 [Service]

I'm not knowledgeable enough in systemd stuff to decide on this one. Anyone with more systemd knowledge ?

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#3 lore raw

PATCH 2/3 package: linuxptp: enhance systemd service

Hi Thomas,

The Before= and Wants=? time-sync.target is what I found in the systemd documentation. A time synchronization service should pull in this special target, so that applications needing time synchronization can depend on it.
Other time synchronizing services like ntpd or systemd-timesyncd use the same mechanism.

Cheers
Petr

Quoted 41 lines · Thomas Petazzoni

Hello,

Quoted 26 lines · Petr Kulhavy

linuxptp now pulls in the time-sync.target
phc2sys (linuxptp-system-clock.service) starts after ptp4l (linuxptp.service)

---
  package/linuxptp/linuxptp-system-clock.service | 2 +-
  package/linuxptp/linuxptp.service              | 2 ++
  2 files changed, 3 insertions(+), 1 deletion(-)
package/linuxptp/linuxptp-system-clock.service +1 -1
index 7327254..a4436a3 100644
@@ -1,6 +1,6 @@
  [Unit]
  Description=Precision Time Protocol system clock synchronization
-After=syslog.target network.target
+After=linuxptp.service
 
  [Service]
  ExecStart=/usr/sbin/phc2sys -s /dev/ptp0 -c CLOCK_REALTIME -w -S 1.0
package/linuxptp/linuxptp.service +0 -0
index f690430..14e9814 100644

package/linuxptp/linuxptp.service line 8

Quoted 8 lines
package/linuxptp/linuxptp.service +2 -0
@@ -1,6 +1,8 @@
  [Unit]
  Description=Precision Time Protocol daemon
  After=syslog.target network.target
+Before=time-sync.target
+Wants=time-sync.target
  Wants=linuxptp-system-clock.service
 
  [Service]

I'm not knowledgeable enough in systemd stuff to decide on this one. Anyone with more systemd knowledge ?

Thomas

#4 lore raw

PATCH 2/3 package: linuxptp: enhance systemd service

Quoted 7 lines · Petr Kulhavy

Hi Thomas,

The Before= and Wants=? time-sync.target is what I found in the systemd documentation. A time synchronization service should pull in this special target, so that applications needing time synchronization can depend on it. Other time synchronizing services like ntpd or systemd-timesyncd use the same mechanism.

?I double-checked this and confirm. So I've extended the commit log a little and applied to master, thanks.

?Sorry that it took so long...

?Regards,
?Arnout

Quoted 52 lines

Cheers
Petr

Quoted 40 lines · Thomas Petazzoni

Hello,

Quoted 32 lines · Petr Kulhavy

linuxptp now pulls in the time-sync.target
phc2sys (linuxptp-system-clock.service) starts after ptp4l (linuxptp.service)

---
? package/linuxptp/linuxptp-system-clock.service | 2 +- ? package/linuxptp/linuxptp.service????????????? | 2 ++ ? 2 files changed, 3 insertions(+), 1 deletion(-)

package/linuxptp/linuxptp-system-clock.service +0 -0
index 7327254..a4436a3 100644
@@ -1,6 +1,6 @@

? [Unit]
? Description=Precision Time Protocol system clock synchronization

package/linuxptp/linuxptp-system-clock.service +1 -1
-After=syslog.target network.target
+After=linuxptp.service

? ? [Service]
? ExecStart=/usr/sbin/phc2sys -s /dev/ptp0 -c CLOCK_REALTIME -w -S 1.0

package/linuxptp/linuxptp.service +0 -0
index f690430..14e9814 100644
@@ -1,6 +1,8 @@

? [Unit]
? Description=Precision Time Protocol daemon
? After=syslog.target network.target

package/linuxptp/linuxptp.service +2 -0
+Before=time-sync.target
+Wants=time-sync.target
Quoted 2 lines

? Wants=linuxptp-system-clock.service
? ? [Service]

I'm not knowledgeable enough in systemd stuff to decide on this one. Anyone with more systemd knowledge ?

Quoted 1 line

Thomas

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#5 lore raw

PATCH 3/3 package: linuxptp: workaround for system crash if PHY is not initialized

In reply to Petr Kulhavy

On some systems (tested on i.MX6 with Freescale kernel 4.1) the system freezes if phc2sys starts before the PHY is initialized (phc2sys opens /dev/ptp0).

Unfortunately systemd network.target does not guarantee the PHY to be initialized. This workaround pulls in the network-online.target dependency, which postpones the phc2sys start after the link is up.

---
 package/linuxptp/linuxptp-system-clock.service | 4 ++++
 1 file changed, 4 insertions(+)
package/linuxptp/linuxptp-system-clock.service +4 -0
index a4436a3..0c73983 100644
@@ -2,6 +2,10 @@
 Description=Precision Time Protocol system clock synchronization
 After=linuxptp.service
 
+# workaround for crashing Freescale PHY if initialized after /dev/ptp0 is open
+After=network-online.target
+Wants=network-online.target
+
 [Service]
 ExecStart=/usr/sbin/phc2sys -s /dev/ptp0 -c CLOCK_REALTIME -w -S 1.0
 Restart=always
Signature · 1 line
2.7.4
#6 lore raw

PATCH 3/3 package: linuxptp: workaround for system crash if PHY is not initialized

Hello,

Quoted 8 lines · Petr Kulhavy

On some systems (tested on i.MX6 with Freescale kernel 4.1) the system freezes if phc2sys starts before the PHY is initialized (phc2sys opens /dev/ptp0).

Unfortunately systemd network.target does not guarantee the PHY to be initialized. This workaround pulls in the network-online.target dependency, which postpones the phc2sys start after the link is up.

Do we really want to workaround this, which appears to be a kernel problem?

package/linuxptp/linuxptp-system-clock.service line 7

Quoted 3 lines
package/linuxptp/linuxptp-system-clock.service +3 -0
+# workaround for crashing Freescale PHY if initialized after /dev/ptp0 is open
+After=network-online.target
+Wants=network-online.target

Does it make sense to have After and Wants set to the same value ? Are both really needed ?

(Again: I don't know much about systemd, so don't hesitate to teach me even the basics!)

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#7 lore raw

PATCH 3/3 package: linuxptp: workaround for system crash if PHY is not initialized

Hi Thomas,

most likely I will post another patch for this as I have modified the service file even further.
In the newer version both come after network-online.target because I noticed ptp4l fails to execute some ioctl if started too early. This causes that it doesn't start syncing.

I'm not very happy with the network-online.target either, because it literally waits for the network to come up. Which makes some sense - PTP needs a peer - however systemd documentation indicates this is not the most reliable way to solve missing network and recommends to write robust programs which can wait for network.
And in the end neither ptp4l or phc2sys need the network to be up. They both just need the kernel to finish the initialization (which is not the same as network up). Unfortunately systemd doesn't provide such target :(

I'm also not an expert in systemd. These changes are base on my self-education. So a real systemd expert would be appreciated.

Petr

Quoted 24 lines · Thomas Petazzoni

Hello,

Quoted 8 lines · Petr Kulhavy

On some systems (tested on i.MX6 with Freescale kernel 4.1) the system freezes if phc2sys starts before the PHY is initialized (phc2sys opens /dev/ptp0).

Unfortunately systemd network.target does not guarantee the PHY to be initialized. This workaround pulls in the network-online.target dependency, which postpones the phc2sys start after the link is up.

Do we really want to workaround this, which appears to be a kernel problem?

package/linuxptp/linuxptp-system-clock.service line 7

Quoted 3 lines
package/linuxptp/linuxptp-system-clock.service +3 -0
+# workaround for crashing Freescale PHY if initialized after /dev/ptp0 is open
+After=network-online.target
+Wants=network-online.target

Does it make sense to have After and Wants set to the same value ? Are both really needed ?

(Again: I don't know much about systemd, so don't hesitate to teach me even the basics!)

Thomas

#8 lore raw

PATCH 3/3 package: linuxptp: workaround for system crash if PHY is not initialized

Quoted 7 lines · Petr Kulhavy

Hi Thomas,

most likely I will post another patch for this as I have modified the service file even further.
In the newer version both come after network-online.target because I noticed ptp4l fails to execute some ioctl if started too early. This causes that it doesn't start syncing.

?This looks to me like something that should be fixed in ptp4l itself. Like, if you are running ptp4l on a removable device, you have to wait for the device to be available. Or alternatively, trigger the service on the availability of the device (i.e. start it from udev). Though honestly I have no idea of how to do that properly from systemd.

?Anyway, since you said that you have an improved patch lined up, I've marked this one as Changes Requested in patchwork.

?Regards,
?Arnout

Quoted 47 lines

I'm not very happy with the network-online.target either, because it literally waits for the network to come up. Which makes some sense - PTP needs a peer - however systemd documentation indicates this is not the most reliable way to solve missing network and recommends to write robust programs which can wait for network.
And in the end neither ptp4l or phc2sys need the network to be up. They both just need the kernel to finish the initialization (which is not the same as network up). Unfortunately systemd doesn't provide such target :(

I'm also not an expert in systemd. These changes are base on my self-education. So a real systemd expert would be appreciated.

Petr

Quoted 21 lines · Thomas Petazzoni

Hello,

Quoted 9 lines · Petr Kulhavy

On some systems (tested on i.MX6 with Freescale kernel 4.1) the system freezes if phc2sys starts before the PHY is initialized (phc2sys opens /dev/ptp0).

Unfortunately systemd network.target does not guarantee the PHY to be initialized.
This workaround pulls in the network-online.target dependency, which postpones the phc2sys start after the link is up.

Do we really want to workaround this, which appears to be a kernel problem?

package/linuxptp/linuxptp-system-clock.service line 7

Quoted 3 lines
package/linuxptp/linuxptp-system-clock.service +3 -0
+# workaround for crashing Freescale PHY if initialized after /dev/ptp0 is open
+After=network-online.target
+Wants=network-online.target

Does it make sense to have After and Wants set to the same value ? Are both really needed ?

Quoted 4 lines

(Again: I don't know much about systemd, so don't hesitate to teach me even the basics!)

Thomas

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#9 lore raw

PATCH 1/3 package: linuxptp: bump to the latest GIT version

In reply to Petr Kulhavy

Hello,

Quoted 5 lines · Petr Kulhavy
---
 package/linuxptp/linuxptp.hash | 2 +-
 package/linuxptp/linuxptp.mk   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com