From patchwork Mon Apr 8 11:11:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 15972 Return-Path: X-Original-To: linaro@staging.patches.linaro.org Delivered-To: linaro@staging.patches.linaro.org Received: from mail-qa0-f70.google.com (mail-qa0-f70.google.com [209.85.216.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CA24123900 for ; Mon, 8 Apr 2013 11:19:20 +0000 (UTC) Received: by mail-qa0-f70.google.com with SMTP id bs12sf4052653qab.1 for ; Mon, 08 Apr 2013 04:19:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-beenthere:x-received:received-spf :x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=u9VRlmRG/tQmcx/mGbUNnHXWLIeK1Pth2ka+h/brkT0=; b=E5nmgqsp3NSe2vIPbpzw5sdtzcnUv7Anx546i9Uxw2wqyOGdb/mGdcP45aB10H5lgX eWAk9C3zgVhkvmRiCFD10kNBqEiX0cJ+sOVG7+XxCFQJLci+LSRS2988wDnPgqpxBPSK ZzF6D56cjAZYWJgmkVFt56YuRiLc1Tc1zfWVsHe8QTYRd+elJ3z24780zTG13LtEWS+5 VOO05/laeT6ESlPbfCDsczi5vej/ODt++T5fl2RhNnwqhQ95AlstPQnJvZAH4uea4qU3 Kn3aNyhjJuYgPD/ubeDcPZu+Y9QPtZV0w4x7ywgCFXi56DmMMpMWVV5gj6+PJEXvJ+C2 PBPA== X-Received: by 10.236.148.211 with SMTP id v59mr10083936yhj.2.1365419946462; Mon, 08 Apr 2013 04:19:06 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.107.103 with SMTP id hb7ls3201709qeb.52.gmail; Mon, 08 Apr 2013 04:19:06 -0700 (PDT) X-Received: by 10.52.18.129 with SMTP id w1mr7583562vdd.31.1365419946344; Mon, 08 Apr 2013 04:19:06 -0700 (PDT) Received: from mail-vb0-x22b.google.com (mail-vb0-x22b.google.com [2607:f8b0:400c:c02::22b]) by mx.google.com with ESMTPS id se7si18091582vec.9.2013.04.08.04.19.06 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 08 Apr 2013 04:19:06 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::22b is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c02::22b; Received: by mail-vb0-f43.google.com with SMTP id q12so3656620vbe.2 for ; Mon, 08 Apr 2013 04:19:06 -0700 (PDT) X-Received: by 10.52.65.147 with SMTP id x19mr13277241vds.27.1365419946151; Mon, 08 Apr 2013 04:19:06 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.85.136 with SMTP id h8csp13976vez; Mon, 8 Apr 2013 04:19:05 -0700 (PDT) X-Received: by 10.14.207.200 with SMTP id n48mr35345519eeo.4.1365419491714; Mon, 08 Apr 2013 04:11:31 -0700 (PDT) Received: from mnementh.archaic.org.uk (1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.1.0.0.b.8.0.1.0.0.2.ip6.arpa. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id f3si30205948eev.171.2013.04.08.04.11.31 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 08 Apr 2013 04:11:31 -0700 (PDT) Received-SPF: neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1UP9yx-0005Aw-Hh; Mon, 08 Apr 2013 12:11:27 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Paolo Bonzini , Anthony Liguori , Stefan Hajnoczi Subject: [PATCH v3 2/2] configure: Don't fall back to gthread coroutine backend Date: Mon, 8 Apr 2013 12:11:27 +0100 Message-Id: <1365419487-19867-3-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1365419487-19867-1-git-send-email-peter.maydell@linaro.org> References: <1365419487-19867-1-git-send-email-peter.maydell@linaro.org> X-Gm-Message-State: ALoCoQmBtofY/syt7FKMKwdWe3dOU+Q4qllGkogm1welJQDJInnV7GFXC227uZJU1uCvfjwkNaQz X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::22b is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The gthread coroutine backend is broken and does not produce a working QEMU; it is only useful for some very limited debugging situations. Clean up the backend selection logic in configure so that it now runs "if on windows use windows; else prefer ucontext; else sigaltstack". To do this we refactor the configure code to separate out "test whether we have a working ucontext", "pick a default if user didn't specify" and "validate that user didn't specify something invalid", rather than having all three of these run together. We also simplify the Makefile logic so it just links in the backend the configure script selects. Signed-off-by: Peter Maydell --- Makefile.objs | 11 +-------- configure | 69 +++++++++++++++++++++++++++++++++++++------------------- tests/Makefile | 14 +----------- 3 files changed, 48 insertions(+), 46 deletions(-) diff --git a/Makefile.objs b/Makefile.objs index f99841c..e568c01 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -16,16 +16,7 @@ block-obj-y += qapi-types.o qapi-visit.o block-obj-y += qemu-coroutine.o qemu-coroutine-lock.o qemu-coroutine-io.o block-obj-y += qemu-coroutine-sleep.o -ifeq ($(CONFIG_UCONTEXT_COROUTINE),y) -block-obj-$(CONFIG_POSIX) += coroutine-ucontext.o -else -ifeq ($(CONFIG_SIGALTSTACK_COROUTINE),y) -block-obj-$(CONFIG_POSIX) += coroutine-sigaltstack.o -else -block-obj-$(CONFIG_POSIX) += coroutine-gthread.o -endif -endif -block-obj-$(CONFIG_WIN32) += coroutine-win32.o +block-obj-y += coroutine-$(CONFIG_COROUTINE_BACKEND).o ifeq ($(CONFIG_VIRTIO)$(CONFIG_VIRTFS)$(CONFIG_PCI),yyy) # Lots of the fsdev/9pcode is pulled in by vl.c via qemu_fsdev_add. diff --git a/configure b/configure index a097fde..3738de4 100755 --- a/configure +++ b/configure @@ -3071,31 +3071,58 @@ fi ########################################## # check and set a backend for coroutine -# default is ucontext, but always fallback to gthread -# windows autodetected by make -if test "$coroutine" = "" -o "$coroutine" = "ucontext"; then - if test "$darwin" != "yes"; then - cat > $TMPC << EOF +# We prefer ucontext, but it's not always possible. The fallback +# is sigcontext. gthread is not selectable except explicitly, because +# it is not functional enough to run QEMU proper. (It is occasionally +# useful for debugging purposes.) On Windows the only valid backend +# is the Windows-specific one. + +ucontext_works=no +if test "$darwin" != "yes"; then + cat > $TMPC << EOF #include #ifdef __stub_makecontext #error Ignoring glibc stub makecontext which will always fail #endif int main(void) { makecontext(0, 0, 0); return 0; } EOF - if compile_prog "" "" ; then - coroutine_backend=ucontext - else - coroutine_backend=gthread - fi + if compile_prog "" "" ; then + ucontext_works=yes + fi +fi + +if test "$coroutine" = ""; then + if test "$mingw32" = "yes"; then + coroutine=win32 + elif test "$ucontext_works" = "yes"; then + coroutine=ucontext + else + coroutine=sigaltstack fi -elif test "$coroutine" = "gthread" ; then - coroutine_backend=gthread -elif test "$coroutine" = "windows" ; then - coroutine_backend=windows -elif test "$coroutine" = "sigaltstack" ; then - coroutine_backend=sigaltstack else - error_exit "unknown coroutine backend $coroutine" + case $coroutine in + windows) + if test "$mingw32" != "yes"; then + error_exit "'windows' coroutine backend only valid for Windows" + fi + # Unfortunately the user visible backend name doesn't match the + # coroutine-*.c filename for this case, so we have to adjust it here. + coroutine=win32 + ;; + ucontext) + if test "$ucontext_works" != "yes"; then + feature_not_found "ucontext" + fi + ;; + gthread|sigaltstack) + if test "$mingw32" = "yes"; then + error_exit "only the 'windows' coroutine backend is valid for Windows" + fi + ;; + *) + error_exit "unknown coroutine backend $coroutine" + ;; + esac fi ########################################## @@ -3402,7 +3429,7 @@ echo "GLX support $glx" echo "libiscsi support $libiscsi" echo "build guest agent $guest_agent" echo "seccomp support $seccomp" -echo "coroutine backend $coroutine_backend" +echo "coroutine backend $coroutine" echo "GlusterFS support $glusterfs" echo "virtio-blk-data-plane $virtio_blk_data_plane" echo "gcov $gcov_tool" @@ -3735,11 +3762,7 @@ if test "$rbd" = "yes" ; then echo "CONFIG_RBD=y" >> $config_host_mak fi -if test "$coroutine_backend" = "ucontext" ; then - echo "CONFIG_UCONTEXT_COROUTINE=y" >> $config_host_mak -elif test "$coroutine_backend" = "sigaltstack" ; then - echo "CONFIG_SIGALTSTACK_COROUTINE=y" >> $config_host_mak -fi +echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak if test "$open_by_handle_at" = "yes" ; then echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak diff --git a/tests/Makefile b/tests/Makefile index 567e36e..7fa15c6 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -24,19 +24,7 @@ gcov-files-test-string-input-visitor-y = qapi/string-input-visitor.c check-unit-y += tests/test-string-output-visitor$(EXESUF) gcov-files-test-string-output-visitor-y = qapi/string-output-visitor.c check-unit-y += tests/test-coroutine$(EXESUF) -ifeq ($(CONFIG_WIN32),y) -gcov-files-test-coroutine-y = coroutine-win32.c -else -ifeq ($(CONFIG_UCONTEXT_COROUTINE),y) -gcov-files-test-coroutine-y = coroutine-ucontext.c -else -ifeq ($(CONFIG_SIGALTSTACK_COROUTINE),y) -gcov-files-test-coroutine-y = coroutine-sigaltstack.c -else -gcov-files-test-coroutine-y = coroutine-gthread.c -endif -endif -endif +gcov-files-test-coroutine-y = coroutine-$(CONFIG_COROUTINE_BACKEND).c check-unit-y += tests/test-visitor-serialization$(EXESUF) check-unit-y += tests/test-iov$(EXESUF) gcov-files-test-iov-y = util/iov.c