[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170113145048.GA29706@localhost.localdomain>
Date: Fri, 13 Jan 2017 15:50:48 +0100
From: Richard Cochran <richardcochran@...il.com>
To: Vitaly Kuznetsov <vkuznets@...hat.com>
Cc: Thomas Gleixner <tglx@...utronix.de>, devel@...uxdriverproject.org,
linux-kernel@...r.kernel.org,
Haiyang Zhang <haiyangz@...rosoft.com>,
"K. Y. Srinivasan" <kys@...rosoft.com>,
John Stultz <john.stultz@...aro.org>,
Alex Ng <alexng@...rosoft.com>,
Stephen Hemminger <stephen@...workplumber.org>
Subject: Re: [PATCH RFC] hv_utils: implement Hyper-V PTP source
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
Powered by blists - more mailing lists