From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:47655) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QvqKy-0005BF-Vx for qemu-devel@nongnu.org; Tue, 23 Aug 2011 08:44:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QvqKy-0007A2-5E for qemu-devel@nongnu.org; Tue, 23 Aug 2011 08:44:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:3987) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QvqKx-00079y-TB for qemu-devel@nongnu.org; Tue, 23 Aug 2011 08:44:12 -0400 Message-ID: <4E53A095.6040002@redhat.com> Date: Tue, 23 Aug 2011 14:44:05 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1314040874-9259-1-git-send-email-aliguori@us.ibm.com> <1314040874-9259-2-git-send-email-aliguori@us.ibm.com> <4E535A08.8050706@redhat.com> <4E539E2C.7090407@us.ibm.com> In-Reply-To: <4E539E2C.7090407@us.ibm.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 2/2] [RFC] time: refactor QEMU timer to use GHRTimer List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-devel@nongnu.org, Jan Kiszka 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