Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751639AbbHVUe2 (ORCPT ); Sat, 22 Aug 2015 16:34:28 -0400 Received: from www.linutronix.de ([62.245.132.108]:42804 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750824AbbHVUe1 (ORCPT ); Sat, 22 Aug 2015 16:34:27 -0400 Date: Sat, 22 Aug 2015 22:33:48 +0200 (CEST) From: Thomas Gleixner To: "Christopher S. Hall" cc: jeffrey.t.kirsher@intel.com, hpa@zytor.com, mingo@redhat.com, john.stultz@linaro.org, richardcochran@gmail.com, 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 In-Reply-To: <1440183128-1384-4-git-send-email-christopher.s.hall@intel.com> Message-ID: References: <1440183128-1384-1-git-send-email-christopher.s.hall@intel.com> <1440183128-1384-4-git-send-email-christopher.s.hall@intel.com> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001,URIBL_BLOCKED=0.001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2598 Lines: 65 On Fri, 21 Aug 2015, Christopher S. Hall wrote: > From: Christopher Hall > > This patch allows system and device time ("cross-timestamp") to be > performed by the driver. Currently, the cross-timestamping is performed > in the PTP_SYS_OFFSET ioctl. The PTP clock driver reads gettimeofday() > and the gettime64() callback provided by the driver. The cross-timestamp > is best effort where the latency between the capture of system time > (getnstimeofday()) and the device time (driver callback) may be > significant. > > This patch adds an additional callback getsynctime64(). Which will be > called when the driver is able to perform a more accurate, implementation > specific cross-timestamping. For example, future network devices that > implement PCIE PTM will be able to precisely correlate the device clock > with the system clock with virtually zero latency between captures. > This added callback can be used by the driver to expose this functionality. > > The callback, getsynctime64(), will only be called when defined and > n_samples == 1 because the driver returns only 1 cross-timestamp where > multiple samples cannot be chained together. > > This patch also adds to the capabilities ioctl (PTP_CLOCK_GETCAPS), > allowing applications to query whether or not drivers implement the > getsynctime callback, providing more precise cross timestamping. That looks close to a proper changelog. A few nitpicks though. Please avoid 'This patch does ...' phrases. We already know that this is a patch. > Commit Details: Please get rid of this. It's useless noise. > Added additional callback to ptp_clock_info: > > * getsynctime64() > @@ -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. > + ptp->info->getsynctime64(ptp->info, &ts, &systs) == 0) { Why is this function taking struct timespec64 pointers? Just so every driver which implements the callback needs to convert from u64 to struct timespec64? That's simply wrong. Use u64 for both and do the conversion in the ioctl. Thanks, tglx -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/