Netdev List
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Richard Cochran <richardcochran@gmail.com>
Cc: "Christopher S. Hall" <christopher.s.hall@intel.com>,
	jeffrey.t.kirsher@intel.com, hpa@zytor.com, mingo@redhat.com,
	john.stultz@linaro.org, x86@kernel.org,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	intel-wired-lan@lists.osuosl.org, peterz@infradead.org
Subject: Re: [PATCH v3 3/4] Add support for driver cross-timestamp to PTP_SYS_OFFSET ioctl
Date: Sun, 23 Aug 2015 10:15:00 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.11.1508231011360.3873@nanos> (raw)
In-Reply-To: <20150822211718.GA8561@netboy>

On Sat, 22 Aug 2015, Richard Cochran wrote:
> On Sat, Aug 22, 2015 at 10:33:48PM +0200, Thomas Gleixner wrote:
> > > @@ -196,19 +197,31 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)
> > >  			break;
> > >  		}
> > >  		pct = &sysoff->ts[0];
> > > -		for (i = 0; i < sysoff->n_samples; i++) {
> > > -			getnstimeofday64(&ts);
> > > +		if (ptp->info->getsynctime64 && sysoff->n_samples == 1 &&
> > 
> > The number of samples should be irrelevant for this sampling method.
> 
> Chris had send me a preview of this before he posted, so I can explain
> that test for one sample.
> 
> User space requests N (1 to 25) samples of the two clocks.  The kernel
> is supposed to deliver that many samples.  This has always been the
> documented behavior.  From ptp_clock.h:
> 
>   struct ptp_sys_offset {
> 	unsigned int n_samples; /* Desired number of measurements. */
> 	unsigned int rsv[3];    /* Reserved for future use. */
> 	/*
> 	 * Array of interleaved system/phc time stamps. The kernel
> 	 * will provide 2*n_samples + 1 time stamps, with the last
> 	 * one as a system time stamp.
> 	 */
> 	struct ptp_clock_time ts[2 * PTP_MAX_SAMPLES + 1];
>   };
> 
> So the kernel cannot simply change n_samples to 1.
> 
> I would prefer to have a new system call that compares any two posix
> clock_t, but that is of course more work.
> 
> Allowing n_samples=1 as a special case is a kind of overloading of the
> ioctl to support the new capability.  At least it preserves the
> behavior of the interface from the user's perspective.

So why can't you take N samples from the synced hardware? It does not
make any sense to me to switch to the imprecise mode if nsamples > 1.

You can also provide a new IOCTL PTP_SYS_OFFSET_PRECISE which returns
-ENOSYS if hardware timestamping is not available and avoid the whole
nsamples dance for the case where we can get precise timestamps.

Thanks,

	tglx

  reply	other threads:[~2015-08-23  8:15 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-21 18:52 [PATCH v3 0/4] Patchset enabling hardware based cross-timestamps for next gen Intel platforms Christopher S. Hall
2015-08-21 18:52 ` [PATCH v3 1/4] Add correlated clocksource deriving system time from an auxiliary clocksource Christopher S. Hall
2015-08-22 20:17   ` Thomas Gleixner
2015-09-03 23:20     ` Hall, Christopher S
2015-09-04  8:11       ` Richard Cochran
2015-09-04 14:28         ` Peter Zijlstra
2015-09-04 21:12           ` Hall, Christopher S
2015-09-04 13:02       ` Thomas Gleixner
2015-09-04 15:10         ` Peter Zijlstra
2015-09-04 15:17           ` Richard Cochran
2015-09-04 15:41             ` Peter Zijlstra
2015-09-04 16:35               ` Thomas Gleixner
2015-09-04 21:01                 ` Hall, Christopher S
2015-09-05  8:46                   ` Thomas Gleixner
2015-09-05 10:04                     ` Ingo Molnar
2015-09-04 15:32         ` Richard Cochran
2015-09-04 21:50       ` John Stultz
2015-08-21 18:52 ` [PATCH v3 2/4] Added ART correlated clocksource and ART CPU feature Christopher S. Hall
2015-08-22 20:26   ` Thomas Gleixner
2015-08-21 18:52 ` [PATCH v3 3/4] Add support for driver cross-timestamp to PTP_SYS_OFFSET ioctl Christopher S. Hall
2015-08-22 20:33   ` Thomas Gleixner
2015-08-22 21:17     ` Richard Cochran
2015-08-23  8:15       ` Thomas Gleixner [this message]
2015-08-23 11:25         ` Richard Cochran
2015-08-24 20:16           ` Hall, Christopher S
2015-08-25  7:31             ` Richard Cochran
2015-08-21 18:52 ` [PATCH v3 4/4] Enabling hardware supported PTP system/device crosstimestamping Christopher S. Hall
2015-08-22 20:46   ` Thomas Gleixner

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=alpine.DEB.2.11.1508231011360.3873@nanos \
    --to=tglx@linutronix.de \
    --cc=christopher.s.hall@intel.com \
    --cc=hpa@zytor.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=richardcochran@gmail.com \
    --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