diff mbox

handle -smp > 16 more cleanly

Message ID 49DDD2800200004800071C91@lucius.provo.novell.com (mailing list archive)
State New, archived
Headers show

Commit Message

Bruce Rogers April 9, 2009, 4:48 p.m. UTC
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 <brogers@novell.com>



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

Patch

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