All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Kyle Meyer <kyle.meyer@hpe.com>
Cc: bp@alien8.de, dave.hansen@linux.intel.com, dmatlack@google.com,
	hpa@zytor.com, jmattson@google.com, joro@8bytes.org,
	kvm@vger.kernel.org, kyle.meyer@hpe.com, mingo@redhat.com,
	payton@hpe.com, russ.anderson@hpe.com, steve.wahl@hpe.com,
	tglx@linutronix.de, wanpengli@tencent.com, x86@kernel.org,
	seanjc@google.com
Subject: Re: [PATCH v2] KVM: x86: Increase KVM_MAX_VCPUS to 4096
Date: Thu, 30 Jun 2022 10:09:23 +0200	[thread overview]
Message-ID: <87r136shcc.fsf@redhat.com> (raw)
In-Reply-To: <20220629203824.150259-1-kyle.meyer@hpe.com>

Kyle Meyer <kyle.meyer@hpe.com> writes:

> Increase KVM_MAX_VCPUS to 4096 when the maximum number of supported CPUs
> (NR_CPUS) is greater than 1024.
>
> The Hyper-V TLFS doesn't allow more than 64 sparse banks, which allows a
> maximum of 4096 virtual CPUs. Limit KVM's maximum number of virtual CPUs
> to 4096 to avoid exceeding that limit.

In theory, it's just TLB flush and IPI hypercalls which have this
limitation. Strictly speaking, guest can have more than 4096 vCPUs,
it'll just have to do IPIs/TLB flush in a different way.

>
> Notable changes:
>
> * KVM_MAX_VCPU_IDS will increase from 4096 to 16384.
> * KVM_HV_MAX_SPARSE_VCPU_SET_BITS will increase from 16 to 64.
>
> * CPUID[HYPERV_CPUID_IMPLEMENT_LIMITS (00x40000005)].EAX will now be 4096.

	redundant leading zero		 ^^

>
> * struct kvm will increase from 40336 B to 40720 B.
> * struct kvm_ioapic will increase from 5240 B to 19064 B.
>
> * vcpu_mask in kvm_hv_flush_tlb will increase from 128 B to 512 B.
> * vcpu_bitmap in ioapic_write_indirect will increase from 128 B to 512 B.
> * vp_bitmap in sparse_set_to_vcpu_mask will increase from 128 B to 512 B.
>
> Signed-off-by: Kyle Meyer <kyle.meyer@hpe.com>
> ---
>  arch/x86/include/asm/kvm_host.h | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> index 9217bd6cf0d1..867a945f0152 100644
> --- a/arch/x86/include/asm/kvm_host.h
> +++ b/arch/x86/include/asm/kvm_host.h
> @@ -38,7 +38,11 @@
>  
>  #define __KVM_HAVE_ARCH_VCPU_DEBUGFS
>  
> +#if NR_CPUS < 1024
>  #define KVM_MAX_VCPUS 1024
> +#else
> +#define KVM_MAX_VCPUS 4096
> +#endif
>  
>  /*
>   * In x86, the VCPU ID corresponds to the APIC ID, and APIC IDs

-- 
Vitaly


  reply	other threads:[~2022-06-30  8:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-13 14:50 [PATCH] KVM: x86: Increase KVM_MAX_VCPUS to 2048 Kyle Meyer
2022-06-13 15:19 ` Vitaly Kuznetsov
2022-06-13 20:24 ` David Matlack
2022-06-14  8:27   ` Vitaly Kuznetsov
2022-06-16 16:47     ` David Matlack
2022-06-16 16:58       ` Sean Christopherson
2022-06-29 20:38         ` [PATCH v2] KVM: x86: Increase KVM_MAX_VCPUS to 4096 Kyle Meyer
2022-06-30  8:09           ` Vitaly Kuznetsov [this message]
2022-07-07 17:03             ` Sean Christopherson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r136shcc.fsf@redhat.com \
    --to=vkuznets@redhat.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=dmatlack@google.com \
    --cc=hpa@zytor.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=kyle.meyer@hpe.com \
    --cc=mingo@redhat.com \
    --cc=payton@hpe.com \
    --cc=russ.anderson@hpe.com \
    --cc=seanjc@google.com \
    --cc=steve.wahl@hpe.com \
    --cc=tglx@linutronix.de \
    --cc=wanpengli@tencent.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.