qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Alex Bligh <alex@alex.org.uk>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Anthony Liguori <aliguori@us.ibm.com>,
	Stefan Hajnoczi <stefanha@gmail.com>,
	qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
	rth@twiddle.net
Subject: Re: [Qemu-devel] [PATCH] [RFC] aio/async: Add timed bottom-halves
Date: Fri, 19 Jul 2013 09:58:50 +0800	[thread overview]
Message-ID: <20130719015850.GA29671@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <51A6D731C894ECC429EA2171@nimrod.local>

On Thu, Jul 18, 2013 at 07:48:28PM +0100, Alex Bligh wrote:
> Stefan,
> 
> --On 17 July 2013 11:02:30 +0800 Stefan Hajnoczi <stefanha@gmail.com> wrote:
> 
> >The steps to achieving this:
> >
> >1. Drop alarm timers from qemu-timer.c and calculate g_poll() timeout
> >   instead for the main loop.
> >
> >2. Introduce a per-AioContext aio_ctx_clock that can be used with
> >   qemu_new_timer() to create a QEMUTimer that expires during
> >   aio_poll().
> >
> >3. Calculate g_poll() timeout for aio_ctx_clock in aio_poll().
> 
> I've pretty much written this.
> 
> Two issues:
> 
> 1. I very much enjoyed deleting all the alarm timers code. However, it was
>   doing something vaguely useful, which was calling qemu_notify_event
>   when the timer expired. Under the new regime above, if the AioContext
>   clock's timers expires within aio_poll, life is good as the timeout
>   to g_poll will expire. However, this won't apply if any of the other
>   three static clock's timers expire. Also, it won't work within the
>   mainloop poll. Also, we lose the ability to respond to timers in a sub
>   millisecond way.
> 
>   Options:
> 
>   a) restore alarm timers (at least for the time being). Make all
>      alarm timers do qemu_notify_event. However, only run the AioContext
>      clock's timers within aio_poll. This is the least intrusive change.
> 
>   b) calculate the timeout in aio_poll with respect to the minimum
>      deadline across all clocks, not just AioContext's clock. Use the
>      same logic in mainloop.
> 
>   I'd go for (b), except for the millisecond accuracy thing. So my
>   temptation (sadly) is (a).

I think this is a non-issue because host_alarm_handler() can only be
called from the main loop:

main-loop.c:qemu_signal_init() sets up signalfd to monitor SIGALRM.
Therefore we do not asynchronously invoke the SIGALRM signals handler.
It is only invoked from main-loop.c:sigfd_handler() when the main loop
runs.

That's how I read the code.  I haven't checked a running process to be
sure.

> 2. If we do delete alarm timers, I'll need to delete the -clock option.

I noticed this too because I think we should stub it out for
compatibility.  Accept existing options but ignore them, update
documentation to state that they are kept for compatibility.

Stefan

  reply	other threads:[~2013-07-19  1:59 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-06 16:24 [Qemu-devel] [PATCH] [RFC] aio/async: Add timed bottom-halves Alex Bligh
2013-07-06 16:31 ` Alex Bligh
2013-07-06 18:04   ` [Qemu-devel] [PATCHv2] " Alex Bligh
2013-07-15 14:25 ` [Qemu-devel] [PATCH] " Paolo Bonzini
2013-07-15 20:15   ` Alex Bligh
2013-07-15 20:53     ` Paolo Bonzini
2013-07-15 23:04       ` Alex Bligh
2013-07-16  6:16         ` Paolo Bonzini
2013-07-16  7:30           ` Alex Bligh
2013-07-16  7:34             ` Paolo Bonzini
2013-07-16 15:29               ` Alex Bligh
2013-07-16 15:43                 ` Paolo Bonzini
2013-07-16 16:14                   ` Alex Bligh
2013-07-16 16:55                     ` Paolo Bonzini
2013-07-16 21:22                       ` [Qemu-devel] [PATCHv3] " Alex Bligh
2013-07-16 21:24                       ` [Qemu-devel] [PATCH] " Alex Bligh
2013-07-17  3:02                         ` Stefan Hajnoczi
2013-07-17  8:07                           ` Alex Bligh
2013-07-17  8:11                             ` Paolo Bonzini
2013-07-17 16:09                               ` Alex Bligh
2013-07-18 18:48                           ` Alex Bligh
2013-07-19  1:58                             ` Stefan Hajnoczi [this message]
2013-07-19  6:22                               ` Paolo Bonzini
2013-07-19  6:38                               ` Alex Bligh
2013-07-19  6:51                                 ` Paolo Bonzini
2013-07-19 17:26                                   ` [Qemu-devel] [PATCH] [RFC] aio/timers: Drop alarm timers; introduce QEMUClock to AioContext; run timers in aio_poll Alex Bligh
2013-07-25  9:00                                     ` Stefan Hajnoczi
2013-07-25  9:02                                     ` Stefan Hajnoczi
2013-07-17  7:50                       ` [Qemu-devel] [PATCH] [RFC] aio/async: Add timed bottom-halves Kevin Wolf

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=20130719015850.GA29671@stefanha-thinkpad.redhat.com \
    --to=stefanha@redhat.com \
    --cc=alex@alex.org.uk \
    --cc=aliguori@us.ibm.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=stefanha@gmail.com \
    /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).