Re: [PATCH 1/4] KVM: introduce CONFIG_KVM_COMMON

From: Sean Christopherson
Date: Fri Jan 05 2024 - 15:58:06 EST


On Fri, Jan 05, 2024, Paolo Bonzini wrote:
> On Fri, Jan 5, 2024 at 8:13 PM Sean Christopherson <seanjc@xxxxxxxxxx> wrote:
> > > Start by introducing such a new Kconfig symbol, CONFIG_KVM_COMMON.
> > > Unlike CONFIG_HAVE_KVM, it is selected by CONFIG_KVM, not by
> > > architecture code.
> >
> > Why? I don't get it, just have code that cares do IS_ENABLED(CONFIG_KVM). Except
> > for the MIPS usage of HAVE_KVM that you solved by adding CPU_SUPPORTS_VZ, I got
> > all the way there using just CONFIG_KVM[*].
> >
> > Ah, and so does this series for the most part, the only usage of CONFIG_KVM_COMMON
> > is in scripts/gdb/linux/constants.py.in. Honestly, adding a Kconfig just so that
> > VMX's posted interrupts that arrive in the host can be printed when KVM is built
> > as a module is a waste of a Kconfig.
>
> There is one extra thing that CONFIG_KVM_COMMON does, which is to
> avoid having to select common requirements in all architectures.

Oooh, gotcha. FWIW, I would love to unify the "menuconfig VIRTUALIZATION" and
"config KVM" entries, but I can't think of a sane way to do that without ending
up with something like KVM_COMMON. :-/

> I jotted this to solve the reported randconfig failure, which is why
> CONFIG_KVM_COMMON only requires "select EVENTFD", but looking more
> closely it should also select PREEMPT_NOTIFIERS and INTERVAL_TREE.
> Both are used by virt/kvm/kvm_main.c, and loongarch + riscv both lack
> INTERVAL_TREE so I do think it's a good idea to introduce this symbol
> (though it requires a v2).
>
> > [*] https://lore.kernel.org/all/20230916003118.2540661-12-seanjc@xxxxxxxxxx
>
> I guess you mean
> https://lore.kernel.org/all/20230916003118.2540661-8-seanjc@xxxxxxxxxx/.

Doh, yes.