[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#839627: linux-image-4.7.0-1-amd64: kvm-clock provides unadjusted time



Control: tag -1 moreinfo

On Mon, 2016-10-03 at 04:33 -0400, Gedalya wrote:
> Package: src:linux
> Version: 4.7.5-1
> Severity: normal
> 
> Dear Maintainer,
> 
> When booting the host with linux 3.16, it looks like kvm-clock
> provides guests with time as adjusted by ntpd.
[...]
> When booting with linux 4.6/4.7,
[...]
> ntpd measures on the guest the same drift as on the host.
> This gives me the impression that on the later kernels, kvm-clock
> provides a raw, unadjusted time.
> 
> 
> On this particular setup I have the host running a stratum-1 NTP
> server, hooked up to a GPS device.
> The guests sync against it and other servers.
> However I observe the same behavior on several other servers running
> in various locations.
> On those running linux 3.16, the guests' measured drift hovers around
> zero, and on those running 4.6 or 4.7, the drift is around the same
> as on the host.
[...]

Presumably you consider the behaviour on 4.6/4.7 to be undesirable.

From what I can see, the host side may attempt to keep the pvclock
synchronised with its real time but it is not recommended for guests to
rely on this.  This synchronisation is now optional and controlled by
the kvmclock_periodic_sync module parameter, *but* it defaults to Y so
I don't see why the actual behaviour has changed.

First, check that this module parameter isn't somehow being turned off:

    cat /sys/module/kvm/parameters/kvmclock_periodic_sync

Assuming it's on, check that the host is sending clock updates to the
guest.  You can trace that by running the following commands in the
host as root, while the guest is running:

    cd /sys/kernel/debug/tracing
    echo function > current_tracer 
    echo kvmclock_update_fn > set_ftrace_filter
    echo 1 > tracing_on
    cat trace_pipe

The update interval is 5 minutes so you'll need to wait at least that
long to be sure it's not happening.  On my KVM host running 4.7 I saw
this after a few minutes:

     kworker/3:0-23291 [003] .... 360386.076593: kvmclock_update_fn <-process_one_work

Ben.

-- 
Ben Hutchings
Every program is either trivial or else contains at least one bug

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: