qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Stefan Weil <weil@mail.berlios.de>,
	Anthony Liguori <aliguori@us.ibm.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	Peter Portante <pportant@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] qemu-clock: add an alarm timer based on timerfd
Date: Wed, 19 Sep 2012 09:44:13 +0200	[thread overview]
Message-ID: <505977CD.7000404@siemens.com> (raw)
In-Reply-To: <5059738E.5070004@redhat.com>

On 2012-09-19 09:26, Paolo Bonzini wrote:
> Il 18/09/2012 22:37, Anthony Liguori ha scritto:
>> Unfortunately, there's a lot of Windows code in qemu-timer.c and main-loop.c
>> right now otherwise the refactoring would be trivial.  I'll leave that for
>> another day.
>>
>> Cc: Paolo Bonzini <pbonzini@redhat.com>
>> Cc: Jan Kiszka <jan.kiszka@siemens.com>
>> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
>> ---
>> Please note, this is lightly tested.  Since this is such a fundamental change,
>> I'd like to do some performance analysis before committing but wanted to share
>> early.
> 
> Looks good.  I think Peter Portante tested something similar, and found no big
> difference between the two.  But it's a good thing and, in my opinion, for
> non-timerfd OSes we should simply adjust the select() timeout and not bother
> with signals.

What would be the advantage of timerfd over select? On Linux, both use
hrtimers (and low slack for RT processes). I'm starting to like the
select/WaitForMultipleObjects pattern as it would allow to consolidate
over basically two versions of timers and simplify the code.

Jan

> 
> I'm not sure if the same can be done for Windows, but I think it's possible as long
> as you keep the timeBeginPeriod/timeEndPeriod calls.  As a start, Stefan, can you
> check if the win32 timer works for you with the calls added?  Like this:
> 
> diff --git a/qemu-timer.c b/qemu-timer.c
> index c7a1551..721c769 100644
> --- a/qemu-timer.c
> +++ b/qemu-timer.c
> @@ -673,6 +673,10 @@ static int win32_start_timer(struct qemu_alarm_timer *t)
>      HANDLE hTimer;
>      BOOLEAN success;
>  
> +    timeGetDevCaps(&mm_tc, sizeof(mm_tc));
> +
> +    timeBeginPeriod(mm_tc.wPeriodMin);
> +
>      /* If you call ChangeTimerQueueTimer on a one-shot timer (its period
>         is zero) that has already expired, the timer is not updated.  Since
>         creating a new timer is relatively expensive, set a bogus one-hour
> @@ -688,6 +692,7 @@ static int win32_start_timer(struct qemu_alarm_timer *t)
>      if (!success) {
>          fprintf(stderr, "Failed to initialize win32 alarm timer: %ld\n",
>                  GetLastError());
> +        timeEndPeriod(mm_tc.wPeriodMin);
>          return -1;
>      }
>  
> @@ -702,6 +707,7 @@ static void win32_stop_timer(struct qemu_alarm_timer *t)
>      if (hTimer) {
>          DeleteTimerQueueTimer(NULL, hTimer, NULL);
>      }
> +    timeEndPeriod(mm_tc.wPeriodMin);
>  }
>  
>  static void win32_rearm_timer(struct qemu_alarm_timer *t,
> 
> Paolo
> 

-- 
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux

  reply	other threads:[~2012-09-19  7:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-18 20:37 [Qemu-devel] [PATCH] qemu-clock: add an alarm timer based on timerfd Anthony Liguori
2012-09-19  7:26 ` Paolo Bonzini
2012-09-19  7:44   ` Jan Kiszka [this message]
2012-09-19  8:39     ` Paolo Bonzini
2012-09-19 14:15     ` Peter Portante
2012-09-19 14:27       ` Jan Kiszka
2012-09-20  5:51         ` Peter Portante
2012-09-19 16:55     ` Avi Kivity
2012-09-19 17:13     ` Alon Ziv
2012-09-20  2:54     ` Anthony Liguori
2012-09-19 16:04   ` Stefan Weil
2012-09-19 16:12     ` Paolo Bonzini
2012-09-19 16:22       ` Stefan Weil
2012-09-19 14:20 ` Peter Portante

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=505977CD.7000404@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=aliguori@us.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=pportant@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=weil@mail.berlios.de \
    /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).