From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:51487) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QvqB4-00018i-2z for qemu-devel@nongnu.org; Tue, 23 Aug 2011 08:34:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QvqB2-0004Ob-VE for qemu-devel@nongnu.org; Tue, 23 Aug 2011 08:33:58 -0400 Received: from e4.ny.us.ibm.com ([32.97.182.144]:47460) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QvqB2-0004OX-Ra for qemu-devel@nongnu.org; Tue, 23 Aug 2011 08:33:56 -0400 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e4.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id p7NCAdaf016171 for ; Tue, 23 Aug 2011 08:10:39 -0400 Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p7NCXotX165088 for ; Tue, 23 Aug 2011 08:33:50 -0400 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p7N8XaRX025738 for ; Tue, 23 Aug 2011 05:33:37 -0300 Message-ID: <4E539E2C.7090407@us.ibm.com> Date: Tue, 23 Aug 2011 07:33:48 -0500 From: Anthony Liguori 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> In-Reply-To: <4E535A08.8050706@redhat.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: Paolo Bonzini Cc: qemu-devel@nongnu.org, Jan Kiszka On 08/23/2011 02:43 AM, Paolo Bonzini wrote: > On 08/22/2011 09:21 PM, Anthony Liguori wrote: >> - ticks = cpu_get_real_ticks(); >> - if (timers_state.cpu_ticks_prev > ticks) { >> - /* Note: non increasing ticks may happen if the host uses >> - software suspend */ >> - timers_state.cpu_ticks_offset += timers_state.cpu_ticks_prev - ticks; >> - } >> + ticks = get_clock(); >> >> [...] >> >> -static inline int64_t cpu_get_real_ticks(void) >> -{ >> - int64_t val; >> - asm volatile ("rdtsc" : "=A" (val)); >> - return val; >> -} >> - > > 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. 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. Regards, Anthony Liguori > > I had some more cleanups in this area, I'll try to get them tested and > submitted but I have little time for this right now. > > Paolo