Re: [PATCH v2 2/3] KVM: x86/mmu: Fully re-evaluate MMIO caching when SPTE masks change

From: Sean Christopherson
Date: Wed Aug 03 2022 - 20:17:40 EST


On Thu, Aug 04, 2022, Kai Huang wrote:
> On Wed, 2022-08-03 at 22:49 +0000, Sean Christopherson wrote:
> > +void __init kvm_mmu_spte_module_init(void)
> > +{
> > + /*
> > + * Snapshot userspace's desire to allow MMIO caching. Whether or not
> > + * KVM can actually enable MMIO caching depends on vendor-specific
> > + * hardware capabilities and other module params that can't be resolved
> > + * until the vendor module is loaded, i.e. enable_mmio_caching can and
> > + * will change when the vendor module is (re)loaded.
> > + */
> > + allow_mmio_caching = enable_mmio_caching;
>
> ... Perhaps 'use_mmio_caching' or 'want_mmio_caching' is better as it reflects
> userspace's desire? Anyway let you decide.

Part of me likes "want_mmio_caching", but the module param really is only for
testing, i.e. any sane configuration always wants MMIO caching, but sometimes it's
explicitly disallowed purely so that KVM can mimic hardware that doesn't support
MMIO caching.