From: Richard Cochran <richardcochran@gmail.com>
To: Sebastien Laveze <sebastien.laveze@oss.nxp.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
yangbo.lu@nxp.com, yannick.vignon@oss.nxp.com,
rui.sousa@oss.nxp.com
Subject: Re: [PATCH net-next] ptp: add vclock timestamp conversion IOCTL
Date: Thu, 30 Sep 2021 07:35:27 -0700 [thread overview]
Message-ID: <20210930143527.GA14158@hoboy.vegasvil.org> (raw)
In-Reply-To: <0941a4ea73c496ab68b24df929dcdef07637c2cd.camel@oss.nxp.com>
On Wed, Sep 29, 2021 at 05:00:56PM +0200, Sebastien Laveze wrote:
> On Tue, 2021-09-28 at 06:31 -0700, Richard Cochran wrote:
> > On Tue, Sep 28, 2021 at 01:50:23PM +0200, Sebastien Laveze wrote:
> > > Yes that would do it. Only drawback is that ALL rx and tx timestamps
> > > are converted to the N domains instead of a few as needed.
> >
> > No, the kernel would provide only those that are selected by the
> > program via the socket option API.
>
> But _all_ timestamps (rx and tx) are converted when a domain is
> selected.
So what? It is only a mult/shift. Cheaper than syscall by far.
> If we consider gPTP,
> -using the ioctl, you only need to convert the sync receive timestamps.
> PDelay (rx, tx, fup), sync (tx and fup) and signalling don't need to be
> converted. So that's for a default sync period of 125 ms, 8 ioctl /
> second / domain.
Well, today that is true, for your very specific use case. But we
don't invent kernel interfaces for one-off projects.
> -doing the conversion in the kernel will necessarly be done for every
> timestamp handled by the socket. In addition, the vclock device lookup
> is not free as well and done for _each_ conversion.
Sounds like something that can be optimized in the kernel implementation.
> From a high-level view, I understand that you would have N
> instance/process of linuxptp to support N domains ?
Yes.
> CMLDS performed by
> one of them and then some signalling to the other instances ?
Yes, something like that. One process measures peer delay, and the
others read the result via management messages (could also be pushed
via ptp4l's management notification method).
> What we miss currently in the kernel for a better multi-domain usage
> and would like to find a solution:
> -allow PHC adjustment with virtual clocks. Otherwise scheduled traffic
> cannot be used... (I've read your comments on this topic, we are
> experimenting things on MCUs and we need to assess on measurements)
Yeah, so you cannot have it both ways, I'm afraid. Either you adjust
the HW clock or not. If you don't, it becomes impractical to program
the event registers for output signals. (Time stamps on input signals
are not an issue, though)
> -timer support for virtual clocks (nanosleep likely, as yous suggested
> IIRC).
Right, and this is (probably) difficult to sell on lkml. Look at the
hrtimer implementation to see what I mean.
I could imagine adding one additional hrtimer base under user space
control that isn't clock_monotonic or _realtime or _tai, but not N new
bases.
I think the best option for user space wanting timers in multiple
domains is to periodically do
gettime(monotonic); gettime(vclock); gettime(monotonic);
figure the conversion, and schedule using clock_monotonic.
HTH,
Richard
next prev parent reply other threads:[~2021-09-30 14:35 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-27 9:32 [PATCH net-next] ptp: add vclock timestamp conversion IOCTL Sebastien Laveze
2021-09-27 14:59 ` Richard Cochran
2021-09-27 16:00 ` Sebastien Laveze
2021-09-27 20:23 ` Richard Cochran
2021-09-28 11:50 ` Sebastien Laveze
2021-09-28 13:31 ` Richard Cochran
2021-09-29 15:00 ` Sebastien Laveze
2021-09-30 14:35 ` Richard Cochran [this message]
2021-10-07 13:31 ` Sebastien Laveze
2021-10-07 20:19 ` Richard Cochran
2021-10-08 7:13 ` Sebastien Laveze
2021-10-09 18:24 ` Richard Cochran
2021-10-09 18:25 ` Richard Cochran
2021-10-11 12:58 ` Richard Cochran
2021-10-12 16:14 ` Richard Cochran
2021-10-13 9:56 ` Sebastien Laveze
2021-10-13 13:10 ` Richard Cochran
2021-10-13 13:28 ` Sebastien Laveze
2021-10-13 17:54 ` Richard Cochran
2021-10-14 13:27 ` Sebastien Laveze
2021-09-27 18:28 ` Randy Dunlap
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210930143527.GA14158@hoboy.vegasvil.org \
--to=richardcochran@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=rui.sousa@oss.nxp.com \
--cc=sebastien.laveze@oss.nxp.com \
--cc=yangbo.lu@nxp.com \
--cc=yannick.vignon@oss.nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).