From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45981) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VC4Ie-0007KF-60 for qemu-devel@nongnu.org; Wed, 21 Aug 2013 05:02:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VC4IU-0006k6-Ko for qemu-devel@nongnu.org; Wed, 21 Aug 2013 05:01:56 -0400 Received: from mail-we0-x22c.google.com ([2a00:1450:400c:c03::22c]:35761) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VC4IU-0006jd-G3 for qemu-devel@nongnu.org; Wed, 21 Aug 2013 05:01:46 -0400 Received: by mail-we0-f172.google.com with SMTP id t60so148995wes.17 for ; Wed, 21 Aug 2013 02:01:45 -0700 (PDT) Date: Wed, 21 Aug 2013 11:01:42 +0200 From: Stefan Hajnoczi Message-ID: <20130821090142.GC10379@stefanha-thinkpad.redhat.com> References: <1376598879-18976-1-git-send-email-alex@alex.org.uk> <1376598879-18976-14-git-send-email-alex@alex.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1376598879-18976-14-git-send-email-alex@alex.org.uk> Subject: Re: [Qemu-devel] [PATCHv11 13/31] aio / timers: aio_ctx_prepare sets timeout from AioContext timers 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 Thu, Aug 15, 2013 at 09:34:21PM +0100, Alex Bligh wrote: > @@ -150,13 +150,14 @@ aio_ctx_prepare(GSource *source, gint *timeout) > { > AioContext *ctx = (AioContext *) source; > QEMUBH *bh; > + int deadline; > > for (bh = ctx->first_bh; bh; bh = bh->next) { > if (!bh->deleted && bh->scheduled) { > if (bh->idle) { > /* idle bottom halves will be polled at least > * every 10ms */ > - *timeout = 10; > + *timeout = qemu_soonest_timeout(*timeout, 10); > } else { > /* non-idle bottom halves will be executed > * immediately */ I agree with Wenchao: The docs explicitly say that .prepare() can set timeout to the maximum timeout value that is required. It then explains that the "actual timeout used" is the minimum of all timeout values - it's not our job to calculate the minimum, glib will do that after calling all .prepare() functions. I would drop this hunk. Stefan