From patchwork Sat Jun 25 17:03:44 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 102034 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 55D80B6F85 for ; Sun, 26 Jun 2011 03:05:57 +1000 (EST) Received: from localhost ([::1]:42582 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QaWIr-0002fo-7l for incoming@patchwork.ozlabs.org; Sat, 25 Jun 2011 13:05:53 -0400 Received: from eggs.gnu.org ([140.186.70.92]:54858) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QaWGr-0002fY-51 for qemu-devel@nongnu.org; Sat, 25 Jun 2011 13:03:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QaWGq-0002bI-0f for qemu-devel@nongnu.org; Sat, 25 Jun 2011 13:03:49 -0400 Received: from fmmailgate02.web.de ([217.72.192.227]:47402) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QaWGp-0002bC-L4 for qemu-devel@nongnu.org; Sat, 25 Jun 2011 13:03:47 -0400 Received: from smtp04.web.de ( [172.20.0.225]) by fmmailgate02.web.de (Postfix) with ESMTP id D1E601A3BCDFB; Sat, 25 Jun 2011 19:03:45 +0200 (CEST) Received: from [87.173.97.145] (helo=[10.0.1.1]) by smtp04.web.de with asmtp (TLSv1:AES128-SHA:128) (WEB.DE 4.110 #2) id 1QaWGn-0007xz-00; Sat, 25 Jun 2011 19:03:45 +0200 Message-Id: <9E69633B-6D95-430E-AA01-170CE26834FF@web.de> From: =?ISO-8859-1?Q?Andreas_F=E4rber?= To: Stefan Hajnoczi In-Reply-To: <1307911585-22106-4-git-send-email-stefanha@linux.vnet.ibm.com> Mime-Version: 1.0 (Apple Message framework v936) Date: Sat, 25 Jun 2011 19:03:44 +0200 References: <1307911585-22106-1-git-send-email-stefanha@linux.vnet.ibm.com> <1307911585-22106-4-git-send-email-stefanha@linux.vnet.ibm.com> X-Mailer: Apple Mail (2.936) X-Sender: Andreas.Faerber@web.de X-Provags-ID: V01U2FsdGVkX19eT0ffX+GqLyWWkYx6EI+q6gZSP7BjEWwbYmIY LILHP0UDhzHZJwgiRBqa+TySTcJZKtPvbcyT7u+HcfaQoojpP6 RXLC+91Uck1Ftf8rS2jA== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-Received-From: 217.72.192.227 Cc: Kevin Wolf , Anthony Liguori , Alexandre Raymond , qemu-devel Developers , Blue Swirl , "Aneesh Kumar K.V" , Alexander Graf , Paolo Bonzini , Venkateswararao Jujjuri Subject: Re: [Qemu-devel] [PATCH v5 3/5] coroutine: implement coroutines using gthread X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Am 12.06.2011 um 22:46 schrieb Stefan Hajnoczi: > From: "Aneesh Kumar K.V" > > On platforms that don't support makecontext(3) use gthread based > coroutine implementation. > > [Original patch by Aneesh, made consistent with coroutine-ucontext.c > and > switched to GStaticPrivate by Stefan. Tested on Linux and OpenBSD.] > > Signed-off-by: Aneesh Kumar K.V > Signed-off-by: Stefan Hajnoczi > --- > Makefile.objs | 4 ++ > configure | 16 ++++++ > coroutine-gthread.c | 131 ++++++++++++++++++++++++++++++++++++++++++ > +++++++++ > 3 files changed, 151 insertions(+), 0 deletions(-) > create mode 100644 coroutine-gthread.c > diff --git a/configure b/configure > index 3697eba..df63403 100755 > --- a/configure > +++ b/configure > @@ -2552,6 +2552,18 @@ if test "$trace_backend" = "dtrace"; then > fi > > ########################################## > +# check if we have makecontext > + > +ucontext_coroutine=no > +cat > $TMPC << EOF > +#include > +int main(void) { makecontext(0, 0, 0); } > +EOF > +if compile_prog "" "" ; then > + ucontext_coroutine=yes > +fi > + > +########################################## > # End of CC checks > # After here, no more $cc or $ld runs > This add-on patch inserts a check for Darwin to force ucontext_coroutine=no there (getcontext() returns -1, with errno == ENOTSUP): This fixes Darwin/ppc64 (and ppc) v10.5. Don't know whether v10.6 / i386 might have a working implementation (cc'ing Alexand{re,er}). Andreas > @@ -3015,6 +3027,10 @@ if test "$rbd" = "yes" ; then > echo "CONFIG_RBD=y" >> $config_host_mak > fi > > +if test "$ucontext_coroutine" = "yes" ; then > + echo "CONFIG_UCONTEXT_COROUTINE=y" >> $config_host_mak > +fi > + > # USB host support > case "$usb" in > linux) diff --git a/configure b/configure index c28ed7b..854f24a 100755 --- a/configure +++ b/configure @@ -2479,12 +2479,14 @@ fi # check if we have makecontext ucontext_coroutine=no -cat > $TMPC << EOF +if test "$darwin" != "yes"; then + cat > $TMPC << EOF #include int main(void) { makecontext(0, 0, 0); } EOF -if compile_prog "" "" ; then - ucontext_coroutine=yes + if compile_prog "" "" ; then + ucontext_coroutine=yes + fi fi ##########################################