All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vinicius Costa Gomes <vinicius.gomes@intel.com>
To: Miroslav Lichvar <mlichvar@redhat.com>, netdev@vger.kernel.org
Cc: Richard Cochran <richardcochran@gmail.com>,
	intel-wired-lan@lists.osuosl.org
Subject: Re: [Intel-wired-lan] [RFC PATCH 1/4] ptp: add PTP_SYS_OFFSET_EXTENDED ioctl
Date: Fri, 26 Oct 2018 15:16:47 -0700	[thread overview]
Message-ID: <87in1o73qo.fsf@intel.com> (raw)
In-Reply-To: <20181026162742.631-2-mlichvar@redhat.com>

Hi Miroslav,

Miroslav Lichvar <mlichvar@redhat.com> writes:

> The PTP_SYS_OFFSET ioctl, which can be used to measure the offset
> between a PHC and the system clock, includes the total time that the
> gettime64 function of a driver needs to read the PHC timestamp.
>
> This typically involves reading of multiple PCI registers (sometimes in
> multiple iterations) and the register that contains the lowest bits of
> the timestamp is not read in the middle between the two readings of the
> system clock. This asymmetry causes the measured offset to have a
> significant error.
>
> Introduce a new ioctl, driver function, and helper functions, which
> allow the reading of the lowest register to be isolated from the other
> readings in order to reduce the asymmetry. The ioctl and driver function
> return three timestamps for each measurement:
> - system time right before reading the lowest bits of the PHC timestamp
> - PHC time
> - system time immediately after reading the lowest bits of the PHC
>   timestamp

Cool stuff!

Just one little thing below. Feel free to add my ack to the series.

Acked-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>

>
> Cc: Richard Cochran <richardcochran@gmail.com>
> Cc: Jacob Keller <jacob.e.keller@intel.com>
> Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
> ---
>  drivers/ptp/ptp_chardev.c        | 39 ++++++++++++++++++++++++++++++++
>  include/linux/ptp_clock_kernel.h | 26 +++++++++++++++++++++
>  include/uapi/linux/ptp_clock.h   | 12 ++++++++++
>  3 files changed, 77 insertions(+)
>
> diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
> index 2012551d93e0..1a04c437fd4f 100644
> --- a/drivers/ptp/ptp_chardev.c
> +++ b/drivers/ptp/ptp_chardev.c
> @@ -124,11 +124,13 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)
>  	struct ptp_clock_caps caps;
>  	struct ptp_clock_request req;
>  	struct ptp_sys_offset *sysoff = NULL;
> +	struct ptp_sys_offset_extended *sysoff_extended = NULL;
>  	struct ptp_sys_offset_precise precise_offset;
>  	struct ptp_pin_desc pd;
>  	struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock);
>  	struct ptp_clock_info *ops = ptp->info;
>  	struct ptp_clock_time *pct;
> +	struct ptp_system_timestamp sts;
>  	struct timespec64 ts;
>  	struct system_device_crosststamp xtstamp;
>  	int enable, err = 0;
> @@ -211,6 +213,43 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)
>  			err = -EFAULT;
>  		break;
>  
> +	case PTP_SYS_OFFSET_EXTENDED:
> +		if (!ptp->info->gettimex64) {
> +			err = -EOPNOTSUPP;
> +			break;
> +		}
> +		sysoff_extended = memdup_user((void __user *)arg,
> +					      sizeof(*sysoff_extended));

Looks like you forgot to free 'sysoff_extended', no? 

WARNING: multiple messages have this Message-ID (diff)
From: Vinicius Costa Gomes <vinicius.gomes@intel.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [RFC PATCH 1/4] ptp: add PTP_SYS_OFFSET_EXTENDED ioctl
Date: Fri, 26 Oct 2018 15:16:47 -0700	[thread overview]
Message-ID: <87in1o73qo.fsf@intel.com> (raw)
In-Reply-To: <20181026162742.631-2-mlichvar@redhat.com>

Hi Miroslav,

Miroslav Lichvar <mlichvar@redhat.com> writes:

> The PTP_SYS_OFFSET ioctl, which can be used to measure the offset
> between a PHC and the system clock, includes the total time that the
> gettime64 function of a driver needs to read the PHC timestamp.
>
> This typically involves reading of multiple PCI registers (sometimes in
> multiple iterations) and the register that contains the lowest bits of
> the timestamp is not read in the middle between the two readings of the
> system clock. This asymmetry causes the measured offset to have a
> significant error.
>
> Introduce a new ioctl, driver function, and helper functions, which
> allow the reading of the lowest register to be isolated from the other
> readings in order to reduce the asymmetry. The ioctl and driver function
> return three timestamps for each measurement:
> - system time right before reading the lowest bits of the PHC timestamp
> - PHC time
> - system time immediately after reading the lowest bits of the PHC
>   timestamp

Cool stuff!

Just one little thing below. Feel free to add my ack to the series.

Acked-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>

>
> Cc: Richard Cochran <richardcochran@gmail.com>
> Cc: Jacob Keller <jacob.e.keller@intel.com>
> Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
> ---
>  drivers/ptp/ptp_chardev.c        | 39 ++++++++++++++++++++++++++++++++
>  include/linux/ptp_clock_kernel.h | 26 +++++++++++++++++++++
>  include/uapi/linux/ptp_clock.h   | 12 ++++++++++
>  3 files changed, 77 insertions(+)
>
> diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
> index 2012551d93e0..1a04c437fd4f 100644
> --- a/drivers/ptp/ptp_chardev.c
> +++ b/drivers/ptp/ptp_chardev.c
> @@ -124,11 +124,13 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)
>  	struct ptp_clock_caps caps;
>  	struct ptp_clock_request req;
>  	struct ptp_sys_offset *sysoff = NULL;
> +	struct ptp_sys_offset_extended *sysoff_extended = NULL;
>  	struct ptp_sys_offset_precise precise_offset;
>  	struct ptp_pin_desc pd;
>  	struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock);
>  	struct ptp_clock_info *ops = ptp->info;
>  	struct ptp_clock_time *pct;
> +	struct ptp_system_timestamp sts;
>  	struct timespec64 ts;
>  	struct system_device_crosststamp xtstamp;
>  	int enable, err = 0;
> @@ -211,6 +213,43 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)
>  			err = -EFAULT;
>  		break;
>  
> +	case PTP_SYS_OFFSET_EXTENDED:
> +		if (!ptp->info->gettimex64) {
> +			err = -EOPNOTSUPP;
> +			break;
> +		}
> +		sysoff_extended = memdup_user((void __user *)arg,
> +					      sizeof(*sysoff_extended));

Looks like you forgot to free 'sysoff_extended', no? 


--
Vinicius

  reply	other threads:[~2018-10-27  6:55 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-26 16:27 [RFC PATCH 0/4] More accurate PHC<->system clock synchronization Miroslav Lichvar
2018-10-26 16:27 ` [Intel-wired-lan] " Miroslav Lichvar
2018-10-26 16:27 ` [RFC PATCH 1/4] ptp: add PTP_SYS_OFFSET_EXTENDED ioctl Miroslav Lichvar
2018-10-26 16:27   ` [Intel-wired-lan] " Miroslav Lichvar
2018-10-26 22:16   ` Vinicius Costa Gomes [this message]
2018-10-26 22:16     ` Vinicius Costa Gomes
2018-10-29 12:52     ` Miroslav Lichvar
2018-10-29 12:52       ` Miroslav Lichvar
2018-10-31  2:23   ` Richard Cochran
2018-10-31  2:23     ` [Intel-wired-lan] " Richard Cochran
2018-10-31  3:01     ` Richard Cochran
2018-10-31  3:01       ` [Intel-wired-lan] " Richard Cochran
2018-10-26 16:27 ` [RFC PATCH 2/4] e1000e: add support for extended PHC gettime Miroslav Lichvar
2018-10-26 16:27   ` [Intel-wired-lan] " Miroslav Lichvar
2018-10-26 16:27 ` [RFC PATCH 3/4] igb: " Miroslav Lichvar
2018-10-26 16:27   ` [Intel-wired-lan] " Miroslav Lichvar
2018-10-31  2:29   ` Richard Cochran
2018-10-31  2:29     ` [Intel-wired-lan] " Richard Cochran
2018-10-31  9:39     ` Miroslav Lichvar
2018-10-31  9:39       ` [Intel-wired-lan] " Miroslav Lichvar
2018-10-31 16:56       ` Keller, Jacob E
2018-10-31 16:56         ` [Intel-wired-lan] " Keller, Jacob E
2018-10-26 16:27 ` [RFC PATCH 4/4] ixgbe: " Miroslav Lichvar
2018-10-26 16:27   ` [Intel-wired-lan] " Miroslav Lichvar
2018-10-26 16:54   ` Keller, Jacob E
2018-10-26 16:54     ` [Intel-wired-lan] " Keller, Jacob E
2018-10-29 13:31     ` Miroslav Lichvar
2018-10-29 13:31       ` [Intel-wired-lan] " Miroslav Lichvar
2018-10-29 16:02       ` Keller, Jacob E
2018-10-29 16:02         ` [Intel-wired-lan] " Keller, Jacob E
2018-10-31 14:40       ` Richard Cochran
2018-10-31 14:40         ` [Intel-wired-lan] " Richard Cochran
2018-10-31 14:49         ` Miroslav Lichvar
2018-10-31 14:49           ` [Intel-wired-lan] " Miroslav Lichvar
2018-10-31 21:16           ` Richard Cochran
2018-10-31 21:16             ` [Intel-wired-lan] " Richard Cochran
2018-10-31 22:08             ` Keller, Jacob E
2018-10-31 22:08               ` [Intel-wired-lan] " Keller, Jacob E
2018-10-31 16:55         ` Keller, Jacob E
2018-10-31 16:55           ` [Intel-wired-lan] " Keller, Jacob E
2018-10-26 16:40 ` [RFC PATCH 0/4] More accurate PHC<->system clock synchronization Keller, Jacob E
2018-10-26 16:40   ` [Intel-wired-lan] " Keller, Jacob E
2018-10-26 16:51 ` Keller, Jacob E
2018-10-26 16:51   ` [Intel-wired-lan] " Keller, Jacob E
2018-10-31  2:25 ` Richard Cochran
2018-10-31  2:25   ` [Intel-wired-lan] " Richard Cochran

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=87in1o73qo.fsf@intel.com \
    --to=vinicius.gomes@intel.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=mlichvar@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=richardcochran@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.