[PATCH v3 4/4] KVM: arm64: nv: Allow the L1 VNCR page in cacheable PFNMAP memory
Marc Zyngier
maz at kernel.org
Thu Dec 3 00:49:04 PST 2026
On Thu, 03 Dec 2026 02:32:23 +0000,
Justin He <Justin.He at arm.com> wrote:
[...]
> > > diff --git a/arch/arm64/kvm/nested.c b/arch/arm64/kvm/nested.c
> > > index 523d71d4df13..d3b77ed53ef6 100644
> > > --- a/arch/arm64/kvm/nested.c
> > > +++ b/arch/arm64/kvm/nested.c
> > > @@ -1553,6 +1553,37 @@ static u64 read_vncr_el2(struct kvm_vcpu *vcpu)
> > > return (u64)sign_extend64(__vcpu_sys_reg(vcpu, VNCR_EL2), 48);
> > > }
> > >
> > > +/*
> > > + * Allow a non-memory PFN only if it comes from a cacheable VM_PFNMAP
> > or
> > > + * VM_MIXEDMAP VMA and the system supports cacheable PFNMAP at
> > stage-2. The
> > > + * VMA is looked up after the PFN has been faulted in: the caller must check
> > > + * mmu_invalidate_retry() against a sequence count sampled before the
> > > + * fault-in.
> > > + */
> >
> > This applies to normal mapping as well, doesn't it? We already have
> > the non-gmem path doing VMA lookups, so this seems rather superfluous.
> > Unless this is covering something else?
> >
>
> Yes, this adds a second VMA lookup for PFNMAP. The existing lookup
> in hva_to_pfn_remapped() doesn't expose the VMA attributes to
> kvm_translate_vncr(), so the patch looks up vm_page_prot again.
> PFNs in the linear map bypass this lookup.
I understand what the patch does. My remark is about the comment
itself: it seems to indicate that this does something special, but I
don't see how this behaves differently from the code we already have
(all code paths release their respective lookup locks and then check
for a concurrent invalidation whilst holding the mmu_lock).
>
> I'd prefer to keep this local to arm64 for v4 to stay aligned
> with the stage-2 fault path, unless you'd rather extend the
> generic fault-in interface to reuse the existing lookup.
I think this is the correct place for now.
>
> I also reproduced a spurious SEA when replacing PFNMAP with shmem
> using MAP_FIXED. In v4, both PFN fault-in errors and cacheability
> failures are checked after mmu_invalidate_retry() under mmu_lock,
> before SEA injection. If an invalidation is detected, KVM retries
> instead.
I don't immediately see it, but I'll find out once you post the
patches.
Thanks,
M.
--
Without deviation from the norm, progress is not possible.
More information about the linux-arm-kernel
mailing list