[PATCH] Revert "qemu-kvm: Bring qemu_init_vcpu back home"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This reverts commit c65827770b5e7282b5fb9da29c1de85ed08e816e

Signed-off-by: Ryousei Takano <takano-ryousei@xxxxxxxxxx>
---
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
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux