Re: [PATCH] KVM: x86: Increase KVM_MAX_VCPUS to 4096

From: Sean Christopherson
Date: Thu Aug 17 2023 - 19:45:30 EST


On Thu, Aug 17, 2023, Kyle Meyer wrote:
> > > 4096 is the current maximum value because of the Hyper-V TLFS. See
> > > BUILD_BUG_ON in arch/x86/kvm/hyperv.c, commit 79661c3, and Vitaly's
> > > comment on https://lore.kernel.org/all/87r136shcc.fsf@xxxxxxxxxx.
> >
> > Mostly out of curiosity, do you care about Hyper-V support? If not, at some
> > point it'd probably be worth exploring a CONFIG_KVM_HYPERV option to allow
> > disabling KVM's Hyper-V support at compile time so that we're not bound by the
> > restrictions of the TLFS.
>
> Yes, I care about Hyper-V support. I would like this limitation to be addressed
> in the future.
>
> > Rather than tightly couple this to MAXSMP, what if we add a Kconfig? I know of
> > at least one scenario, SVM's AVIC/x2AVIC, where it would be desirable to configure
> > KVM to a much smaller maximum. The biggest downside I can think of is that KVM
> > selftests would need to be updated (they assume the max is >=512), and some of the
> > tests might be completely invalid if KVM_MAX_VCPUS is too low (<256?).
>
> That sounds good to me. I would prefer to set the range from 1024 to 4096 in
> this patch.

Yeah, that's probably for the best.