Received: from eggs.gnu.org ([2001:4830:134:3::10]:37744) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UztFr-0006aE-U1 for qemu-devel@nongnu.org; Thu, 18 Jul 2013 14:48:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UztFr-00026a-56 for qemu-devel@nongnu.org; Thu, 18 Jul 2013 14:48:43 -0400 Received: from mail.avalus.com ([2001:41c8:10:1dd::10]:53496) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UztFq-00026K-W9 for qemu-devel@nongnu.org; Thu, 18 Jul 2013 14:48:43 -0400 Date: Thu, 18 Jul 2013 19:48:28 +0100 From: Alex Bligh Message-ID: <51A6D731C894ECC429EA2171@nimrod.local> In-Reply-To: <20130717030230.GA27807@stefanha-thinkpad.redhat.com> References: <51E4613D.9000106@redhat.com> <44590808AF4A6E7DC093637A@nimrod.local> <51E4E54A.10908@redhat.com> <51E4F77C.2090509@redhat.com> <794E19D97CCC267CCBFA8397@Ximines.local> <51E56A1A.50502@redhat.com> <19631228D7B62545DC6A2928@Ximines.local> <51E57AF3.1050409@redhat.com> <20130717030230.GA27807@stefanha-thinkpad.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Subject: Re: [Qemu-devel] [PATCH] [RFC] aio/async: Add timed bottom-halves Reply-To: Alex Bligh List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , Anthony Liguori , Alex Bligh , qemu-devel@nongnu.org, Stefan Hajnoczi , Paolo Bonzini , rth@twiddle.net Stefan, --On 17 July 2013 11:02:30 +0800 Stefan Hajnoczi 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). 2. If we do delete alarm timers, I'll need to delete the -clock option. WDYT? -- Alex Bligh