linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Christopher S. Hall" <christopher.s.hall@intel.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	hpa@zytor.com, mingo@redhat.com, x86@kernel.org,
	jacob.e.keller@intel.com, richardcochran@gmail.com,
	davem@davemloft.net, sean.v.kelley@intel.com,
	linus.walleij@linaro.org
Subject: Re: [Intel PMC TGPIO Driver 0/5] Add support for Intel PMC Time GPIO Driver with PHC interface changes to support additional H/W Features
Date: Mon, 2 Mar 2020 17:56:15 -0800	[thread overview]
Message-ID: <20200303015615.GA15531@skl-build> (raw)
In-Reply-To: <87mu95ne3q.fsf@nanos.tec.linutronix.de>

Hi Thomas,

Thank you for your suggestions.

On Thu, Feb 27, 2020 at 12:06:01AM +0100, Thomas Gleixner wrote:
> Christopher,
> 
> "Christopher S. Hall" <christopher.s.hall@intel.com> writes:
> > On Fri, Jan 31, 2020 at 07:14:49PM +0100, Thomas Gleixner wrote:
> >> christopher.s.hall@intel.com writes:
> >> >
> >> > The TGPIO hardware doesn't implement interrupts. For TGPIO input, the
> >> > output edge-timestamp API is re-used to implement a user-space polling
> >> > interface. For periodic input (e.g. PPS) this is fairly efficient,
> >> > requiring only a marginally faster poll rate than the input event
> >> > frequency.
> >> 
> >> I really have a hard time to understand why this is implemented as part
> >> of PTP while you talk about PPS at the same time.
> >
> > We primarily need support for periodic input and output uses cases.
> > Apologies for omitting the periodic output use case from the cover
> > letter. While TGPIO isn't associated with a PTP timestamp clock, the PHC
> > pin/clock interface fits the usage otherwise.
> 
> Which usage? PTP like usage? I really have a hard time to make the
> connection. PTP is as the name says a protocol to synchronize time
> across a network.
> 
> What you're having is a GPIO which has some magic timestamp clock which
> can be correlated back to ART/TSC, right?

Right.

> > The customer requested usages are 1 kHz and 1 Hz for both input and
> > output. Some higher level use cases are:
> > - using a GPS PPS signal to sync the system clock
> 
> That makes at least some sense. See below.
> 
> > - auditing timesync precision for financial services, especially high
> > 	frequency trading (e.g. MiFID).
> 
> A good reason to not support it at all. Aside of that I have no idea how
> that auditing is supposed to work. Just throwing a few buzzwords around
> is not giving much technical context.
> 
> > Apart from clock import/export applications, timestamping single I/O
> > events are potentially valuable for industrial control applications
> > (e.g. motor position sensing vs. time). As time sync precision
> > requirements for these applications are tightened, standard GPIO
> > timing precision will not be good enough.
> 
> Well, coming from that industry I really doubt that you can do anything
> useful with it, but hey it's been 25 years since I stopped working on
> motor and motion controllers :)
> 
> Anyway, the device we are talking about is a GPIO device with inputs and
> outputs plus bells and whistels attached to it.
> 
> On the input side this provides a timestamp taken by the hardware when
> the input level changes, i.e. hardware based time stamping instead of
> software based interrupt arrival timestamping. Looks like an obvious
> extension to the GPIO subsystem.
> 
> How that timestamp is processed/converted and what an application can
> actually do with it is a secondary problem:
> 
>   - PPS mode:
> 
>     This can be implemented as an actual PPS driver which consumes the
>     GPIO, does timer based polling and feeds the timestamp into the PPS
>     subsystem. Might be not the most accurate solution, so I can see why
>     you want to use the PTP interface for it, which provides the raw
>     clocksource (ART/TSC) and the correlated monotonic/realtime
>     timestamps. But then again this wants to be a PTP driver consuming
>     the GPIO and the timestamp via timer based polling.
> 
>   - GPIO sampling
>   
>     That's totally disconnected from PPS/PTP and just provides a
>     correlated clock monotonic timestamp to the application.
> 
>     That covers your motor example :)
> 
>   - Timesync validation:
> 
>     -Enocluehowthatshouldworkatall
> 
> And of course you can use the GPIO input just as input without bells and
> whistels :)
> 
> Now you have the output side which again is a GPIO in the first
> place. But then it also has a secondary function which allows to create
> a periodic output with a magic correlation to the ART and some way to
> actually adjust the frequency. Neither of those two functions are in
> anyway relatable to PTP AFAICT.
> 
> The periodic, programmable and adjustable output is pretty much a PWM of
> some form and what you want to tell it is: Output a pulse at a given
> frequency. Due to the fact that the input clock of that thing is ART you
> can do the magic transformation from ART frequency to frequency adjusted
> clock monotonic in order to tweak the parameters so they actually end up
> generating your precise output frequency.  Tell the driver which
> frequency you want and it retrieves the correlation information from the
> kernel and uses it to achieve a precise output frequency. Doesn't sound
> like rocket science and does not required new magic ioctls.

This will have a few touch points in the kernel - PWM, GPIO, PPS. I'll
work on an RFC patchset.

> I might be missing something, but you surely can fill the blanks then.
> 
> Thanks,
> 
>         tglx

Thanks,
Christopher

  reply	other threads:[~2020-03-03  1:56 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-11 21:48 [Intel PMC TGPIO Driver 0/5] Add support for Intel PMC Time GPIO Driver with PHC interface changes to support additional H/W Features christopher.s.hall
2019-12-11 21:48 ` [Intel PMC TGPIO Driver 1/5] drivers/ptp: Add Enhanced handling of reserve fields christopher.s.hall
2020-01-31 16:54   ` Jacob Keller
2020-02-03  1:45     ` Richard Cochran
2020-02-24 23:29       ` Christopher S. Hall
2020-01-31 17:02   ` Jacob Keller
2020-02-03  1:27   ` Richard Cochran
2020-02-24 23:23     ` Christopher S. Hall
2019-12-11 21:48 ` [Intel PMC TGPIO Driver 2/5] drivers/ptp: Add PEROUT2 ioctl frequency adjustment interface christopher.s.hall
2020-02-03  2:14   ` Richard Cochran
2020-02-26  0:20     ` Christopher S. Hall
2019-12-11 21:48 ` [Intel PMC TGPIO Driver 3/5] drivers/ptp: Add user-space input polling interface christopher.s.hall
2020-02-03  2:28   ` Richard Cochran
2019-12-11 21:48 ` [Intel PMC TGPIO Driver 4/5] x86/tsc: Add TSC support functions to support ART driven Time-Aware GPIO christopher.s.hall
2019-12-11 21:48 ` [Intel PMC TGPIO Driver 5/5] drivers/ptp: Add PMC Time-Aware GPIO Driver christopher.s.hall
2020-02-03  2:31   ` Richard Cochran
2020-02-07 17:10   ` Linus Walleij
2020-02-07 17:28     ` Andrew Lunn
2020-02-07 19:49       ` Andy Shevchenko
2020-02-07 19:52         ` Andy Shevchenko
2020-02-24 23:17     ` Christopher S. Hall
2020-01-31 15:08 ` [Intel PMC TGPIO Driver 0/5] Add support for Intel PMC Time GPIO Driver with PHC interface changes to support additional H/W Features Jakub Kicinski
2020-01-31 18:14 ` Thomas Gleixner
2020-02-24 22:40   ` Christopher S. Hall
2020-02-26 23:06     ` Thomas Gleixner
2020-03-03  1:56       ` Christopher S. Hall [this message]
2020-03-03 13:00       ` Linus Walleij
2020-03-03 15:23         ` Richard Cochran
2020-03-03 15:24         ` Thomas Gleixner
2020-03-08 19:14           ` Jonathan Cameron
2020-02-03  4:08 ` Richard Cochran
2020-02-03 18:27   ` Jacob Keller
2020-02-25 23:37   ` Christopher S. Hall
2020-02-26  2:47     ` Richard Cochran
2020-03-03  2:01       ` Christopher S. Hall
2020-02-07 17:17 ` Linus Walleij

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=20200303015615.GA15531@skl-build \
    --to=christopher.s.hall@intel.com \
    --cc=davem@davemloft.net \
    --cc=hpa@zytor.com \
    --cc=jacob.e.keller@intel.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=richardcochran@gmail.com \
    --cc=sean.v.kelley@intel.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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).