From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51840) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UyjiQ-0000wx-8R for qemu-devel@nongnu.org; Mon, 15 Jul 2013 10:25:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UyjiO-0008JN-2X for qemu-devel@nongnu.org; Mon, 15 Jul 2013 10:25:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:24445) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UyjiN-0008HW-OC for qemu-devel@nongnu.org; Mon, 15 Jul 2013 10:25:23 -0400 Message-ID: <51E4063D.6010308@redhat.com> Date: Mon, 15 Jul 2013 16:25:01 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1373127897-3445-1-git-send-email-alex@alex.org.uk> In-Reply-To: <1373127897-3445-1-git-send-email-alex@alex.org.uk> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] [RFC] aio/async: Add timed bottom-halves List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alex Bligh Cc: Kevin Wolf , Anthony Liguori , qemu-devel@nongnu.org, Stefan Hajnoczi , rth@twiddle.net Il 06/07/2013 18:24, Alex Bligh ha scritto: > Add timed bottom halves. A timed bottom half is a bottom half that > will not execute until a given time has passed (qemu_bh_schedule_at) > or a given interval has passed (qemu_bh_schedule_in). ... and may be delayed arbitrarily past that given interval if you are running in qemu-img or in other synchronous I/O APIs. I'm especially worried that this will not have any effect if bdrv_aio_cancel is calling qemu_aio_wait. bdrv_aio_cancel is presumably one place where you want timeout/reconnect functionality to trigger. I would really prefer to have a TimeEventNotifier or something like that, which is API-compatibile with EventNotifier (so you can use the regular aio-*.c APIs) but triggers when a given time has passed. Basically an "heavyweight" QEMUTimer; that would be a timerfd on Linux, and a queue timer on Windows. No idea on other POSIX systems, unfortunately. Even better would be to remove the whole timer stuff (POSIX timers, setitimer, and the Win32 equivalents), and just make the timers use a shorter timeout for the main loop. If you do this, I suspect adding timer support to AioContext would be much simpler. BTW, note that qemu-nbd (and qemu-io too) does call timers. Paolo > Any qemu > clock can be used, and times are specified in nanoseconds. > > Timed bottom halves can be used where timers cannot. For instance, > in block drivers where there is no mainloop that calls timers > (qemu-nbd, qemu-img), or where (per stefanha@redhat.com) the > aio code loops internally and thus timers never get called. > > Signed-off-by: Alex Bligh