From patchwork Mon Feb 13 14:42:30 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Barcelo X-Patchwork-Id: 140913 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 C368BB6FB4 for ; Tue, 14 Feb 2012 01:43:32 +1100 (EST) Received: from localhost ([::1]:39085 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rwx7p-0001WD-W3 for incoming@patchwork.ozlabs.org; Mon, 13 Feb 2012 09:43:30 -0500 Received: from eggs.gnu.org ([140.186.70.92]:37591) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rwx7U-00018I-OA for qemu-devel@nongnu.org; Mon, 13 Feb 2012 09:43:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rwx7O-0004sO-BA for qemu-devel@nongnu.org; Mon, 13 Feb 2012 09:43:08 -0500 Received: from mail-ey0-f173.google.com ([209.85.215.173]:63232) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rwx7O-0004pN-5E for qemu-devel@nongnu.org; Mon, 13 Feb 2012 09:43:02 -0500 Received: by mail-ey0-f173.google.com with SMTP id c1so1872769eaa.4 for ; Mon, 13 Feb 2012 06:43:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=xHwOCHkshMShPq0JB4gpIwJhFYnS4csk4SH1yD+WLF0=; b=ufpXFxARycBg47cKvmIe+r9AGrjM94+j88h/F4i0a4g7tgkbXFxxb6lHICPvt1iExf +ExhLazCswr17JaPY6ii/yFjsLEgbdTOfIJpwp3kfUxmSWN1PbArLlMEnTlUONs/pM5c YHwrtNpA3Y+yAkK00WGfmQkxRiluw8tcz/ggs= Received: by 10.14.28.71 with SMTP id f47mr5382054eea.38.1329144181629; Mon, 13 Feb 2012 06:43:01 -0800 (PST) Received: from localhost.localdomain (62.57.1.36.dyn.user.ono.com. [62.57.1.36]) by mx.google.com with ESMTPS id n52sm2314827eea.5.2012.02.13.06.42.59 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 13 Feb 2012 06:43:00 -0800 (PST) From: Alex Barcelo To: qemu-devel@nongnu.org Date: Mon, 13 Feb 2012 15:42:30 +0100 Message-Id: <1329144150-7720-4-git-send-email-abarcelo@ac.upc.edu> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1329144150-7720-1-git-send-email-abarcelo@ac.upc.edu> References: <1329144150-7720-1-git-send-email-abarcelo@ac.upc.edu> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.215.173 Cc: Kevin Wolf , Alex Barcelo Subject: [Qemu-devel] [PATCH 3/3] coroutine: adding enable/disable options for sigaltstack method 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 It's possible to enable/disable sigaltstack, but it always has less priority than ucontext method (to force sigaltstack, ucontext has to be disabled). Signed-off-by: Alex Barcelo --- Makefile.objs | 4 ++++ configure | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 0 deletions(-) diff --git a/Makefile.objs b/Makefile.objs index 391e524..8874825 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -17,8 +17,12 @@ coroutine-obj-y += qemu-coroutine-sleep.o ifeq ($(CONFIG_UCONTEXT_COROUTINE),y) coroutine-obj-$(CONFIG_POSIX) += coroutine-ucontext.o else +ifeq ($(CONFIG_SIGALTSTACK_COROUTINE),y) +coroutine-obj-$(CONFIG_POSIX) += coroutine-sigaltstack.o +else coroutine-obj-$(CONFIG_POSIX) += coroutine-gthread.o endif +endif coroutine-obj-$(CONFIG_WIN32) += coroutine-win32.o ####################################################################### diff --git a/configure b/configure index ed40da8..e9c27f3 100755 --- a/configure +++ b/configure @@ -191,6 +191,7 @@ zlib="yes" guest_agent="yes" libiscsi="" ucontext="" +sigaltstack="" # parse CC options first for opt do @@ -803,6 +804,10 @@ for opt do ;; --disable-ucontext) ucontext="no" ;; + --enable-sigaltstack) sigaltstack="yes" + ;; + --disable-sigaltstack) sigaltstack="no" + ;; *) echo "ERROR: unknown option $opt"; show_help="yes" ;; esac @@ -1091,6 +1096,8 @@ echo " --disable-guest-agent disable building of the QEMU Guest Agent" echo " --enable-guest-agent enable building of the QEMU Guest Agent" echo " --disable-ucontext disable ucontext functions for coroutines" echo " --enable-ucontext enable ucontext functions for coroutines" +echo " --disable-sigaltstack disable sigaltstack functions for coroutines" +echo " --enable-sigaltstack enable sigaltstack functions for coroutines" echo "" echo "NOTE: The object files are built at the place where configure is launched" exit 1 @@ -2745,6 +2752,33 @@ EOF fi ########################################## +# check, if there is no ucontext, for +# sigaltstack + +sigaltstack_coroutine=no +if test "$ucontext_coroutine" = "no" -a "$sigaltstack" != "no" ; then + cat > $TMPC << EOF +#include +int main(void) { + stack_t ss; + ss.ss_size = SIGSTKSZ; + ss.ss_flags = 0; + sigaltstack(&ss, 0); +} +EOF + if compile_prog "" "" ; then + sigaltstack_coroutine=yes + elif test "$sigaltstack" = "yes"; then + echo + echo "Error: sigaltstack check failed" + echo "Make sure that sigaltstack is supported" + echo + exit 1 + fi +fi + + +########################################## # check if we have open_by_handle_at open_by_hande_at=no @@ -2936,6 +2970,7 @@ echo "OpenGL support $opengl" echo "libiscsi support $libiscsi" echo "build guest agent $guest_agent" echo "ucontext coroutine support $ucontext_coroutine" +echo "sigaltstack coroutine support $sigaltstack_coroutine" if test "$sdl_too_old" = "yes"; then echo "-> Your SDL version is too old - please upgrade to have SDL support" @@ -3259,6 +3294,10 @@ if test "$ucontext_coroutine" = "yes" ; then echo "CONFIG_UCONTEXT_COROUTINE=y" >> $config_host_mak fi +if test "$sigaltstack_coroutine" = "yes" ; then + echo "CONFIG_SIGALTSTACK_COROUTINE=y" >> $config_host_mak +fi + if test "$open_by_handle_at" = "yes" ; then echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak fi