All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Tokarev <mjt@tls.msk.ru>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Anthony Liguori <aliguori@us.ibm.com>,
	qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] coroutine-ucontext broken for x86-32
Date: Wed, 09 May 2012 22:05:47 +0400	[thread overview]
Message-ID: <4FAAB1FB.9040303@msgid.tls.msk.ru> (raw)
In-Reply-To: <4FA97596.4000807@siemens.com>

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

      parent reply	other threads:[~2012-05-09 18:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-08 19:35 [Qemu-devel] coroutine-ucontext broken for x86-32 Jan Kiszka
2012-05-09  7:32 ` Michael Tokarev
2012-05-09 11:12   ` Jan Kiszka
2012-05-09 10:11 ` Kevin Wolf
2012-05-09 10:55   ` Jan Kiszka
2012-05-09 11:15   ` Peter Maydell
2012-05-09 11:38     ` Jan Kiszka
2012-05-09 17:17       ` Anthony Liguori
2012-05-09 17:25         ` Jan Kiszka
2012-05-09 17:31           ` Anthony Liguori
2012-05-09 18:21             ` Jan Kiszka
2012-05-09 14:37     ` Avi Kivity
2012-05-09 18:05 ` Michael Tokarev [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FAAB1FB.9040303@msgid.tls.msk.ru \
    --to=mjt@tls.msk.ru \
    --cc=aliguori@us.ibm.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.