From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60691) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V9EbH-0000RY-7o for qemu-devel@nongnu.org; Tue, 13 Aug 2013 09:25:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V9Eb9-00044C-K0 for qemu-devel@nongnu.org; Tue, 13 Aug 2013 09:25:26 -0400 Received: from goliath.siemens.de ([192.35.17.28]:30697) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V9Eb9-00043u-AE for qemu-devel@nongnu.org; Tue, 13 Aug 2013 09:25:19 -0400 Message-ID: <520A33B4.9030207@siemens.com> Date: Tue, 13 Aug 2013 15:25:08 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <1376239405-4084-1-git-send-email-alex@alex.org.uk> <520A2511.4000709@siemens.com> <307AE3B5-FAFE-4E9C-A336-092245809528@alex.org.uk> In-Reply-To: <307AE3B5-FAFE-4E9C-A336-092245809528@alex.org.uk> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC] [PATCHv10 00/31] aio / timers: Add AioContext timers and use ppoll List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alex Bligh Cc: Kevin Wolf , Anthony Liguori , qemu-devel@nongnu.org, liu ping fan , Stefan Hajnoczi , Paolo Bonzini , MORITA Kazutaka , rth@twiddle.net On 2013-08-13 15:12, Alex Bligh wrote: > > On 13 Aug 2013, at 13:22, Jan Kiszka wrote: > >> Another trick necessary to make this work is the following: >> >> static int rtc_aio_flush_true(EventNotifier *e) >> { >> return 1; >> } >> >> ... >> s->aio_ctx = aio_context_new(); >> aio_set_event_notifier(s->aio_ctx, &s->aio_ctx->notifier, >> (EventNotifierHandler *) >> event_notifier_test_and_clear, >> rtc_aio_flush_true); >> >> ie. enable blocking of aio_poll via the only i/o channel a timer thread >> has: the event notifier. > > > Personally I think this is a straightforward bug in aio_poll. I think > it should block if it has no fds to listen to until the next timer > occurs. People who call it with no fds and no timers deserve all they > get. But as you've just proved, this is useful (for instance when > another thread can add timers). > > I think stefanha disagrees this is a bug though :-) > To my understanding, the use case behind the current behavior is qemu_aio_wait() which is only supposed to block when there are pending requests for the main aio context. We should be able to address this scenarios also in a different way. I would definitely prefer to not depend on that hack above. Jan -- Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux