Re: [PATCH v2 0/4] hv_util: adjust system time smoothly
From: Thomas Gleixner
Date: Tue Jan 10 2017 - 09:58:46 EST
Vitaly,
On Tue, 10 Jan 2017, Vitaly Kuznetsov wrote:
> Thomas Gleixner <tglx@xxxxxxxxxxxxx> writes:
> > 1) do_adjtimex() is assuming that there is a single client connected which
> > is responsible for the updates. So I seriously doubt that a NTP client
> > running in the guest will cooperate nicely with that timesync magic
> > under all circumstances.
>
> True, as Stephen suggested we'll probably need a way to inform (or
> block) the second NTP client about the ongoing timesync.
I don't see how that's supposed to work.
> > 2) There is still the possibility to force do_settimeofday() calls which
> > will upset NTP clients and have other side effects.
> >
> > Why is this call necessary at all? Just because it's in some spec?
>
> ICTIMESYNCFLAG_SYNC flag, demanding us to do so, is only set on the
> first packet (when our VM boots) and after suspend/resume/migration
> events. In these cases guest's time can be off by minutes/hours and
> do_settimeofday() is probably justified.
Usually boot/resume time is pretty accurate through RTC readout, but IIRC
then Windows still insists on RTC being set to local time instead of UTC,
which does not really work well on Linux.
> >
> > 3) What happens if you have a PTP capable network card mapped into your
> > guest and the guest uses PTP for time synchronization? The outcome is
> > predictible: CRAP.
> >
> > I can see the value for a host wide time synchronization, but please use
> > mechanisms which do not interfere with the rest of the time eco system in
> > Linux.
> >
> > The timesync thing happens periodically every 5 seconds, which you can feed
> > nicely into the PPS subsystem and then the guest side NTP daemon can
> > utilize it (or not).
> >
>
> My understanding is that we have no guarantees from the host that these
> messages are sent every 5 seconds and even when they are the interval is
> not very precise. We can probably create a 'fake' pps signal out of
> these messages (e.g. these messages will just be adjusting the frequency
> of the signal. I can play with such approach if you think this is the
> way to go.
The PPS stuff has some expectations about the interval, but it's a rather
solid piece of art and I think it's worth a try.
Thanks,
tglx