From patchwork Thu Mar 14 15:25:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 15350 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 3FE4A23E10 for ; Thu, 14 Mar 2013 15:25:29 +0000 (UTC) Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.85.128.173]) by fiordland.canonical.com (Postfix) with ESMTP id CEF3FA18607 for ; Thu, 14 Mar 2013 15:25:28 +0000 (UTC) Received: by mail-ve0-f173.google.com with SMTP id oz10so1793851veb.18 for ; Thu, 14 Mar 2013 08:25:28 -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=T9+D/EUdGs97JIqOalbGsQdZhR8bDll81ESimXhoU3s=; b=h0BJWgSmciJiwqzEmgLdUhoJArZsYDKf4YbelcNrzpfjoDl4Tv9EHxVVPQgjcCagzs q7HeOtcwCoGPyvJV8KepV6dTVUoQwwW9FePX6OItYN6eM3nu0fx1Auvar0kOJtBjGDyk HoJqN5NfCMe7FHUtPyFd/b18Ytg/CKI7LYSFBCWWMORcaaukMmks2D1Tn17wPKuUJVLt TLM/C5FzEORIc2jpDdON37/JoZnnMsc6/feYOHzOexvu45hVD4kQNt+GYePjuvHvrvMH /B0NugT4xAjaoZvGYp1YE/Hv6RypLdCDWRwZumr0sAtEtACPw8xolEKjHUBzIJvbPuKa Bf0g== X-Received: by 10.52.177.163 with SMTP id cr3mr1876908vdc.94.1363274728355; Thu, 14 Mar 2013 08:25:28 -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 nf2csp77070veb; Thu, 14 Mar 2013 08:25:27 -0700 (PDT) X-Received: by 10.14.202.71 with SMTP id c47mr7718664eeo.39.1363274723795; Thu, 14 Mar 2013 08:25:23 -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 t8si5128811eeg.4.2013.03.14.08.25.22 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 14 Mar 2013 08:25:23 -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 1UGA1w-0005s0-5f; Thu, 14 Mar 2013 15:25:20 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Paolo Bonzini Subject: [PATCH 3/3] configure: Don't fall back to gthread coroutine backend Date: Thu, 14 Mar 2013 15:25:20 +0000 Message-Id: <1363274720-22535-4-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1363274720-22535-1-git-send-email-peter.maydell@linaro.org> References: <1363274720-22535-1-git-send-email-peter.maydell@linaro.org> X-Gm-Message-State: ALoCoQkRkDs7gDlANVlfWZbaAg27e4od1b1pX5NMizlBPPtQXIrdFAiLcYBPW1lmD0TlXtQeF0Fe 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 have to adjust the Makefile logic so it doesn't also encode an idea of the default backend. Signed-off-by: Peter Maydell --- Makefile.objs | 6 +++--- configure | 67 +++++++++++++++++++++++++++++++++++++-------------------- 2 files changed, 47 insertions(+), 26 deletions(-) diff --git a/Makefile.objs b/Makefile.objs index f99841c..7f541a4 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -18,12 +18,12 @@ 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 +endif ifeq ($(CONFIG_SIGALTSTACK_COROUTINE),y) block-obj-$(CONFIG_POSIX) += coroutine-sigaltstack.o -else -block-obj-$(CONFIG_POSIX) += coroutine-gthread.o endif +ifeq ($(CONFIG_GTHREAD_COROUTINE),y) +block-obj-$(CONFIG_POSIX) += coroutine-gthread.o endif block-obj-$(CONFIG_WIN32) += coroutine-win32.o diff --git a/configure b/configure index d9dfde0..9f7f5cd 100755 --- a/configure +++ b/configure @@ -3052,31 +3052,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 ########################################## @@ -3383,7 +3407,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" @@ -3713,11 +3737,8 @@ 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 +def="CONFIG_$(upper $coroutine)_COROUTINE" +echo "$def=y" >> $config_host_mak if test "$open_by_handle_at" = "yes" ; then echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak