From patchwork Wed May 9 19:21:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 158039 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 838D8B6FA9 for ; Thu, 10 May 2012 05:21:28 +1000 (EST) Received: from localhost ([::1]:60927 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SSCRw-0002hq-DW for incoming@patchwork.ozlabs.org; Wed, 09 May 2012 15:21:24 -0400 Received: from eggs.gnu.org ([208.118.235.92]:59039) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SSCRp-0002hS-3V for qemu-devel@nongnu.org; Wed, 09 May 2012 15:21:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SSCRn-0007lN-66 for qemu-devel@nongnu.org; Wed, 09 May 2012 15:21:16 -0400 Received: from thoth.sbs.de ([192.35.17.2]:18507) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SSCRm-0007kr-Sy for qemu-devel@nongnu.org; Wed, 09 May 2012 15:21:15 -0400 Received: from mail1.siemens.de (localhost [127.0.0.1]) by thoth.sbs.de (8.13.6/8.13.6) with ESMTP id q49JLAwV005158; Wed, 9 May 2012 21:21:10 +0200 Received: from mchn199C.mchp.siemens.de ([139.22.46.144]) by mail1.siemens.de (8.13.6/8.13.6) with SMTP id q49JL7pw013051; Wed, 9 May 2012 21:21:08 +0200 Message-ID: <4FAAC3A3.5040503@siemens.com> Date: Wed, 09 May 2012 16:21:07 -0300 From: Jan Kiszka User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 To: qemu-devel , Anthony Liguori , Kevin Wolf X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 192.35.17.2 Cc: Peter Maydell , Michael Tokarev Subject: [Qemu-devel] [PATCH 1.1] coroutine: Avoid ucontext usage on i386 Linux host 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 On i386, glibc only saves/restores the signal mask via sigprocmask, excluding RT signal. A Linux bug in the compat version of this syscall corrupts the RT signal state, which will cause lockups of QEMU's VCPU threads. Therefore, fall back to gthread coroutines on this host platform. Signed-off-by: Jan Kiszka --- I'm not sure where to fall back to. The existing code uses gthread, likely because it is the safer harbor. So I picked it as well. This is also stable material. configure | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 491109d..62dcdb2 100755 --- a/configure +++ b/configure @@ -2777,17 +2777,22 @@ fi # windows autodetected by make if test "$coroutine" = "" -o "$coroutine" = "ucontext"; then if test "$darwin" != "yes"; then - cat > $TMPC << EOF + if test "$linux" = "yes" -a "$cpu" = "i386"; then + # RT signal mask corruption for 32-on-64 bit prevents ucontext usage + coroutine_backend=gthread + else + 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 + if compile_prog "" "" ; then coroutine_backend=ucontext - else - coroutine_backend=gthread + else + coroutine_backend=gthread + fi fi else echo "Silently falling back into gthread backend under darwin"