qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Michael Roth <mdroth@linux.vnet.ibm.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] main-loop: For tools, initialize timers as part of qemu_init_main_loop()
Date: Sun, 22 Jan 2012 18:12:50 -0600	[thread overview]
Message-ID: <4F1CA602.2020103@linux.vnet.ibm.com> (raw)
In-Reply-To: <jfgvlp$adk$1@dough.gmane.org>

On 01/22/2012 06:32 AM, Paolo Bonzini wrote:
> On 01/21/2012 09:39 PM, Jamie Lokier wrote:
>> Is this a timer that need to fire soon after setting, every time?
>>
>> I wonder if a different kind of Windows timer, lower-resolution, could
>> be used if the timeout is longer. If it has insufficient resolution,
>> it could be set to trigger a little early, then set a high-resolution
>> timer at that point.
>>
>> Maybe that could help for Linux CONFIG_NOHZ guests?
>
> No, it's an implementation detail of Windows multimedia timers. Just
> enabling them apparently burns CPU.
>
> There is another kind of timers for Windows but it didn't work reliably.
> Finding out why would be the right fix, but anyway

I'd looked into timer queues, which the developer docs suggested had 
deprecated the use of mm timers, but I came across this which I figured 
was why mm was preferred (%30 average error for a 50ms periodic/oneshot) 
by the QEMU code:

http://www.virtualdub.org/blog/pivot/entry.php?id=272

Apparently Windows 7 has some fixes for drift that makes them reasonable 
for a clock source, but still fairly low-res for an event timer.

I suppose we could use some historical timer data to adaptively 
determine a reasonable minimum resolution to set...basically if the last 
timer fired X ns ago, we'd configure the resolution to be 1/10th of that 
periodic or whatever, and start them off low-res as James suggested to 
avoid unnecessary CPU burn, but it's a pretty loose heuristic.

>
> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
>
> Paolo
>
>

  reply	other threads:[~2012-01-23  0:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-21  1:08 [Qemu-devel] [PATCH] main-loop: Fix SetEvent() on uninitialized handle on win32 Michael Roth
2012-01-21  7:49 ` Paolo Bonzini
2012-01-21 17:13 ` [Qemu-devel] [PATCH] main-loop: For tools, initialize timers as part of qemu_init_main_loop() Michael Roth
2012-01-21 20:39   ` Jamie Lokier
2012-01-22 12:32     ` Paolo Bonzini
2012-01-23  0:12       ` Michael Roth [this message]
2012-01-23  7:49         ` Paolo Bonzini
2012-01-27  5:46   ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
2012-01-27  8:09     ` Paolo Bonzini
2012-01-27  5:46   ` Stefan Hajnoczi
2012-02-01 22:10   ` [Qemu-devel] " Anthony Liguori
2012-01-27  5:41 ` [Qemu-devel] [Qemu-trivial] [PATCH] main-loop: Fix SetEvent() on uninitialized handle on win32 Stefan Hajnoczi
2012-01-27 14:52   ` [Qemu-devel] [PATCH v2] " Michael Roth
2012-02-01 22:10 ` [Qemu-devel] [PATCH] " Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F1CA602.2020103@linux.vnet.ibm.com \
    --to=mdroth@linux.vnet.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).