diff mbox

[uq/master,2/2] kvm-all.c: max_cpus should not exceed KVM vcpu limit

Message ID 20130812195730.363325196@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Marcelo Tosatti Aug. 12, 2013, 7:56 p.m. UTC
maxcpus, which specifies the maximum number of hotpluggable CPUs,
should not exceed KVM's vcpu limit.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.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

Comments

Paolo Bonzini Aug. 20, 2013, 4:44 p.m. UTC | #1
Il 12/08/2013 21:56, Marcelo Tosatti ha scritto:
> maxcpus, which specifies the maximum number of hotpluggable CPUs,
> should not exceed KVM's vcpu limit.
> 
> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
> 
> Index: qemu/kvm-all.c
> ===================================================================
> --- qemu.orig/kvm-all.c
> +++ qemu/kvm-all.c
> @@ -1391,6 +1391,13 @@ int kvm_init(void)
>          goto err;
>      }
>  
> +    if (max_cpus > max_vcpus) {
> +        ret = -EINVAL;
> +        fprintf(stderr, "Number of max_cpus requested (%d) exceeds max cpus "
> +                "supported by KVM (%d)\n", max_cpus, max_vcpus);
> +        goto err;
> +    }
> +
>      s->vmfd = kvm_ioctl(s, KVM_CREATE_VM, 0);
>      if (s->vmfd < 0) {
>  #ifdef TARGET_S390X
> 
> 
> --
> 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
> 

I applied this patch to uq/master.  Thanks,

Paolo
--
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

Index: qemu/kvm-all.c
===================================================================
--- qemu.orig/kvm-all.c
+++ qemu/kvm-all.c
@@ -1391,6 +1391,13 @@  int kvm_init(void)
         goto err;
     }
 
+    if (max_cpus > max_vcpus) {
+        ret = -EINVAL;
+        fprintf(stderr, "Number of max_cpus requested (%d) exceeds max cpus "
+                "supported by KVM (%d)\n", max_cpus, max_vcpus);
+        goto err;
+    }
+
     s->vmfd = kvm_ioctl(s, KVM_CREATE_VM, 0);
     if (s->vmfd < 0) {
 #ifdef TARGET_S390X