From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57412) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V7JWd-0003gR-G4 for qemu-devel@nongnu.org; Thu, 08 Aug 2013 02:16:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V7JWa-0005dc-S0 for qemu-devel@nongnu.org; Thu, 08 Aug 2013 02:16:43 -0400 Received: from wanbli.kerneis.info ([2001:41d0:8:38ad::1]:51320) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V7JWa-0005dW-JD for qemu-devel@nongnu.org; Thu, 08 Aug 2013 02:16:40 -0400 Date: Thu, 8 Aug 2013 07:16:19 +0100 From: Gabriel Kerneis Message-ID: <20130808061619.GA4736@kerneis.info> References: <1375728247-1306-1-git-send-email-charlie@ctshepherd.com> <1375728247-1306-3-git-send-email-charlie@ctshepherd.com> <20130807191805.GA16226@stefanha-thinkpad.hitronhub.home> <20130807221336.GA4393@kerneis.info> <5202F483.9020109@ctshepherd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5202F483.9020109@ctshepherd.com> Subject: Re: [Qemu-devel] [PATCH 2/5] qemu_coroutine_self should not be marked coroutine_fn as it cannot yield List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Charlie Shepherd Cc: kwolf@redhat.com, Stefan Hajnoczi , qemu-devel@nongnu.org, pbonzini@redhat.com On Thu, Aug 08, 2013 at 02:29:39AM +0100, Charlie Shepherd wrote: > On 07/08/2013 23:13, Gabriel Kerneis wrote: > >On Wed, Aug 07, 2013 at 09:18:05PM +0200, Stefan Hajnoczi wrote: > >>I guess the practical problem is that CPC will get > >>upset that it's being called by the coroutine implementation from > >>non-coroutine contexts. > >But is it really the case? If Charlie added an annotation, it probably means > >that in practice it was only called from coroutine context anyway. > > It was also called from coroutine implementation in functions that > weren't annotated coroutine_fn (qemu_coroutine_switch() and > friends). In that case, the interface/implementation split suggested by Stefan makes sense. Note that qemu_coroutine_self() in principle really needs to be annotated coroutine_fn since it accesses (and returns) its execution context. The fact that it is implemented with thread-local variables in Qemu is an implementation detail, almost a hack (however smart); the "natural" CPC way would be to just return the coroutine associated with the current continuation. So keeping the annotation definitely makes sense. -- Gabriel