>> Zhao, Yunfeng wrote:
>> > Hi,
>> > We ran a testing against latest KVM to know its quality status.
>> > In the testing we tried to boot guests, test basic devices of
guest,
>and
>> > install guests.
>> >
>>
>> Thanks for doing this -- it is enormously useful.
>>
>> > Basic devices, Keybord,disk,VGA, and nic works well, but timer is
NOT
>> > accurate while running some workload on guests.
>> >
>>
>> We found that using an hrtimer enabled host with CONFIG_HZ=1000
improves
>> things.  However I don't think that it's as accurate as 7 seconds in
20
>> minutes (that's better than 1% accuracy), so probably more work is
>> needed in qemu to correct time drift.
>>
>>
>>
>
>One of the things that I noticed during the development of the APIC
>patchset that was quite odd:
>
>1) Linux guest was programming the PIT for 4ms.
>2) QEMU was programming the sigalarm for 1ms
>3) SIGALARM was only delivered every 8ms (probably maximum resolution
>with this setup) so the timer-wheel injected two PIT interrupts per
>SIGALARM.
>4) Since PICs can generally only queue a single interrupt, the second
>tick was always lost.
>
>HOWEVER (and this is where it gets really weird), linux wallclock time
>in the guest runs at normal speed even with PIT at 1/2 freq.  If I made
>corrections such that every PIT tick is actually delivered to the
guest,
>wallclock runs at 2x.
>
>So aside from the fact that I know we are losing at least 50% of our
>ticks, it seems that something else was hacked to accommodate it
somehow
>(perhaps the RTC emulation?).
>
>Hopefully this information might be useful to someone who wishes to
>tackle the problem.
>
>-Greg
>

The current status is that the guest clock depends on qemu's PIT
interrupts which depend on qemu's SIGALARM which depends on the host's
HZ frequency.

There will always be situations where the guest wants higher frequency
than the host. There will always be situations where SIGALARMS are not
accurate, or as Greg pointed out that several signals collapse into one
irq, thus causing time drift problems in the guest.

To solve the problem we need the following:
1. Have the host kernel config with hrtimer and dyn-tick.
   It increases the accuracy of SIGALARM.
2. Based on the above, implement dyn-tick timer in qemu, and have the
PIT
   use qemu's dynamic timer.

I tested guests running with x86 hrtimer/dyn-tick patch and it worked
fine with the regular qemu. Fixing '2' will make sure that drift of 7
seconds in 20 minutes won't happen.
        Dor

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to