public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [uq/master patch 0/2] kvm max vcpu limit fixes
@ 2013-08-12 19:56 Marcelo Tosatti
  2013-08-12 19:56 ` [uq/master patch 1/2] kvm-all.c: use recommended max vcpus limit Marcelo Tosatti
  2013-08-12 19:56 ` [uq/master patch 2/2] kvm-all.c: max_cpus should not exceed KVM vcpu limit Marcelo Tosatti
  0 siblings, 2 replies; 6+ messages in thread
From: Marcelo Tosatti @ 2013-08-12 19:56 UTC (permalink / raw)
  To: kvm; +Cc: pbonzini, gleb

1) Use recommended vcpu limit instead of max vcpu limit
2) Do not allow max_cpus > max_vcpus



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [uq/master patch 1/2] kvm-all.c: use recommended max vcpus limit
  2013-08-12 19:56 [uq/master patch 0/2] kvm max vcpu limit fixes Marcelo Tosatti
@ 2013-08-12 19:56 ` Marcelo Tosatti
  2013-08-18 15:28   ` Paolo Bonzini
  2013-08-12 19:56 ` [uq/master patch 2/2] kvm-all.c: max_cpus should not exceed KVM vcpu limit Marcelo Tosatti
  1 sibling, 1 reply; 6+ messages in thread
From: Marcelo Tosatti @ 2013-08-12 19:56 UTC (permalink / raw)
  To: kvm; +Cc: pbonzini, gleb, Marcelo Tosatti

[-- Attachment #1: kvm-all-use-cap-nr-vcpus-first --]
[-- Type: text/plain, Size: 940 bytes --]

Commit 8c3ba334f8588e1d5099f8602cf01897720e0eca, "KVM: x86: Raise the
hard VCPU count limit", upstream introduced the notion of a recommended
vcpu max limit.

Switch the order so the recommended vcpu max limit is used instead of
the actual max vcpu limit.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

Index: qemu/kvm-all.c
===================================================================
--- qemu.orig/kvm-all.c
+++ qemu/kvm-all.c
@@ -1321,11 +1321,11 @@ static int kvm_max_vcpus(KVMState *s)
      * procedure from the kernel API documentation to cope with
      * older kernels that may be missing capabilities.
      */
-    ret = kvm_check_extension(s, KVM_CAP_MAX_VCPUS);
+    ret = kvm_check_extension(s, KVM_CAP_NR_VCPUS);
     if (ret) {
         return ret;
     }
-    ret = kvm_check_extension(s, KVM_CAP_NR_VCPUS);
+    ret = kvm_check_extension(s, KVM_CAP_MAX_VCPUS);
     if (ret) {
         return ret;
     }



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [uq/master patch 2/2] kvm-all.c: max_cpus should not exceed KVM vcpu limit
  2013-08-12 19:56 [uq/master patch 0/2] kvm max vcpu limit fixes Marcelo Tosatti
  2013-08-12 19:56 ` [uq/master patch 1/2] kvm-all.c: use recommended max vcpus limit Marcelo Tosatti
@ 2013-08-12 19:56 ` Marcelo Tosatti
  2013-08-20 16:44   ` Paolo Bonzini
  1 sibling, 1 reply; 6+ messages in thread
From: Marcelo Tosatti @ 2013-08-12 19:56 UTC (permalink / raw)
  To: kvm; +Cc: pbonzini, gleb, Marcelo Tosatti

[-- Attachment #1: kvm-all-check-max-cpus --]
[-- Type: text/plain, Size: 684 bytes --]

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



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [uq/master patch 1/2] kvm-all.c: use recommended max vcpus limit
  2013-08-12 19:56 ` [uq/master patch 1/2] kvm-all.c: use recommended max vcpus limit Marcelo Tosatti
@ 2013-08-18 15:28   ` Paolo Bonzini
  2013-08-18 16:15     ` Marcelo Tosatti
  0 siblings, 1 reply; 6+ messages in thread
From: Paolo Bonzini @ 2013-08-18 15:28 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: kvm, gleb

Il 12/08/2013 21:56, Marcelo Tosatti ha scritto:
> Commit 8c3ba334f8588e1d5099f8602cf01897720e0eca, "KVM: x86: Raise the
> hard VCPU count limit", upstream introduced the notion of a recommended
> vcpu max limit.
> 
> Switch the order so the recommended vcpu max limit is used instead of
> the actual max vcpu limit.
> 
> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
> 
> Index: qemu/kvm-all.c
> ===================================================================
> --- qemu.orig/kvm-all.c
> +++ qemu/kvm-all.c
> @@ -1321,11 +1321,11 @@ static int kvm_max_vcpus(KVMState *s)
>       * procedure from the kernel API documentation to cope with
>       * older kernels that may be missing capabilities.
>       */
> -    ret = kvm_check_extension(s, KVM_CAP_MAX_VCPUS);
> +    ret = kvm_check_extension(s, KVM_CAP_NR_VCPUS);
>      if (ret) {
>          return ret;
>      }
> -    ret = kvm_check_extension(s, KVM_CAP_NR_VCPUS);
> +    ret = kvm_check_extension(s, KVM_CAP_MAX_VCPUS);
>      if (ret) {
>          return ret;
>      }
> 
> 

This would break "working" configurations.  Perhaps we should just warn
if the VCPU limit exceeds KVM_CAP_NR_VCPUS, and fail if the VCPU limit
exceeds KVM_CAP_MAX_VCPUS.

Patch 2 is fine, ok to apply it (since it fixes a real bug) and then you
can work on top of it?

Paolo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [uq/master patch 1/2] kvm-all.c: use recommended max vcpus limit
  2013-08-18 15:28   ` Paolo Bonzini
@ 2013-08-18 16:15     ` Marcelo Tosatti
  0 siblings, 0 replies; 6+ messages in thread
From: Marcelo Tosatti @ 2013-08-18 16:15 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: kvm, gleb

On Sun, Aug 18, 2013 at 05:28:28PM +0200, Paolo Bonzini wrote:
> Il 12/08/2013 21:56, Marcelo Tosatti ha scritto:
> > Commit 8c3ba334f8588e1d5099f8602cf01897720e0eca, "KVM: x86: Raise the
> > hard VCPU count limit", upstream introduced the notion of a recommended
> > vcpu max limit.
> > 
> > Switch the order so the recommended vcpu max limit is used instead of
> > the actual max vcpu limit.
> > 
> > Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
> > 
> > Index: qemu/kvm-all.c
> > ===================================================================
> > --- qemu.orig/kvm-all.c
> > +++ qemu/kvm-all.c
> > @@ -1321,11 +1321,11 @@ static int kvm_max_vcpus(KVMState *s)
> >       * procedure from the kernel API documentation to cope with
> >       * older kernels that may be missing capabilities.
> >       */
> > -    ret = kvm_check_extension(s, KVM_CAP_MAX_VCPUS);
> > +    ret = kvm_check_extension(s, KVM_CAP_NR_VCPUS);
> >      if (ret) {
> >          return ret;
> >      }
> > -    ret = kvm_check_extension(s, KVM_CAP_NR_VCPUS);
> > +    ret = kvm_check_extension(s, KVM_CAP_MAX_VCPUS);
> >      if (ret) {
> >          return ret;
> >      }
> > 
> > 
> 
> This would break "working" configurations.  Perhaps we should just warn
> if the VCPU limit exceeds KVM_CAP_NR_VCPUS, and fail if the VCPU limit
> exceeds KVM_CAP_MAX_VCPUS.
> 
> Patch 2 is fine, ok to apply it (since it fixes a real bug) and then you
> can work on top of it?

OK, please apply patch 2.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [uq/master patch 2/2] kvm-all.c: max_cpus should not exceed KVM vcpu limit
  2013-08-12 19:56 ` [uq/master patch 2/2] kvm-all.c: max_cpus should not exceed KVM vcpu limit Marcelo Tosatti
@ 2013-08-20 16:44   ` Paolo Bonzini
  0 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2013-08-20 16:44 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: kvm, gleb

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-08-20 16:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-12 19:56 [uq/master patch 0/2] kvm max vcpu limit fixes Marcelo Tosatti
2013-08-12 19:56 ` [uq/master patch 1/2] kvm-all.c: use recommended max vcpus limit Marcelo Tosatti
2013-08-18 15:28   ` Paolo Bonzini
2013-08-18 16:15     ` Marcelo Tosatti
2013-08-12 19:56 ` [uq/master patch 2/2] kvm-all.c: max_cpus should not exceed KVM vcpu limit Marcelo Tosatti
2013-08-20 16:44   ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox