OSDN Git Service

Fix CPU topology initialization
authorJiri Denemark <jdenemar@redhat.com>
Tue, 5 Jan 2010 16:26:34 +0000 (17:26 +0100)
committerAnthony Liguori <aliguori@us.ibm.com>
Mon, 11 Jan 2010 15:56:30 +0000 (09:56 -0600)
Late initialization of CPU topology in CPUState prevents KVM guests to
actually see the topology.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
vl.c

diff --git a/vl.c b/vl.c
index 2b0b653..b048e89 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -3484,10 +3484,10 @@ void qemu_init_vcpu(void *_env)
 {
     CPUState *env = _env;
 
-    if (kvm_enabled())
-        kvm_init_vcpu(env);
     env->nr_cores = smp_cores;
     env->nr_threads = smp_threads;
+    if (kvm_enabled())
+        kvm_init_vcpu(env);
     return;
 }
 
@@ -3813,12 +3813,12 @@ void qemu_init_vcpu(void *_env)
 {
     CPUState *env = _env;
 
+    env->nr_cores = smp_cores;
+    env->nr_threads = smp_threads;
     if (kvm_enabled())
         kvm_start_vcpu(env);
     else
         tcg_init_vcpu(env);
-    env->nr_cores = smp_cores;
-    env->nr_threads = smp_threads;
 }
 
 void qemu_notify_event(void)