Bug 449187 - Clock drift in certain KVM guest
Summary: Clock drift in certain KVM guest
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: kvm
Version: 9
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Glauber Costa
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-05-31 00:06 UTC by Alan Pevec
Modified: 2009-07-14 15:21 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-07-14 15:21:25 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Alan Pevec 2008-05-31 00:06:49 UTC
Description of problem:
in certain KVM guests (let's call it WUI) time drifts significantly (slows down)
while in the other guest (clet's call it NODE) on the same host, time stays
stable. One significant difference is:
NODE - LOC:     100321   Local timer interrupts
WUI  - LOC:    1088230   Local timer interrupts

This happens even with clocksource=acpi_pm boot param
( TSC is unstable, from WUI dmesg:  Clocksource tsc unstable (delta = 4686864172 ns)


Version-Release number of selected component (if applicable):
kernel-2.6.25.3-18.fc9.i686
kvm-65-7.fc9.i386


How reproducible:
every time

Steps to Reproduce:
1. build WUI guest:
   wget http://ovirt.org/download/create-wui-appliance.sh
   sh create-wui-appliance.sh -v -t 
http://download.fedora.redhat.com/pub/fedora/linux/releases/9/Fedora/i386/os/ -k
http://ovirt.org/download/wui-rel-i386.ks

2. on WUI: service ntpd stop; ntpd -q -d
3. wait ~10min; ntpd -q -d
  
Actual results:
clock drifted, ntpd -q -d output shows (last line): e.g.
...
ntpd: time set +74.993754s


Expected results:
clock doesn't drift: e.g.
...
ntpd: time slew -0.054264s


Additional info:

Comment 1 Glauber Costa 2008-06-02 13:34:19 UTC
For the record, what is the current clocksource in your guest?
(As the output of cat
/sys/devices/system/clocksource/clocksource0/current_clocksource)




Comment 2 Alan Pevec 2008-06-02 14:55:22 UTC
acpi_pm

since I have clocksource=acpi_pm but it was also falling back to this b/c of
unstable tsc (Clocksource tsc unstable w/ few sec delta in dmesg)

Important data I missed in the report is CPU:
model name      : Intel(R) Core(TM)2 Quad  CPU   Q9450  @ 2.66GHz
stepping        : 6
This stepping doesn't have C2 support.
Mobo is Q35 beta


Comment 3 Alan Pevec 2008-06-02 14:57:58 UTC
On suggestion from chrisw I'm testing with:

commit 3d80840d96127401ba6aeadd813c3a15b84e70fe
Author: Marcelo Tosatti <mtosatti>
Date:   Fri Apr 11 14:53:26 2008 -0300

    KVM: hlt emulation should take in-kernel APIC/PIT timers into account
    
After running for few hours, the same VM doesn't exhibit such time drift,
ntpd -q -d says: time slew +0.039053s


Comment 4 Alan Pevec 2008-06-02 19:57:58 UTC
Adding to comment 3 - after I left VM idling for few more hourse, time drifted
again ( > 1000s so it was too much even for ntpd -q )
Will try now on a different CPU...


Comment 5 Chris Lalancette 2008-06-03 11:25:06 UTC
Just for another data point, I have a Core2 Due E6850, running the WUI, and ntp
seems to be keeping the time perfectly in sync for me.

Chris Lalancette

Comment 6 Perry Myers 2008-06-03 14:21:35 UTC
Another data point.  I have a Core2 Duo E6850 running the WUI and when I disable
NTP my guest loses time rapidly (1 minute lost out of every 10).  

I tried a test where I disabled ACPI in the Guest via libvirt config, and now
time is kept perfectly in sync with the guest.

Comment 7 Alan Pevec 2008-06-03 15:14:29 UTC
I can confirm that on Q9450 with ACPI disabled in WUI guest, I get stable time,
ntpd -q after ~15min shows:
ntpd: time slew +0.051113
And this is with original F9 KVM kmods:
/sys/module/kvm/srcversion 
B9D8A55988A3D85FD59B48E

/sys/module/kvm_intel/srcversion 
26AB3206D8CB359A69D697D



Comment 8 Alexander Boström 2008-12-23 17:31:33 UTC
I see this too. F10 x86_64 host on Athlon X2, F10 i686 guests. clocksource=acpi_pm

How little drift is reasonable to expect?

If time on the host is well kept then there should be nothing for ntpd in the guests to do. The guests should just hwclock --hctosys, ntpdate or similar once at boot and then time in the guest should stay in sync with the host from then on, because there should be no clock drift to compensate for. But can we hope for acpi_pm emulation to become that good?

Comment 9 Bug Zapper 2009-06-10 01:18:17 UTC
This message is a reminder that Fedora 9 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 9.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '9'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 9's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 9 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 10 Doncho Gunchev 2009-06-20 07:17:22 UTC
I am using KVM with 64 bit fedora 11 and 64 bit guests (maybe the version should get updated) and had similar problem.

With fedora 11 guest 'cat /sys/devices/system/clocksource/clocksource0/current_clocksource' shows kvm-clock and all works fine (ntpd).

With CentOS kernel 2.6.18-128.1.14.el5 I get jitter > 5000 and ntpd refuses to work. Clock source is jiffies (the only one available).

With CentOS kernel 2.6.18-128.1.14.el5 with 'notsc divider=10' added to the kernel boot line I get jitter from 18 to 20 on three virtual machines and ntpd works fine.

HTH.

Comment 11 Bug Zapper 2009-07-14 15:21:25 UTC
Fedora 9 changed to end-of-life (EOL) status on 2009-07-10. Fedora 9 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.