All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Peter Portante <peter.a.portante@gmail.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] qemu-clock: add an alarm timer based on timerfd
Date: Wed, 19 Sep 2012 16:27:32 +0200	[thread overview]
Message-ID: <5059D654.6080206@siemens.com> (raw)
In-Reply-To: <CAPzLFkV3GjkkccoHgd1+XETBP2Wu0Y8Ashn+wJHycXGnyt9DZw@mail.gmail.com>

Please turn of HTML in you mailer. It's very hard to parse your reply.

On 2012-09-19 16:15, Peter Portante wrote:
> On Wed, Sep 19, 2012 at 3:44 AM, Jan Kiszka <jan.kiszka@siemens.com<mailto:jan.kiszka@siemens.com>> wrote:
> 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<mailto:pbonzini@redhat.com>>
>>> Cc: Jan Kiszka <jan.kiszka@siemens.com<mailto:jan.kiszka@siemens.com>>
>>> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com<mailto: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 am not sure the comparison is timerfd v. select, but timerfd v signal based timer (setitimer). The timerfd path allows you to integrate with select/poll/epoll loops, where as signal based timers make that more difficult. One can do the same thing with signalfd, but only for one signal, where as you can setup multiple timers at the expense of file descriptors.
> 
> Additionally, FWIW, select() has a resolution capped by its use of struct timeval, which is microseconds, where timerfd_settime allows for nanosecond resolution.

< 1µs resolution is pointless, even on RT-hardened kernels with fast
hardware underneath and when running natively.

> 
> 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.
> 
> With timerfd, signalfd and eventfd, Linux seems to have provided all the coverage needed to make that happen.

The advantage is that timers based on select/poll timeouts will allow to
unify a lot of code for _all_ host platforms, i.e. even Windows. We
still need to evaluate the precise impact and look for potentially
missed limitations (aka: someone has to write patches and test them).
But if there are no relevant ones, it should be the better architecture.

That said, a timerfd based solution for Linux may be an intermediate
step of the select-based work takes longer.

Jan

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

  reply	other threads:[~2012-09-19 14:27 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
2012-09-19  8:39     ` Paolo Bonzini
2012-09-19 14:15     ` Peter Portante
2012-09-19 14:27       ` Jan Kiszka [this message]
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=5059D654.6080206@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=peter.a.portante@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.