qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1.1] coroutine: Avoid ucontext usage on i386 Linux host
@ 2012-05-09 19:21 Jan Kiszka
  2012-05-09 19:27 ` Michael Tokarev
  2012-05-09 20:04 ` Michael Tokarev
  0 siblings, 2 replies; 13+ messages in thread
From: Jan Kiszka @ 2012-05-09 19:21 UTC (permalink / raw)
  To: qemu-devel, Anthony Liguori, Kevin Wolf; +Cc: Peter Maydell, Michael Tokarev

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 <jan.kiszka@siemens.com>
---

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 <ucontext.h>
 #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"
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2012-05-09 21:36 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-09 19:21 [Qemu-devel] [PATCH 1.1] coroutine: Avoid ucontext usage on i386 Linux host Jan Kiszka
2012-05-09 19:27 ` Michael Tokarev
2012-05-09 19:34   ` Jan Kiszka
2012-05-09 19:48     ` Anthony Liguori
2012-05-09 19:57       ` Jan Kiszka
2012-05-09 20:01         ` Anthony Liguori
2012-05-09 20:11           ` Jan Kiszka
2012-05-09 20:46             ` Peter Maydell
2012-05-09 20:59               ` Anthony Liguori
2012-05-09 21:27                 ` Peter Maydell
2012-05-09 21:36                   ` Anthony Liguori
2012-05-09 20:56             ` Anthony Liguori
2012-05-09 20:04 ` Michael Tokarev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).