From: Marc Zyngier <maz@kernel.org>
To: Justin He <Justin.He@arm.com>
Cc: "oupton@kernel.org" <oupton@kernel.org>,
"fuad.tabba@linux.dev" <fuad.tabba@linux.dev>,
Joey Gouly <Joey.Gouly@arm.com>,
"seiden@linux.ibm.com" <seiden@linux.ibm.com>,
Suzuki Poulose <Suzuki.Poulose@arm.com>,
"yuzenghui@huawei.com" <yuzenghui@huawei.com>,
Catalin Marinas <Catalin.Marinas@arm.com>,
"will@kernel.org" <will@kernel.org>,
Mark Rutland <Mark.Rutland@arm.com>,
"pbonzini@redhat.com" <pbonzini@redhat.com>,
"seanjc@google.com" <seanjc@google.com>,
"shuah@kernel.org" <shuah@kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"kvmarm@lists.linux.dev" <kvmarm@lists.linux.dev>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"linux-kselftest@vger.kernel.org"
<linux-kselftest@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 4/4] KVM: arm64: nv: Allow the L1 VNCR page in cacheable PFNMAP memory
Date: Thu, 03 Dec 2026 08:49:04 +0000 [thread overview]
Message-ID: <867bhqycjj.wl-maz@kernel.org> (raw)
In-Reply-To: <PAVPR08MB9795C05106A4324E4B27C193F74B2@PAVPR08MB9795.eurprd08.prod.outlook.com>
On Thu, 03 Dec 2026 02:32:23 +0000,
Justin He <Justin.He@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.
prev parent reply other threads:[~2026-12-03 8:49 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-28 1:14 [PATCH v3 0/4] KVM: arm64: nv: VNCR page mapping fixes Jia He
2026-11-28 1:14 ` [PATCH v3 1/4] KVM: arm64: nv: Locate the VNCR page in the host page from its PA Jia He
2026-11-29 11:52 ` Marc Zyngier
2026-11-30 5:04 ` Justin He
2026-11-28 1:14 ` [PATCH v3 2/4] KVM: arm64: nv: Inject an SEA when the VNCR walk cannot set the AF Jia He
2026-12-03 7:39 ` Yao Yuan
2026-11-28 1:14 ` [PATCH v3 3/4] KVM: arm64: selftests: Add a test for VNCR_EL2 translation faults Jia He
2026-11-28 1:14 ` [PATCH v3 4/4] KVM: arm64: nv: Allow the L1 VNCR page in cacheable PFNMAP memory Jia He
2026-12-02 14:32 ` Marc Zyngier
2026-12-03 2:32 ` Justin He
2026-12-03 8:49 ` Marc Zyngier [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=867bhqycjj.wl-maz@kernel.org \
--to=maz@kernel.org \
--cc=Catalin.Marinas@arm.com \
--cc=Joey.Gouly@arm.com \
--cc=Justin.He@arm.com \
--cc=Mark.Rutland@arm.com \
--cc=Suzuki.Poulose@arm.com \
--cc=fuad.tabba@linux.dev \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=oupton@kernel.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=seiden@linux.ibm.com \
--cc=shuah@kernel.org \
--cc=will@kernel.org \
--cc=yuzenghui@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®