qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC] [PATCHv2] aio / timers pt2: Replace main_loop_tlg


From: Stefan Hajnoczi
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
User-agent: Mutt/1.5.21 (2010-09-15)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]