|
From: | Paolo Bonzini |
Subject: | Re: [Qemu-devel] [PATCH 2/2] [RFC] time: refactor QEMU timer to use GHRTimer |
Date: | Tue, 23 Aug 2011 14:44:05 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20110707 Thunderbird/5.0 |
On 08/23/2011 02:33 PM, Anthony Liguori wrote:
cpu_get_ticks is used also to emulate the guest TSC, are you sure you want to change that uniformly to a 1 GHz rate?Where possible, CLOCK_MONOTONIC_RAW should be implemented in terms or rdtscp. It will provide the highest accuracy time source that you can get.
Not all machines have rdtscp. People do not want to see their rdtsc suddenly 20 times slower or so (that's more or less the speed difference between HPET access and rdtsc). Many also would likely be surprised to see a guest TSC that is 1 GHz. Xen did the same at some point, and backed it out.
And you're not using CLOCK_MONOTONIC_RAW anyway (yet?). If you used it, you should also change the CPUID features since QEMU would be providing a constant, invariant TSC to all guests.
So I don't think there's any different in terms of timer granularity from using CLOCK_MONOTONIC_RAW and rdtsc directly other than the former is more correct.
CLOCK_MONOTONIC_RAW has its resolution capped to 1 ns. It is as correct and as precise, but less accurate than the TSC if your machine's TSC is constant and invariant.
Paolo
[Prev in Thread] | Current Thread | [Next in Thread] |