From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:52065) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SSBGw-0006xQ-AC for qemu-devel@nongnu.org; Wed, 09 May 2012 14:06:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SSBGp-0007R2-DC for qemu-devel@nongnu.org; Wed, 09 May 2012 14:05:57 -0400 Received: from isrv.corpit.ru ([86.62.121.231]:41415) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SSBGp-0007QW-5H for qemu-devel@nongnu.org; Wed, 09 May 2012 14:05:51 -0400 Message-ID: <4FAAB1FB.9040303@msgid.tls.msk.ru> Date: Wed, 09 May 2012 22:05:47 +0400 From: Michael Tokarev MIME-Version: 1.0 References: <4FA97596.4000807@siemens.com> In-Reply-To: <4FA97596.4000807@siemens.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] coroutine-ucontext broken for x86-32 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: Kevin Wolf , Anthony Liguori , qemu-devel On 08.05.2012 23:35, Jan Kiszka wrote: > Hi, > > I hunted down a fairly subtle corruption of the VCPU thread signal mask > in KVM mode when using the ucontext version of coroutines: > > coroutine_new calls getcontext, makecontext, swapcontext. Those > functions get/set also the signal mask of the caller. Unfortunately, > they only use the sigprocmask syscall on i386, not the rt_sigprocmask > version. So they do not properly save/restore the blocked RT signals, > namely our SIG_IPI - it becomes unblocke this way. And this will sooner > or later make the kernel actually deliver a SIG_IPI to our > dummy_handler, and we miss a wakeup, which means losing control over > VCPU thread - qemu hangs. > > I was able to reproduce the issue very reliably with virtio-block > enabled, 32-bit qemu userspace on a 64-bit host, using a 32-bit WinXP > guest. > > Simple workaround: > > diff --git a/main-loop.h b/main-loop.h > index c06b8bc..dce1cd9 100644 > --- a/main-loop.h > +++ b/main-loop.h > @@ -25,11 +25,7 @@ > #ifndef QEMU_MAIN_LOOP_H > #define QEMU_MAIN_LOOP_H 1 > > -#ifdef SIGRTMIN > -#define SIG_IPI (SIGRTMIN+4) > -#else > #define SIG_IPI SIGUSR1 > -#endif [] > Michael, maybe this also relates to the issue you saw. I'm not able to > reproduce any VAPIC problems after make Windows bootable by switching > to SIGUSR1. FWIW, this fixes both the STOP 0x5c during reboot of windows 32bit guest and my other issue, with qemu stalling on 32/64bit environment. So yes indeed, that's the same thing apparently... Nice catch! /mjt