Re: [Qemu-devel] [PATCH] kvm: Check if smp_cpus exceeds max cpus supported by kvm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 30, 2012 at 7:22 PM,  <riegamaths@xxxxxxxxx> wrote:
> From: Dunrong Huang <riegamaths@xxxxxxxxx>
>
> Add a helper function for fetching max cpus supported by kvm.
>
> Make QEMU exit with an error message if smp_cpus exceeds limit
> of VCPU count retrieved by invoking this helper function.
>
> Signed-off-by: Dunrong Huang <riegamaths@xxxxxxxxx>
> ---
>  kvm-all.c |   25 +++++++++++++++++++++++++
>  1 files changed, 25 insertions(+), 0 deletions(-)
>
> diff --git a/kvm-all.c b/kvm-all.c
> index 2148b20..8cb4b92 100644
> --- a/kvm-all.c
> +++ b/kvm-all.c
> @@ -1207,6 +1207,23 @@ static int kvm_irqchip_create(KVMState *s)
>      return 0;
>  }
>
> +static int kvm_max_vcpus(KVMState *s)
> +{
> +    int max_vcpus = 4;
> +    int ret;
> +    ret = kvm_check_extension(s, KVM_CAP_MAX_VCPUS);
> +    if (ret) {
> +        max_vcpus = ret;
> +    } else {
> +       ret = kvm_check_extension(s, KVM_CAP_NR_VCPUS);
> +        if (ret) {
> +            max_vcpus = ret;
> +        }
> +   }

The indentation is off here.  It should be 4 spaces.

Otherwise looks fine.

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


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux