From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796287747; b=oxDY6En8OzK6iBxskbao2hNzRRZhwlMJPzpT2YeAiwpVHj4EGzyIGyv6PtSnpVzsBVin PFfM0DnotBoPd60fGFIws0ni+MGSN11nYlwkJAoxFIm+O35WAPas6z5dULmzgbKsDJVNA 7VXg64nLIBzsLzuUhEh3MLUz7+dsfkBg0hppiQ/Z4qlYWrUuwXdPJaIwxpIAwEyIwR/J2 INVS0JXP64fZPuS8N1LlaTAY8v9cjCxY9XD+NQzOSvaa9ALLVo0Xr1NMCyd4q5qn24d3G oPwDszoyTNXG/FtpIS1IJnFUR99tAQULjZ/sR/uw8ikemKnqaUCA7yfqfD74o5/Jz6g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796287747; h=Received:DKIM-Signature:Received:Date:Message-ID:From:To:Cc:Subject: In-Reply-To:References:User-Agent:MIME-Version:Content-Type: X-SA-Exim-Connect-IP:X-SA-Exim-Rcpt-To:X-SA-Exim-Mail-From: X-SA-Exim-Scanned; bh=MjXVnvA+Arg56CbrGOUR551f5usN1T9fc9n6GR0dQdo=; b=SmFFZ/5oav6O8xUK+gDJ+5GizVNvjWdkex9SIHO8nFnTPtOZyYzDcy7OEbGCmHOK3C/L ne8NbjimvLbV+pYOO3CCTQ/miHv9P84/7zGs/cPD4kJndIV+XMPhHabvG2vkBFeKMlC18 iu+r1MqMSeI+WRrPxsWw5oDv93s5bQgQuOmQ9gDmBK1pXPCWTKjbIpS0BLBVt9eycisTZ 6r9MmENDCA7ujM8x2MmY0l5tZPy2XDgGcBmA9CmNqZOW48O3sCuEXLDWh/ORRMaWK0xFK qjiuhQk4Qioi55bO7jPdBDTctD0zHbb3x5CexIs2JP6MHECGL6jI2s8jHPbGamOufhw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=kWnJZs4X; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BCC3E606A322; Thu, 3 Dec 2026 08:49:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=kWnJZs4X Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4DDEB1F000C1; Thu, 3 Dec 2026 08:49:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796287747; bh=MjXVnvA+Arg56CbrGOUR551f5usN1T9fc9n6GR0dQdo=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=kWnJZs4Xk3oFuvFg4G2OdoPJY2Ax8w2PbE35oBGT4lYOZwK7qvfbooYH0VRwnV6t3 knewpyt4ltF1Tp27tdFwVKG/I57htTwuHg2BpcrD8Rs1oyVxDU8886M+TYGD/hG/Bz 7l6Kx9cW/DHmYsZF6NX7Z1QShegyu82+pBzM/4b6WMHkmyF77I6jZuUx0DRvVQXwM0 YPRizKW3XjwLCkBlNMDabbClgfVd/L77CL4QAS0AVRrzTEEjT3x+fJbInN8iRh7MO+ 7oMpuNRk9vOJIa9HAzCSibawnXv3bON0bNQShihXF9/jIBPIByh4H8UMvlFbvOcMp/ nFdoZQN4M/htA== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xZ2Uy-00000006UYX-2atx; Thu, 03 Dec 2026 08:49:04 +0000 Date: Thu, 03 Dec 2026 08:49:04 +0000 Message-ID: <867bhqycjj.wl-maz@kernel.org> From: Marc Zyngier To: Justin He Cc: "oupton@kernel.org" , "fuad.tabba@linux.dev" , Joey Gouly , "seiden@linux.ibm.com" , Suzuki Poulose , "yuzenghui@huawei.com" , Catalin Marinas , "will@kernel.org" , Mark Rutland , "pbonzini@redhat.com" , "seanjc@google.com" , "shuah@kernel.org" , "linux-arm-kernel@lists.infradead.org" , "kvmarm@lists.linux.dev" , "kvm@vger.kernel.org" , "linux-kselftest@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 In-Reply-To: References: <20261128011447.3588988-1-justin.he@arm.com> <20261128011447.3588988-5-justin.he@arm.com> <86a4mnycqc.wl-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) X-Mailing-List: kvm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: Justin.He@arm.com, oupton@kernel.org, fuad.tabba@linux.dev, Joey.Gouly@arm.com, seiden@linux.ibm.com, Suzuki.Poulose@arm.com, yuzenghui@huawei.com, Catalin.Marinas@arm.com, will@kernel.org, Mark.Rutland@arm.com, pbonzini@redhat.com, seanjc@google.com, shuah@kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Thu, 03 Dec 2026 02:32:23 +0000, Justin He 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.