The x86 kvm kernel module limits guest cpu count to 16, but theuserspace pc 
definition says 255 still, so kvm_create_vcpu will fail for that reason with 
-smp > 16 specified.  This patch causes qemu-kvm to exit in that case.  Without 
this patch other errors get reported down the road and finally a segfault 
occurs.

Bruce

Signed-off-by: Bruce Rogers <brog...@novell.com>

diff --git a/qemu/qemu-kvm.c b/qemu/qemu-kvm.c
index ed76367..b6d6d5e 100644
--- a/qemu/qemu-kvm.c
+++ b/qemu/qemu-kvm.c
@@ -417,12 +417,18 @@ static void *ap_main_loop(void *_env)
     CPUState *env = _env;
     sigset_t signals;
     struct ioperm_data *data = NULL;
+    int r;

     current_env = env;
     env->thread_id = kvm_get_thread_id();
     sigfillset(&signals);
     sigprocmask(SIG_BLOCK, &signals, NULL);
-    kvm_create_vcpu(kvm_context, env->cpu_index);
+    r = kvm_create_vcpu(kvm_context, env->cpu_index);
+    if (r)
+    {
+        fprintf(stderr, "error creating vcpu: %d\n", r);
+        exit(1);
+    }
     kvm_qemu_init_env(env);

 #ifdef USE_KVM_DEVICE_ASSIGNMENT


--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to