From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 18EF0606A32C for ; Thu, 3 Dec 2026 08:49:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=Yw8/zPJL; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=kWnJZs4X DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=MjXVnvA+Arg56CbrGOUR551f5usN1T9fc9n6GR0dQdo=; b=Yw8/zPJLybNfa4vYsA0Ynvix00 H6WB7CnISspDqEyMzkxzrlQASABekZMFzVgwQKMo719SlgxXcVAbp/dHe0lrlfI1uhCS44ijg6mwA Po5Ku7w0Xc1DQzcGakIMONT4yli2X0N8hCu31ycv2YIM75Ln4VXsbw26OT/IWfnI58gNqvy2hetVY gaKPeP80Jd6xLZ3GIMCPzHDoHdDhCAxVtosb5Ujh37Zjr8XRytO9cEFVY5RAA/Uq/dwtd4sBWIoYj VHF0im04VzW0INrzZNatv39EkrUCKSIiSEyLeWbkjbA46eKccoa/tsgKWUQHeJhOM5N2/kYayHleO anZBz+/A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZ2V3-0000000Du0h-32OU; Thu, 03 Dec 2026 08:49:09 +0000 Received: from tor.source.kernel.org ([172.105.4.254]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZ2V2-0000000Du0V-1moh for linux-arm-kernel@lists.infradead.org; Thu, 03 Dec 2026 08:49:08 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 990DB60052; Thu, 3 Dec 2026 08:49:07 +0000 (UTC) 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-Archived-By: 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 X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-10.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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.