qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Alex Bligh <alex@alex.org.uk>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Anthony Liguori <aliguori@us.ibm.com>,
	Jan Kiszka <jan.kiszka@siemens.com>,
	qemu-devel@nongnu.org, liu ping fan <qemulist@gmail.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>,
	rth@twiddle.net
Subject: Re: [Qemu-devel] [RFC] [PATCHv2] aio / timers pt2: Replace main_loop_tlg with qemu_dummy_timer_ctx
Date: Thu, 15 Aug 2013 14:16:52 +0200	[thread overview]
Message-ID: <20130815121652.GA32262@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <1376133687-32457-1-git-send-email-alex@alex.org.uk>

On Sat, Aug 10, 2013 at 12:21:27PM +0100, Alex Bligh wrote:
> Currently we use a separate timer list group (main_loop_tlg)
> for the main loop. This patch replaces this with a dummy AioContext
> used just for timers in the main loop.

Things get interesting when we make main loop qemu_set_fd_handler() and
timers just use AioContext.

Basically, we are distilling out the main-loop.c stuff which is a
low-level glib-style event loop from the AioContext fd handlers, timers,
and BHs.  This is a good step in that direction.

I'm in favor of this although it current really is still a bit of a
hack.

> @@ -486,6 +499,20 @@ void init_clocks(void)
>          qemu_clock_init(type);
>      }
>  
> +    /* Make a dummy context for timers in the main loop.
> +     * 
> +     * This context should not call the AioContext's
> +     * supplied notifier function (which calls
> +     * aio_notify) as it needs to call qemu_notify()
> +     * instead, as there's nothing actually using the
> +     * AioContext. This is a bit of a hack.
> +     */
> +    qemu_dummy_timer_ctx = aio_context_new();
> +    for (type = 0; type < QEMU_CLOCK_MAX; type++) {
> +        qemu_dummy_timer_ctx->tlg[type]->notify_cb = NULL;
> +        qemu_dummy_timer_ctx->tlg[type]->notify_opaque = NULL;
> +    }
> +

IIRC your previous patch series has something like:

if (timer_list->notify_cb == NULL) {
    qemu_notify_event();
} else {
    timer_list->notify_cb(timer_list->notify_opaque);
}

So this should work.

  reply	other threads:[~2013-08-15 12:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-10 11:21 [Qemu-devel] [RFC] [PATCHv2] aio / timers pt2: Replace main_loop_tlg with qemu_dummy_timer_ctx Alex Bligh
2013-08-15 12:16 ` Stefan Hajnoczi [this message]
2013-08-15 12:39   ` Alex Bligh
2013-08-19 10:16 ` Paolo Bonzini

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=20130815121652.GA32262@stefanha-thinkpad.redhat.com \
    --to=stefanha@gmail.com \
    --cc=alex@alex.org.uk \
    --cc=aliguori@us.ibm.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kwolf@redhat.com \
    --cc=morita.kazutaka@lab.ntt.co.jp \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemulist@gmail.com \
    --cc=rth@twiddle.net \
    --cc=stefanha@redhat.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).