From patchwork Thu Mar 14 17:57:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 15354 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id CD03223E2C for ; Thu, 14 Mar 2013 17:57:17 +0000 (UTC) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by fiordland.canonical.com (Postfix) with ESMTP id 6D1D8A1814F for ; Thu, 14 Mar 2013 17:57:17 +0000 (UTC) Received: by mail-vc0-f177.google.com with SMTP id ia10so604694vcb.36 for ; Thu, 14 Mar 2013 10:57:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=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; bh=dfGGq0no8MBl4fkONl+TeyiMrRU6a0QuJVG2LGmyflU=; b=V6NhUJv5R4emzaPCaNIoUrbbMtIcmh4KNoBu00xP63USUyyKfSUhv6PPS/f0q/uwFV p2Aj7Bgy0MRr8zJkuKdE2XQqiBxtTh2u9s8EFJhtvpBew1QnQMqNZmhvdOzuLCNsR49y bv5/Q+wm6cmvMBPzJh73GEZ07wRYqlfzX5KvpxPmjGwP6H5sdNnY604c3ZLNUD42hDBN KN2mN066l71xSEO6Ybhe7H5+cwWIbZd788/qubmZ/KxMtQEbc+Zn4FGSloQVzCHZ5FFy xNKv2E+fKQ62I178elVylUVHHZWxSgPpY3xDFMm1Yzjv67Gi7hCPxgx4+sm8XoZ1XV0S qoHg== X-Received: by 10.58.84.164 with SMTP id a4mr3065172vez.9.1363283836892; Thu, 14 Mar 2013 10:57:16 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.127.98 with SMTP id nf2csp84425veb; Thu, 14 Mar 2013 10:57:15 -0700 (PDT) X-Received: by 10.205.120.15 with SMTP id fw15mr1849902bkc.108.1363283832500; Thu, 14 Mar 2013 10:57:12 -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 jd12si1284451bkc.247.2013.03.14.10.57.11 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 14 Mar 2013 10:57:12 -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; Authentication-Results: mx.google.com; spf=neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1UGCOs-0005uu-Fk; Thu, 14 Mar 2013 17:57:10 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Paolo Bonzini Subject: [PATCH v2 2/2] configure: Don't fall back to gthread coroutine backend Date: Thu, 14 Mar 2013 17:57:10 +0000 Message-Id: <1363283830-22717-3-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1363283830-22717-1-git-send-email-peter.maydell@linaro.org> References: <1363283830-22717-1-git-send-email-peter.maydell@linaro.org> X-Gm-Message-State: ALoCoQmFrmscrgPCevtM1Q9nyBYKo5g7RY6Fz2R7mFqZnkDGjEpw1Z2idquntLlKNvMQRtvSanCf 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 | 66 ++++++++++++++++++++++++++++++++++++-------------------- tests/Makefile | 14 +----------- 3 files changed, 45 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 c674d39..3f31719 100755 --- a/configure +++ b/configure @@ -3048,31 +3048,55 @@ 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=windows + 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 + ;; + 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 ########################################## @@ -3379,7 +3403,7 @@ echo "OpenGL support $opengl" 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" @@ -3709,11 +3733,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