configure: Don't fall back to gthread coroutine backend

This is a back port of 7c2acc7062 to the
1.4 stable branch without needing the new error_exit() function.

configure: Don't fall back to gthread coroutine backend

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 <peter.maydell@linaro.org>
Message-id: 1365419487-19867-3-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Brad Smith <brad@comstyle.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
This commit is contained in:
Brad Smith 2013-04-14 02:24:06 -04:00 committed by Michael Roth
parent b90fd157f7
commit 0c70b5ad59
3 changed files with 57 additions and 49 deletions

View File

@ -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.o qemu-coroutine-lock.o qemu-coroutine-io.o
block-obj-y += qemu-coroutine-sleep.o block-obj-y += qemu-coroutine-sleep.o
ifeq ($(CONFIG_UCONTEXT_COROUTINE),y) block-obj-y += coroutine-$(CONFIG_COROUTINE_BACKEND).o
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
ifeq ($(CONFIG_VIRTIO)$(CONFIG_VIRTFS)$(CONFIG_PCI),yyy) ifeq ($(CONFIG_VIRTIO)$(CONFIG_VIRTFS)$(CONFIG_PCI),yyy)
# Lots of the fsdev/9pcode is pulled in by vl.c via qemu_fsdev_add. # Lots of the fsdev/9pcode is pulled in by vl.c via qemu_fsdev_add.

81
configure vendored
View File

@ -3036,34 +3036,67 @@ fi
########################################## ##########################################
# check and set a backend for coroutine # check and set a backend for coroutine
# default is ucontext, but always fallback to gthread # We prefer ucontext, but it's not always possible. The fallback
# windows autodetected by make # is sigcontext. gthread is not selectable except explicitly, because
if test "$coroutine" = "" -o "$coroutine" = "ucontext"; then # it is not functional enough to run QEMU proper. (It is occasionally
if test "$darwin" != "yes"; then # useful for debugging purposes.) On Windows the only valid backend
cat > $TMPC << EOF # is the Windows-specific one.
ucontext_works=no
if test "$darwin" != "yes"; then
cat > $TMPC << EOF
#include <ucontext.h> #include <ucontext.h>
#ifdef __stub_makecontext #ifdef __stub_makecontext
#error Ignoring glibc stub makecontext which will always fail #error Ignoring glibc stub makecontext which will always fail
#endif #endif
int main(void) { makecontext(0, 0, 0); return 0; } int main(void) { makecontext(0, 0, 0); return 0; }
EOF EOF
if compile_prog "" "" ; then if compile_prog "" "" ; then
coroutine_backend=ucontext ucontext_works=yes
else fi
coroutine_backend=gthread 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 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 else
echo case $coroutine in
echo "Error: unknown coroutine backend $coroutine" windows)
echo if test "$mingw32" != "yes"; then
exit 1 echo
echo "Error: 'windows' coroutine backend only valid for Windows"
echo
exit 1
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
echo
echo "Error: only the 'windows' coroutine backend is valid for Windows"
echo
exit 1
fi
;;
*)
echo
echo "Error: unknown coroutine backend $coroutine"
echo
exit 1
;;
esac
fi fi
########################################## ##########################################
@ -3346,7 +3379,7 @@ echo "OpenGL support $opengl"
echo "libiscsi support $libiscsi" echo "libiscsi support $libiscsi"
echo "build guest agent $guest_agent" echo "build guest agent $guest_agent"
echo "seccomp support $seccomp" echo "seccomp support $seccomp"
echo "coroutine backend $coroutine_backend" echo "coroutine backend $coroutine"
echo "GlusterFS support $glusterfs" echo "GlusterFS support $glusterfs"
echo "virtio-blk-data-plane $virtio_blk_data_plane" echo "virtio-blk-data-plane $virtio_blk_data_plane"
echo "gcov $gcov_tool" echo "gcov $gcov_tool"
@ -3669,11 +3702,7 @@ if test "$rbd" = "yes" ; then
echo "CONFIG_RBD=y" >> $config_host_mak echo "CONFIG_RBD=y" >> $config_host_mak
fi fi
if test "$coroutine_backend" = "ucontext" ; then echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak
echo "CONFIG_UCONTEXT_COROUTINE=y" >> $config_host_mak
elif test "$coroutine_backend" = "sigaltstack" ; then
echo "CONFIG_SIGALTSTACK_COROUTINE=y" >> $config_host_mak
fi
if test "$open_by_handle_at" = "yes" ; then if test "$open_by_handle_at" = "yes" ; then
echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak

View File

@ -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) check-unit-y += tests/test-string-output-visitor$(EXESUF)
gcov-files-test-string-output-visitor-y = qapi/string-output-visitor.c gcov-files-test-string-output-visitor-y = qapi/string-output-visitor.c
check-unit-y += tests/test-coroutine$(EXESUF) check-unit-y += tests/test-coroutine$(EXESUF)
ifeq ($(CONFIG_WIN32),y) gcov-files-test-coroutine-y = coroutine-$(CONFIG_COROUTINE_BACKEND).c
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
check-unit-y += tests/test-visitor-serialization$(EXESUF) check-unit-y += tests/test-visitor-serialization$(EXESUF)
check-unit-y += tests/test-iov$(EXESUF) check-unit-y += tests/test-iov$(EXESUF)
gcov-files-test-iov-y = util/iov.c gcov-files-test-iov-y = util/iov.c