Re: [Qemu-devel] [PATCH 1/2] Add HPET emulation to qemu (v3)

Beth Kon
2008-10-20T19:08:21Z

On Fri, 2008-10-17 at 16:49 +0100, Jamie Lokier wrote:
> Beth Kon wrote:
> > Clock drift on Linux is in the range of .017% - .019%, loaded and unloaded. I
> > haven't found a straightforward way to test on Windows and would appreciate
> > any pointers to existing approaches.
>
> Is there any reason why there should be any clock drift, when the
> guest is using a non-PIT clock?
>
> I'm probably being naive, but with 32-bit or 64-bit HPET counters
> available to the guest, and accurate values from the CMOS clock
> emulation, I don't see why drift would accumulate over the long term
> relative to the host clock.

I was measuring with ntpdate, so the drift is with respect to the ntp
server pool, not the host clock. But in any case, since timer interrupts
and reads of the hpet counter are at the mercy of the host scheduler
(i.e., the qemu process can be swapped out at any time during hpet read
or timer expiration), I'd guess there would always be some amount of
inaccuracy. Also, qemu checks for timer expiration (qemu_run_timers) as
part of a bigger loop (main_loop_wait), so the varying amounts of work
to do elsewhere in the loop from iteration to iteration would also
introduce irregular delays.
>
> -- Jamie
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Elizabeth Kon (Beth)
IBM Linux Technology Center
Open Hypervisor Team
email: eak@us.ibm.com