From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=56200 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PmSv3-000064-WB for qemu-devel@nongnu.org; Mon, 07 Feb 2011 10:22:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PmSv1-0004Hi-IH for qemu-devel@nongnu.org; Mon, 07 Feb 2011 10:22:24 -0500 Received: from mail-bw0-f45.google.com ([209.85.214.45]:43163) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PmSv1-0004HX-AC for qemu-devel@nongnu.org; Mon, 07 Feb 2011 10:22:23 -0500 Received: by bwz16 with SMTP id 16so5130447bwz.4 for ; Mon, 07 Feb 2011 07:22:22 -0800 (PST) Message-ID: <4D500E2A.8030003@codemonkey.ws> Date: Mon, 07 Feb 2011 09:22:18 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] Re: [RFC: 0/2] patch for QEMU HPET periodic timer emulation to alleviate time drift References: <480481933.225059.1296734409954.JavaMail.root@zmail07.collab.prod.int.phx2.redhat.com> <1375835067.226263.1296740625327.JavaMail.root@zmail07.collab.prod.int.phx2.redhat.com> <4D4AC99A.2070803@siemens.com> <4D4B0B07.2040904@codemonkey.ws> <4D4B1CF8.8040800@web.de> <4D4B5F23.7040801@codemonkey.ws> <4D4BBF55.9060000@web.de> <4D4FE6BF.5080502@redhat.com> <4D4FEF81.1040603@codemonkey.ws> <4D4FF02F.2030309@redhat.com> <4D4FF24A.7000004@codemonkey.ws> <4D4FFD3B.2030903@siemens.com> <4D5001A0.8020503@codemonkey.ws> <4D5004FC.80000@siemens.com> <4D5007B9.7060806@codemonkey.ws> <4D5008B3.90505@redhat.com> <4D50094D.1040003@siemens.com> <4D500AFC.4040206@redhat.com> In-Reply-To: <4D500AFC.4040206@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Avi Kivity Cc: Jan Kiszka , Glauber Costa , qemu-devel , kvm , Ulrich Obergfell On 02/07/2011 09:08 AM, Avi Kivity wrote: > On 02/07/2011 05:01 PM, Jan Kiszka wrote: >> > >> > On the other hand, we need a way to inject lost ticks into a >> > PeriodicTimer. If interrupt injection detects that an interrupt was >> > coalesced, we want the timer to schedule a new tick for us. >> >> Isn't absence of corresponding call to periodic_timer_ack() sufficient? > > It probably is. However, that API is easy to misuse; if you forget to > call it, the timer goes crazy. The default behaviour should be to > assume an ack and the API should provide adjustments. I disagree. You typically only call it in one place and as such, if you forget to add that call, you'll find out pretty quickly that you did something wrong. OTOH, accounting missed ticks is easy to not do correctly and it's hard to get feedback when that happens. > > Also need to design the API carefully for changing frequency (Windows > is known to do that) and switching from periodic to single shot. For > the first case I guess we need to adjust the deferred ticks to the new > time base (so if the frequency doubles, the lost ticks up to that > point double as well). For the second case, I guess we just lose time. Bus cycle based one shot timers probably need to be treated as a special case of changing an interval followed by setting the interval to zero. For non-bus cycle based timers, it probably doesn't matter and is easy to just use a one shot timer (like QEMUTimer). Regards, Anthony Liguori