From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51275) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V9wUD-0000bC-Bt for qemu-devel@nongnu.org; Thu, 15 Aug 2013 08:17:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V9wU4-0000Te-PC for qemu-devel@nongnu.org; Thu, 15 Aug 2013 08:17:05 -0400 Received: from mail-ee0-x229.google.com ([2a00:1450:4013:c00::229]:51938) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V9wU4-0000TT-J9 for qemu-devel@nongnu.org; Thu, 15 Aug 2013 08:16:56 -0400 Received: by mail-ee0-f41.google.com with SMTP id d17so332289eek.0 for ; Thu, 15 Aug 2013 05:16:55 -0700 (PDT) Date: Thu, 15 Aug 2013 14:16:52 +0200 From: Stefan Hajnoczi Message-ID: <20130815121652.GA32262@stefanha-thinkpad.redhat.com> References: <1376133687-32457-1-git-send-email-alex@alex.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1376133687-32457-1-git-send-email-alex@alex.org.uk> Subject: Re: [Qemu-devel] [RFC] [PATCHv2] aio / timers pt2: Replace main_loop_tlg with qemu_dummy_timer_ctx List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alex Bligh Cc: Kevin Wolf , Anthony Liguori , Jan Kiszka , qemu-devel@nongnu.org, liu ping fan , Stefan Hajnoczi , Paolo Bonzini , MORITA Kazutaka , rth@twiddle.net 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.