Re: [PATCH v4 09/30] KVM: x86: Move eager_page_split to mmu.{c,h}

From: Sean Christopherson

Date: Tue Jun 16 2026 - 13:22:20 EST


On Mon, Jun 15, 2026, Binbin Wu wrote:
> > diff --git a/arch/x86/kvm/mmu.h b/arch/x86/kvm/mmu.h
> > index 0eaea2d4fac9..d30676935fff 100644
> > --- a/arch/x86/kvm/mmu.h
> > +++ b/arch/x86/kvm/mmu.h
> > @@ -13,6 +13,7 @@ extern bool tdp_mmu_enabled;
> > #define tdp_mmu_enabled false
> > #endif
> > extern bool __read_mostly enable_mmio_caching;
> > +extern bool eager_page_split;
>
> Side topic, the attributes don't take effect for declarations, but in general,
> does KVM/kernel coding style have a preference to keep it for
> consistency/annotation or just drop it?

No, not as far as I know. Oh, nice! I was going to say that I don't have a
strong preference, because I assumed that conflicting annotations between the
declaration and definition wouldn't be flagged by the compiler, i.e. that it'd
be fairly easy to end up with stale annotations. But it turns out that's not
true:

arch/x86/kvm/vmx/vmx.c:214:8: error: ignoring attribute ‘section (".data..ro_after_init")’
because it conflicts with previous ‘section (".data..read_mostly")’ [-Werror=attributes]
214 | struct x86_pmu_lbr __ro_after_init vmx_lbr_caps;
| ^~~~~~~~~~~
In file included from arch/x86/kvm/vmx/vmx.h:14,
from arch/x86/kvm/vmx/hyperv.h:7,
from arch/x86/kvm/vmx/vmx.c:59:
arch/x86/kvm/vmx/pmu_intel.h:41:27: note: previous declaration here
41 | extern struct x86_pmu_lbr vmx_lbr_caps __read_mostly;
| ^~~~~~~~~~~~


So unless there's a wrinkle I'm missing, my preference would definitely be to
annotate the declarations as well. More information is pretty much always going
to be better in this case.