public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Revert "qemu-kvm: Bring qemu_init_vcpu back home"
@ 2011-02-23 14:38 Ryousei Takano
  2011-02-23 14:47 ` Jan Kiszka
  0 siblings, 1 reply; 6+ messages in thread
From: Ryousei Takano @ 2011-02-23 14:38 UTC (permalink / raw)
  To: kvm; +Cc: Jan Kiszka, Marcelo Tosatti, takano-ryousei

This reverts commit c65827770b5e7282b5fb9da29c1de85ed08e816e

Signed-off-by: Ryousei Takano <takano-ryousei@aist.go.jp>
---
I am trying to run OpenMP (i.e., multi-threaded) programs using Intel
Math Kernel Library (MKL) on a guest OS.  In the qemu-kvm-0.12.5,
my program works fine.  In the qemu-kvm-0.13.0, however, it does not.
The Linux kernel is 2.6.32.28.  The outputs of 'ps -L' are shown as follows:

qemu-kvm-0.12.5:
 PID   LWP TTY          TIME CMD
 2731  2731 pts/0    00:00:00 bash
 2799  2799 pts/0    00:00:19 a.out
 2799  2803 pts/0    00:00:00 a.out
 2799  2804 pts/0    00:00:04 a.out   <-
 2799  2805 pts/0    00:00:03 a.out   <- these threads are working properly.
 2799  2806 pts/0    00:00:04 a.out   <-
 2807  2807 pts/0    00:00:00 ps

qemu-0.13.0:
 PID   LWP TTY          TIME CMD
 2725  2725 pts/0    00:00:00 bash
 2748  2748 pts/0    00:00:19 a.out
 2748  2752 pts/0    00:00:00 a.out
 2748  2753 pts/0    00:00:00 a.out   <-
 2748  2754 pts/0    00:00:00 a.out   <- these threads are blocked by
pthread_cond_wait(3).
 2748  2755 pts/0    00:00:00 a.out   <-
 2756  2756 pts/0    00:00:00 ps

This problem seems to be introduced by the commit
c65827770b5e7282b5fb9da29c1de85ed08e816e.
The attached revert patch solves it.  But I do not understand what is
happened;-)
Any comments and suggestions will be appreciated.

Regards,
Ryousei

 hw/pc.c              |    6 ++++++
 target-i386/helper.c |    2 --
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/hw/pc.c b/hw/pc.c
index ec97181..577abe7 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -937,6 +937,12 @@ CPUState *pc_new_cpu(const char *cpu_model)
     }
     qemu_register_reset(pc_cpu_reset, env);
     pc_cpu_reset(env);
+
+    /* kvm needs this to run after the apic is initialized. Otherwise,
+     * it can access invalid state and crash.
+     */
+    qemu_init_vcpu(env);
+
     return env;
 }

diff --git a/target-i386/helper.c b/target-i386/helper.c
index 86202e6..69cda5e 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -1224,8 +1224,6 @@ CPUX86State *cpu_x86_init(const char *cpu_model)
     }
     mce_init(env);

-    qemu_init_vcpu(env);
-
     return env;
 }

-- 
1.7.4.1

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

end of thread, other threads:[~2011-02-24  7:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-23 14:38 [PATCH] Revert "qemu-kvm: Bring qemu_init_vcpu back home" Ryousei Takano
2011-02-23 14:47 ` Jan Kiszka
2011-02-23 15:53   ` Ryousei Takano
2011-02-23 17:26     ` Jan Kiszka
2011-02-24  1:29       ` Ryousei Takano
2011-02-24  7:56         ` Jan Kiszka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox