Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1558448

Re: [PATCH RFC] hv_utils: implement Hyper-V PTP source

From Richard Cochran <richardcochran@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH RFC] hv_utils: implement Hyper-V PTP source
Date 2017-01-13 16:00 +0100
Message-ID <sZbuF-26I-7@gated-at.bofh.it> (permalink)
References <sY641-2Dh-27@gated-at.bofh.it> <sZ9Mf-1gU-43@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Jan 13, 2017 at 02:05:43PM +0100, Vitaly Kuznetsov wrote:
> Instead of doing in-kernel time adjustments offload the work to an
> NTP client by exposing TimeSync messages as a PTP device. Users my now
> decide what they want to use as a source.
> 
> I tested the solution with chrony, the config was:
> 
>  refclock PHC /dev/ptp0 poll 3 precision 1e-9
> 
> The result I'm seeing is accurate enough, the time delta between the guest
> and the host is almost always within [-10us, +10us], the in-kernel solution
> was giving us comparable results.

This approach is much nicer than the previous one.

> +static int hv_ptp_enable(struct ptp_clock_info *info,
> +			 struct ptp_clock_request *request, int on)
> +{
> +	return -EOPNOTSUPP;
> +}
> +
> +static int hv_ptp_gettime(struct ptp_clock_info *info, struct timespec64 *ts)
> +{
> +	u64 newtime;
> +	unsigned long flags;
> +
> +	spin_lock_irqsave(&host_ts.lock, flags);
> +	newtime = host_ts.host_time + get_timeadj_latency(host_ts.ref_time);
> +	*ts = ns_to_timespec64((newtime - WLTIMEDELTA) * 100);
> +	spin_unlock_irqrestore(&host_ts.lock, flags);
> +
> +	return 0;
> +}
> +
> +struct ptp_clock_info ptp_hyperv_info = {
> +	.name		= "hyperv",
> +	.enable         = hv_ptp_enable,
> +	.gettime64      = hv_ptp_gettime,

The code in drivers/ptp/ptp_clock.c calls

	.adjfreq (or adjfine)
	.adjtime
	.settime64

unconditionally, so you need to implement these returning EOPNOTSUPP.
(See also Documentation/ptp/ptp.txt)

> +	.owner		= THIS_MODULE,
> +};

Thanks,
Richard

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/4] hv_util: adjust system time smoothly Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-01-04 18:40 +0100
  [PATCH v2 4/4] hv_util: improve time adjustment accuracy by disabling interrupts Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-01-04 18:50 +0100
    Re: [PATCH v2 4/4] hv_util: improve time adjustment accuracy by  disabling interrupts Stephen Hemminger <stephen@networkplumber.org> - 2017-01-04 20:20 +0100
      Re: [PATCH v2 4/4] hv_util: improve time adjustment accuracy by disabling interrupts Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-01-05 13:40 +0100
        Re: [PATCH v2 4/4] hv_util: improve time adjustment accuracy by  disabling interrupts Stephen Hemminger <stephen@networkplumber.org> - 2017-01-05 18:50 +0100
    Re: [PATCH v2 4/4] hv_util: improve time adjustment accuracy by  disabling interrupts John Stultz <john.stultz@linaro.org> - 2017-01-07 02:10 +0100
      Re: [PATCH v2 4/4] hv_util: improve time adjustment accuracy by disabling interrupts Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-01-09 14:10 +0100
  Re: [PATCH v2 0/4] hv_util: adjust system time smoothly Thomas Gleixner <tglx@linutronix.de> - 2017-01-09 22:30 +0100
    Re: [PATCH v2 0/4] hv_util: adjust system time smoothly Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-01-10 15:40 +0100
      Re: [PATCH v2 0/4] hv_util: adjust system time smoothly Thomas Gleixner <tglx@linutronix.de> - 2017-01-10 16:00 +0100
        [PATCH RFC] hv_utils: implement Hyper-V PTP source Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-01-13 14:10 +0100
          Re: [PATCH RFC] hv_utils: implement Hyper-V PTP source Richard Cochran <richardcochran@gmail.com> - 2017-01-13 16:00 +0100
            Re: [PATCH RFC] hv_utils: implement Hyper-V PTP source Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-01-13 16:40 +0100
          Re: [PATCH RFC] hv_utils: implement Hyper-V PTP source Olaf Hering <olaf@aepfle.de> - 2017-01-13 16:30 +0100
            Re: [PATCH RFC] hv_utils: implement Hyper-V PTP source Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-01-13 16:40 +0100

csiph-web