From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36647) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V8m0t-00011k-EU for qemu-devel@nongnu.org; Mon, 12 Aug 2013 02:54:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V8m0l-000722-GB for qemu-devel@nongnu.org; Mon, 12 Aug 2013 02:53:59 -0400 Received: from e23smtp09.au.ibm.com ([202.81.31.142]:53896) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V8m0k-00071q-Tg for qemu-devel@nongnu.org; Mon, 12 Aug 2013 02:53:51 -0400 Received: from /spool/local by e23smtp09.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 13 Aug 2013 03:48:23 +1000 Received: from d23relay05.au.ibm.com (d23relay05.au.ibm.com [9.190.235.152]) by d23dlp02.au.ibm.com (Postfix) with ESMTP id 6C9F42BB0051 for ; Mon, 12 Aug 2013 16:53:39 +1000 (EST) Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.235.139]) by d23relay05.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r7C6bbS811010530 for ; Mon, 12 Aug 2013 16:37:43 +1000 Received: from d23av04.au.ibm.com (loopback [127.0.0.1]) by d23av04.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r7C6rV6R002560 for ; Mon, 12 Aug 2013 16:53:32 +1000 Message-ID: <52088652.3010201@linux.vnet.ibm.com> Date: Mon, 12 Aug 2013 14:53:06 +0800 From: Wenchao Xia MIME-Version: 1.0 References: <1375998147-24292-1-git-send-email-alex@alex.org.uk> <1375998147-24292-10-git-send-email-alex@alex.org.uk> <5204BE51.70006@redhat.com> <66F49369-34D8-4F02-87B7-946095072EBD@alex.org.uk> <5204FE33.1060306@redhat.com> <520503D2.1020006@redhat.com> <12227494-C6D2-467E-B7B3-6765F78EEB44@alex.org.uk> In-Reply-To: <12227494-C6D2-467E-B7B3-6765F78EEB44@alex.org.uk> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [RFC] [PATCHv8 09/30] aio / timers: Add QEMUTimerListGroup and helper functions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alex Bligh Cc: Kevin Wolf , Anthony Liguori , liu ping fan , qemu-devel@nongnu.org, Stefan Hajnoczi , Paolo Bonzini , MORITA Kazutaka , rth@twiddle.net 于 2013-8-10 19:05, Alex Bligh 写道: > Paolo, > > On 9 Aug 2013, at 15:59, Paolo Bonzini wrote: > >> It's not papering over anything. >> >> Timers right now are provided by the event loop. If you make >> AioContexts have timers, you can have a new AioContext for the timers >> that the event loop handles before your patches. >> >> It's not related to having two nested event loops. The nested event >> loops have the problem that timers do not run in them, but it's also a >> feature---because you know exactly what code runs in the nested event >> loop and what doesn't. Using an entirely distinct event loop preserves >> the feature. > > I've submitted a first cut as a separate patch just to see whether > it works: > http://lists.nongnu.org/archive/html/qemu-devel/2013-08/msg01412.html > > It passes 'make check' anyway. > > I didn't wrap TimerListGroup into a separate struct for reasons > I'll set out below. > > I think there are two ways to go here: > > 1. Wrap TimerListGroup into a separate struct, leave all the > TimerListGroup functions in. This probably makes it easier if > (for instance) we decided to get rid of AioContexts entirely > and make them g_source subclasses (per Wenchao Xia). > I have a quick view of this series, but not very carefully since it is quite long.:) I have replied with Paolo's comments on my RFC thread. Personally I like g_source sub class, which make code clear, but let's discuss first if the direction is right in that mail. > 2. Remove the TimerListGroup thing entirely and just have > an array of TimerLists of size QEMU_CLOCK_MAX. I can > leave the things that iterate that array inside qemu_timer.c > (which I'd rather do for encapsulation). Part of the > problem with the old timer code was that there were (in > my opinion) far too many files that were working out what > to iterate, and I really don't want to reintroduce that. > > Despite the fact we both dislike the name TimerListGroup, I > think the way to go here is (1). (2) does not really save lines > of code (certainly not compiled instructions) - it's main saving > is removing a pile of commenting from include/qemu/timer.h, > which makes things more opaque. > > I also think there may well be a use for something that wants > to use timers but not AioContext (I am thinking for instance > of a thread that does not do block IO). This permits that, > but does not require it. > > WDYT? > -- Best Regards Wenchao Xia