All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/3] package: linuxptp: bump to the latest GIT version
@ 2018-01-28 16:00 Petr Kulhavy
  2018-01-28 16:00 ` [Buildroot] [PATCH 2/3] package: linuxptp: enhance systemd service Petr Kulhavy
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Petr Kulhavy @ 2018-01-28 16:00 UTC (permalink / raw)
  To: buildroot

Signed-off-by: Petr Kulhavy <brain@jikos.cz>
---
 package/linuxptp/linuxptp.hash | 2 +-
 package/linuxptp/linuxptp.mk   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/linuxptp/linuxptp.hash b/package/linuxptp/linuxptp.hash
index 91144df..ef2db56 100644
--- a/package/linuxptp/linuxptp.hash
+++ b/package/linuxptp/linuxptp.hash
@@ -1,2 +1,2 @@
 # Locally computed:
-sha256	40844a69df82853113732f15498f9bce2666d5052293a3d5d40a1983e7b7b6a6  linuxptp-17c9787b1d6891636b5be9e4e5a08278b44e9a7a.tar.gz
+sha256 d0ccc4591966e21819cdc248765ebbe02456bc8ca37845eb7c23c2d1ff9bcf6b  linuxptp-303b08cbf55096aba55bd08a314e0701e5c33482.tar.gz
diff --git a/package/linuxptp/linuxptp.mk b/package/linuxptp/linuxptp.mk
index 38d8e09..f43fee6 100644
--- a/package/linuxptp/linuxptp.mk
+++ b/package/linuxptp/linuxptp.mk
@@ -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+
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH 2/3] package: linuxptp: enhance systemd service
  2018-01-28 16:00 [Buildroot] [PATCH 1/3] package: linuxptp: bump to the latest GIT version Petr Kulhavy
@ 2018-01-28 16:00 ` Petr Kulhavy
  2018-01-30 22:00   ` Thomas Petazzoni
  2018-01-28 16:00 ` [Buildroot] [PATCH 3/3] package: linuxptp: workaround for system crash if PHY is not initialized Petr Kulhavy
  2018-01-30 22:00 ` [Buildroot] [PATCH 1/3] package: linuxptp: bump to the latest GIT version Thomas Petazzoni
  2 siblings, 1 reply; 10+ messages in thread
From: Petr Kulhavy @ 2018-01-28 16:00 UTC (permalink / raw)
  To: buildroot

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

Signed-off-by: Petr Kulhavy <brain@jikos.cz>
---
 package/linuxptp/linuxptp-system-clock.service | 2 +-
 package/linuxptp/linuxptp.service              | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/package/linuxptp/linuxptp-system-clock.service b/package/linuxptp/linuxptp-system-clock.service
index 7327254..a4436a3 100644
--- a/package/linuxptp/linuxptp-system-clock.service
+++ b/package/linuxptp/linuxptp-system-clock.service
@@ -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
diff --git a/package/linuxptp/linuxptp.service b/package/linuxptp/linuxptp.service
index f690430..14e9814 100644
--- a/package/linuxptp/linuxptp.service
+++ b/package/linuxptp/linuxptp.service
@@ -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]
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH 3/3] package: linuxptp: workaround for system crash if PHY is not initialized
  2018-01-28 16:00 [Buildroot] [PATCH 1/3] package: linuxptp: bump to the latest GIT version Petr Kulhavy
  2018-01-28 16:00 ` [Buildroot] [PATCH 2/3] package: linuxptp: enhance systemd service Petr Kulhavy
@ 2018-01-28 16:00 ` Petr Kulhavy
  2018-01-30 22:01   ` Thomas Petazzoni
  2018-01-30 22:00 ` [Buildroot] [PATCH 1/3] package: linuxptp: bump to the latest GIT version Thomas Petazzoni
  2 siblings, 1 reply; 10+ messages in thread
From: Petr Kulhavy @ 2018-01-28 16:00 UTC (permalink / raw)
  To: buildroot

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.

Signed-off-by: Petr Kulhavy <brain@jikos.cz>
---
 package/linuxptp/linuxptp-system-clock.service | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/package/linuxptp/linuxptp-system-clock.service b/package/linuxptp/linuxptp-system-clock.service
index a4436a3..0c73983 100644
--- a/package/linuxptp/linuxptp-system-clock.service
+++ b/package/linuxptp/linuxptp-system-clock.service
@@ -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
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH 1/3] package: linuxptp: bump to the latest GIT version
  2018-01-28 16:00 [Buildroot] [PATCH 1/3] package: linuxptp: bump to the latest GIT version Petr Kulhavy
  2018-01-28 16:00 ` [Buildroot] [PATCH 2/3] package: linuxptp: enhance systemd service Petr Kulhavy
  2018-01-28 16:00 ` [Buildroot] [PATCH 3/3] package: linuxptp: workaround for system crash if PHY is not initialized Petr Kulhavy
@ 2018-01-30 22:00 ` Thomas Petazzoni
  2 siblings, 0 replies; 10+ messages in thread
From: Thomas Petazzoni @ 2018-01-30 22:00 UTC (permalink / raw)
  To: buildroot

Hello,

On Sun, 28 Jan 2018 17:00:19 +0100, Petr Kulhavy wrote:
> Signed-off-by: Petr Kulhavy <brain@jikos.cz>
> ---
>  package/linuxptp/linuxptp.hash | 2 +-
>  package/linuxptp/linuxptp.mk   | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

Applied to master, thanks.

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH 2/3] package: linuxptp: enhance systemd service
  2018-01-28 16:00 ` [Buildroot] [PATCH 2/3] package: linuxptp: enhance systemd service Petr Kulhavy
@ 2018-01-30 22:00   ` Thomas Petazzoni
  2018-01-30 22:19     ` Petr Kulhavy
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas Petazzoni @ 2018-01-30 22:00 UTC (permalink / raw)
  To: buildroot

Hello,

On Sun, 28 Jan 2018 17:00:20 +0100, Petr Kulhavy wrote:
> linuxptp now pulls in the time-sync.target
> phc2sys (linuxptp-system-clock.service) starts after ptp4l (linuxptp.service)
> 
> Signed-off-by: Petr Kulhavy <brain@jikos.cz>
> ---
>  package/linuxptp/linuxptp-system-clock.service | 2 +-
>  package/linuxptp/linuxptp.service              | 2 ++
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/package/linuxptp/linuxptp-system-clock.service b/package/linuxptp/linuxptp-system-clock.service
> index 7327254..a4436a3 100644
> --- a/package/linuxptp/linuxptp-system-clock.service
> +++ b/package/linuxptp/linuxptp-system-clock.service
> @@ -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
> diff --git a/package/linuxptp/linuxptp.service b/package/linuxptp/linuxptp.service
> index f690430..14e9814 100644
> --- a/package/linuxptp/linuxptp.service
> +++ b/package/linuxptp/linuxptp.service
> @@ -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
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH 3/3] package: linuxptp: workaround for system crash if PHY is not initialized
  2018-01-28 16:00 ` [Buildroot] [PATCH 3/3] package: linuxptp: workaround for system crash if PHY is not initialized Petr Kulhavy
@ 2018-01-30 22:01   ` Thomas Petazzoni
  2018-01-30 22:14     ` Petr Kulhavy
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas Petazzoni @ 2018-01-30 22:01 UTC (permalink / raw)
  To: buildroot

Hello,

On Sun, 28 Jan 2018 17:00:21 +0100, Petr Kulhavy wrote:
> 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.
> 
> Signed-off-by: Petr Kulhavy <brain@jikos.cz>

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

> +# 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
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH 3/3] package: linuxptp: workaround for system crash if PHY is not initialized
  2018-01-30 22:01   ` Thomas Petazzoni
@ 2018-01-30 22:14     ` Petr Kulhavy
  2018-10-21 22:12       ` Arnout Vandecappelle
  0 siblings, 1 reply; 10+ messages in thread
From: Petr Kulhavy @ 2018-01-30 22:14 UTC (permalink / raw)
  To: buildroot

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

On 30/01/18 23:01, Thomas Petazzoni wrote:
> Hello,
>
> On Sun, 28 Jan 2018 17:00:21 +0100, Petr Kulhavy wrote:
>> 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.
>>
>> Signed-off-by: Petr Kulhavy <brain@jikos.cz>
> Do we really want to workaround this, which appears to be a kernel
> problem?
>
>> +# 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH 2/3] package: linuxptp: enhance systemd service
  2018-01-30 22:00   ` Thomas Petazzoni
@ 2018-01-30 22:19     ` Petr Kulhavy
  2018-10-21 23:19       ` Arnout Vandecappelle
  0 siblings, 1 reply; 10+ messages in thread
From: Petr Kulhavy @ 2018-01-30 22:19 UTC (permalink / raw)
  To: buildroot

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

On 30/01/18 23:00, Thomas Petazzoni wrote:
> Hello,
>
> On Sun, 28 Jan 2018 17:00:20 +0100, Petr Kulhavy wrote:
>> linuxptp now pulls in the time-sync.target
>> phc2sys (linuxptp-system-clock.service) starts after ptp4l (linuxptp.service)
>>
>> Signed-off-by: Petr Kulhavy <brain@jikos.cz>
>> ---
>>   package/linuxptp/linuxptp-system-clock.service | 2 +-
>>   package/linuxptp/linuxptp.service              | 2 ++
>>   2 files changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/package/linuxptp/linuxptp-system-clock.service b/package/linuxptp/linuxptp-system-clock.service
>> index 7327254..a4436a3 100644
>> --- a/package/linuxptp/linuxptp-system-clock.service
>> +++ b/package/linuxptp/linuxptp-system-clock.service
>> @@ -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
>> diff --git a/package/linuxptp/linuxptp.service b/package/linuxptp/linuxptp.service
>> index f690430..14e9814 100644
>> --- a/package/linuxptp/linuxptp.service
>> +++ b/package/linuxptp/linuxptp.service
>> @@ -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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH 3/3] package: linuxptp: workaround for system crash if PHY is not initialized
  2018-01-30 22:14     ` Petr Kulhavy
@ 2018-10-21 22:12       ` Arnout Vandecappelle
  0 siblings, 0 replies; 10+ messages in thread
From: Arnout Vandecappelle @ 2018-10-21 22:12 UTC (permalink / raw)
  To: buildroot


On 30/01/2018 22:14, Petr Kulhavy wrote:
> 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


>
> 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
>
> On 30/01/18 23:01, Thomas Petazzoni wrote:
>> Hello,
>>
>> On Sun, 28 Jan 2018 17:00:21 +0100, Petr Kulhavy wrote:
>>> 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.
>>>
>>> Signed-off-by: Petr Kulhavy <brain@jikos.cz>
>> Do we really want to workaround this, which appears to be a kernel
>> problem?
>>
>>> +# 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
>
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH 2/3] package: linuxptp: enhance systemd service
  2018-01-30 22:19     ` Petr Kulhavy
@ 2018-10-21 23:19       ` Arnout Vandecappelle
  0 siblings, 0 replies; 10+ messages in thread
From: Arnout Vandecappelle @ 2018-10-21 23:19 UTC (permalink / raw)
  To: buildroot


On 30/01/2018 22:19, Petr Kulhavy wrote:
> 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


> Cheers
> Petr
>
> On 30/01/18 23:00, Thomas Petazzoni wrote:
>> Hello,
>>
>> On Sun, 28 Jan 2018 17:00:20 +0100, Petr Kulhavy wrote:
>>> linuxptp now pulls in the time-sync.target
>>> phc2sys (linuxptp-system-clock.service) starts after ptp4l (linuxptp.service)
>>>
>>> Signed-off-by: Petr Kulhavy <brain@jikos.cz>
>>> ---
>>> ? package/linuxptp/linuxptp-system-clock.service | 2 +-
>>> ? package/linuxptp/linuxptp.service????????????? | 2 ++
>>> ? 2 files changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/package/linuxptp/linuxptp-system-clock.service
>>> b/package/linuxptp/linuxptp-system-clock.service
>>> index 7327254..a4436a3 100644
>>> --- a/package/linuxptp/linuxptp-system-clock.service
>>> +++ b/package/linuxptp/linuxptp-system-clock.service
>>> @@ -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
>>> diff --git a/package/linuxptp/linuxptp.service
>>> b/package/linuxptp/linuxptp.service
>>> index f690430..14e9814 100644
>>> --- a/package/linuxptp/linuxptp.service
>>> +++ b/package/linuxptp/linuxptp.service
>>> @@ -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
>
>
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-10-21 23:19 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-28 16:00 [Buildroot] [PATCH 1/3] package: linuxptp: bump to the latest GIT version Petr Kulhavy
2018-01-28 16:00 ` [Buildroot] [PATCH 2/3] package: linuxptp: enhance systemd service Petr Kulhavy
2018-01-30 22:00   ` Thomas Petazzoni
2018-01-30 22:19     ` Petr Kulhavy
2018-10-21 23:19       ` Arnout Vandecappelle
2018-01-28 16:00 ` [Buildroot] [PATCH 3/3] package: linuxptp: workaround for system crash if PHY is not initialized Petr Kulhavy
2018-01-30 22:01   ` Thomas Petazzoni
2018-01-30 22:14     ` Petr Kulhavy
2018-10-21 22:12       ` Arnout Vandecappelle
2018-01-30 22:00 ` [Buildroot] [PATCH 1/3] package: linuxptp: bump to the latest GIT version Thomas Petazzoni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.