Thread: [Linuxptp-users] Unable run ptp4l using Virtual Clock
PTP IEEE 1588 stack for Linux
Brought to you by:
rcochran
From: Amar B S <ama...@gm...> - 2022-11-21 06:43:23
Attachments:
config_ptp.conf
|
Hi LinuxPtp Community, We are trying to run multiple instances of ptp4l on the same interface using the virtual PHC clock feature that was submitted to linuxptp. We are using the master branch of linuxPTP and kernel 6.0.8. I have created virtual clocks using the command “echo 2 > /sys/class/ptp/ptp2/n_vclocks”, and provided the phc_index in the config file. When I run ptp4l it's unable to detect the virtual clock and prints out the error “phc device mismatch”. After reading through the code I see that *“rtnl_iface_has_vclock” *is failing to detect the virtual clock. Can you please suggest what could be going wrong here? We are using CentOS 7 with *“kernel-ml-6.0.8-1.el7.elrepo.x86_64”* LOGS: *[root@supermicrodu1 ~]# ./ptp4l -f /etc/sysconfig/config_ptp.conf -i sriov2 -m 2 -H -l 6 -s --slave_event_monitor=/tmp/pmc* *option slaveOnly is deprecated, please use clientOnly instead* *ptp4l[166163.457]: selected /dev/ptp8 as PTP clock* *ptp4l[166163.457]: port 1 (sriov2): PHC device mismatch* *ptp4l[166163.457]: port 1 (sriov2): /dev/ptp8 requested, ptp2 attached* *ptp4l[166163.457]: failed to open port sriov2* Thanks, Amar |
From: Miroslav L. <mli...@re...> - 2022-11-21 07:48:45
|
On Mon, Nov 21, 2022 at 12:13:05PM +0530, Amar B S wrote: > When I run ptp4l it's unable to detect the virtual clock and prints out the > error “phc device mismatch”. > After reading through the code I see that *“rtnl_iface_has_vclock” *is > failing to detect the virtual clock. Can you please suggest what could be > going wrong here? We are using CentOS 7 with > *“kernel-ml-6.0.8-1.el7.elrepo.x86_64”* Were the corresponding development files of the kernel available when linuxptp was built? In the build log you should see -DHAVE_VCLOCKS. -- Miroslav Lichvar |
From: Amar B S <ama...@gm...> - 2022-11-25 09:13:57
|
Hi Miroslav, Do you see any problem in the trace? Thanks Amar On Thu, Nov 24, 2022 at 9:59 AM Amar B S <ama...@gm...> wrote: > Hi, > > I have attached the strace log. > > Thanks, > Amar B S > > On Wed, Nov 23, 2022 at 8:00 PM Miroslav Lichvar <mli...@re...> > wrote: > >> On Wed, Nov 23, 2022 at 07:53:32PM +0530, Amar B S wrote: >> > This part of the code checks if VPHC is present using NetLink messages, >> it >> > seems like we are not getting the expected response, hence failing to >> > detect the VPHC. >> >> Can you please run ptp4l in strace and post the output? >> >> -- >> Miroslav Lichvar >> >> |
From: Miroslav L. <mli...@re...> - 2022-11-28 11:15:27
|
On Fri, Nov 25, 2022 at 02:43:34PM +0530, Amar B S wrote: > Hi Miroslav, > > Do you see any problem in the trace? The kernel doesn't seem to be responding with any vclocks to the ETHTOOL_MSG_PHC_VCLOCKS_GET request for srio2. Is directory /sys/class/ptp/ptp2/ptp8 present on the system? That should confirm that ptp8 is a vclock of ptp2. -- Miroslav Lichvar |
From: Amar B S <ama...@gm...> - 2022-11-21 09:37:05
|
Hi Miroslav, The code was built on a dev system and I copied binaries into to test system. Is it required to build on the test system where kernel support is present ? Thanks, Amar On Mon, Nov 21, 2022 at 1:18 PM Miroslav Lichvar <mli...@re...> wrote: > On Mon, Nov 21, 2022 at 12:13:05PM +0530, Amar B S wrote: > > When I run ptp4l it's unable to detect the virtual clock and prints out > the > > error “phc device mismatch”. > > After reading through the code I see that *“rtnl_iface_has_vclock” *is > > failing to detect the virtual clock. Can you please suggest what could be > > going wrong here? We are using CentOS 7 with > > *“kernel-ml-6.0.8-1.el7.elrepo.x86_64”* > > Were the corresponding development files of the kernel available when > linuxptp was built? In the build log you should see -DHAVE_VCLOCKS. > > -- > Miroslav Lichvar > > |
From: Miroslav L. <mli...@re...> - 2022-11-21 09:57:20
|
On Mon, Nov 21, 2022 at 03:06:44PM +0530, Amar B S wrote: > Hi Miroslav, > > The code was built on a dev system and I copied binaries into to test > system. Is it required to build on the test system where kernel support is > present ? Actually, it shouldn't matter where it is built as linuxptp includes a copy of the required declarations from the headers. I did a test with a recent kernel and linuxptp, and there is indeed something broken wrt vclocks. I'll look into that. -- Miroslav Lichvar |
From: Amar B S <ama...@gm...> - 2022-11-23 07:34:59
|
Hi Miroslav, May I know on which kernel version, this was working fine? Thanks, Amar On Mon, Nov 21, 2022 at 3:27 PM Miroslav Lichvar <mli...@re...> wrote: > On Mon, Nov 21, 2022 at 03:06:44PM +0530, Amar B S wrote: > > Hi Miroslav, > > > > The code was built on a dev system and I copied binaries into to test > > system. Is it required to build on the test system where kernel support > is > > present ? > > Actually, it shouldn't matter where it is built as linuxptp includes a > copy of the required declarations from the headers. > > I did a test with a recent kernel and linuxptp, and there is indeed > something broken wrt vclocks. I'll look into that. > > -- > Miroslav Lichvar > > |
From: Miroslav L. <mli...@re...> - 2022-11-23 07:55:55
|
On Wed, Nov 23, 2022 at 01:04:42PM +0530, Amar B S wrote: > Hi Miroslav, > > May I know on which kernel version, this was working fine? It turned out to be a linuxptp issue. See my patch on -devel. -- Miroslav Lichvar |
From: Amar B S <ama...@gm...> - 2022-11-23 11:52:34
|
Hi Miroslav, I checked your patch and tried it, but in my setup, it's failing well before the part of the code you have changed. The function "*rtnl_iface_has_vclock*" determines whether the given clock is VPHC which is failing and hence it exits during the Initialization phase itself. [root@supermicrodu1 ~]# ./ptp4l -f /etc/sysconfig/config_ptp.conf -m 2 -H -l 6 -s -i sriov2 option slaveOnly is deprecated, please use clientOnly instead ptp4l[175.953]: selected /dev/ptp8 as PTP clock ptp4l[175.953]: port 1 (sriov2):* PHC device mismatch* ptp4l[175.953]: port 1 (sriov2): /dev/ptp8 requested, ptp2 attached ptp4l[175.953]: failed to open port sriov2 failed to create a clock Thanks, Amar B S On Wed, Nov 23, 2022 at 1:25 PM Miroslav Lichvar <mli...@re...> wrote: > On Wed, Nov 23, 2022 at 01:04:42PM +0530, Amar B S wrote: > > Hi Miroslav, > > > > May I know on which kernel version, this was working fine? > > It turned out to be a linuxptp issue. See my patch on -devel. > > -- > Miroslav Lichvar > > |
From: Amar B S <ama...@gm...> - 2022-11-23 14:24:02
|
* } else if (p->phc_index >= 0 && * * p->phc_index != interface_phc_index(interface)) {* * if (rtnl_iface_has_vclock(interface_name(interface),* * p->phc_index)) {* * pr_info("%s: /dev/ptp%d is virtual clock",* * p->log_name, p->phc_index);* * interface_set_vclock(interface, p->phc_index);* * } else if (p->jbod) {* * pr_warning("%s: just a bunch of devices", p->log_name);* * p->phc_index = interface_phc_index(interface);* * } else if (phc_device) {* * pr_warning("%s: taking %s from the command line, "* * "not the attached ptp%d", p->log_name,* * phc_device, interface_phc_index(interface));* * p->phc_index = phc_index;* * p->phc_from_cmdline = 1; * * } else {* * pr_err("%s: PHC device mismatch", p->log_name);* * pr_err("%s: /dev/ptp%d requested, ptp%d attached",* * p->log_name, phc_index,* * interface_phc_index(interface));* * goto err_transport;* * } * * } * This part of the code checks if VPHC is present using NetLink messages, it seems like we are not getting the expected response, hence failing to detect the VPHC. *On Wed, Nov 23, 2022 at 5:22 PM Amar B S <ama...@gm... <ama...@gm...>> wrote:* > > > > > *Hi Miroslav,I checked your patch and tried it, but in my setup, it's > failing well before the part of the code you have changed.The function > "rtnl_iface_has_vclock" determines whether the given clock is VPHC which is > failing and hence it exits during the Initialization phase itself. * > > > > > > > > > > > > > > *[root@supermicrodu1 ~]# ./ptp4l -f /etc/sysconfig/config_ptp.conf -m 2 -H > -l 6 -s -i sriov2 option slaveOnly is deprecated, please use clientOnly > insteadptp4l[175.953]: selected /dev/ptp8 as PTP clockptp4l[175.953]: port > 1 (sriov2): PHC device mismatchptp4l[175.953]: port 1 (sriov2): /dev/ptp8 > requested, ptp2 attachedptp4l[175.953]: failed to open port sriov2failed to > create a clockThanks,Amar B S* > > > *On Wed, Nov 23, 2022 at 1:25 PM Miroslav Lichvar <mli...@re... > <mli...@re...>> wrote:* > >> >> >> >> >> >> >> *On Wed, Nov 23, 2022 at 01:04:42PM +0530, Amar B S wrote: > Hi Miroslav, >> > > May I know on which kernel version, this was working fine? It turned >> out to be a linuxptp issue. See my patch on -devel.* > > > > >> >> >> * -- Miroslav Lichvar* >> > |
From: Miroslav L. <mli...@re...> - 2022-11-23 14:30:43
|
On Wed, Nov 23, 2022 at 07:53:32PM +0530, Amar B S wrote: > This part of the code checks if VPHC is present using NetLink messages, it > seems like we are not getting the expected response, hence failing to > detect the VPHC. Can you please run ptp4l in strace and post the output? -- Miroslav Lichvar |
From: Amar B S <ama...@gm...> - 2022-11-24 04:30:12
Attachments:
ptp4l_strace.log
|
Hi, I have attached the strace log. Thanks, Amar B S On Wed, Nov 23, 2022 at 8:00 PM Miroslav Lichvar <mli...@re...> wrote: > On Wed, Nov 23, 2022 at 07:53:32PM +0530, Amar B S wrote: > > This part of the code checks if VPHC is present using NetLink messages, > it > > seems like we are not getting the expected response, hence failing to > > detect the VPHC. > > Can you please run ptp4l in strace and post the output? > > -- > Miroslav Lichvar > > |