Received: from eggs.gnu.org ([2001:4830:134:3::10]:58577) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UvVP9-0006rE-Oh for qemu-devel@nongnu.org; Sat, 06 Jul 2013 12:32:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UvVP8-0000Gn-C8 for qemu-devel@nongnu.org; Sat, 06 Jul 2013 12:32:11 -0400 Received: from mail.avalus.com ([2001:41c8:10:1dd::10]:51911) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UvVP8-0000GX-4y for qemu-devel@nongnu.org; Sat, 06 Jul 2013 12:32:10 -0400 Date: Sat, 06 Jul 2013 17:31:56 +0100 From: Alex Bligh Message-ID: <725C99B3A63D6440AABF239F@nimrod.local> In-Reply-To: <1373127897-3445-1-git-send-email-alex@alex.org.uk> References: <1373127897-3445-1-git-send-email-alex@alex.org.uk> 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: qemu-devel@nongnu.org Cc: Kevin Wolf , Anthony Liguori , Stefan Hajnoczi , Alex Bligh , Paolo Bonzini , rth@twiddle.net --On 6 July 2013 17:24:57 +0100 Alex Bligh wrote: > 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). Any qemu > clock can be used, and times are specified in nanoseconds. For background, this patch resulted from a discussion with Kevin & Stefan on IRC as to the best way to use timers (or rather avoid using timers) in block drivers. There is one thing I'm not entirely sure about: > +void qemu_bh_schedule_at(QEMUBH *bh, QEMUClock *clock, int64_t time) > +{ > + /* Allow rescheduling if already scheduled */ > + bh->scheduled = 1; > + bh->idle = 0; > + bh->clock = clock; > + bh->time = time; > + aio_notify(bh->ctx); /*FIXME: is this right?*/ > +} qemu_bh_schedule calls aio_notify, but qemu_bh_schedule_idle does not. I am not quite sure why the latter doesn't - possibly through not fully understanding the aio system. Should qemu_bh_schedule_at be calling this, when I don't know whether the bh is scheduled for 1 nanosecond ahead or 1 second? -- Alex Bligh