From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C2B79C6FD1F for ; Tue, 26 Mar 2024 09:35:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bm2l4IzzOYZipQe6I4adg4EoHRddQ9WCOQmMUkka2is=; b=YZ5Ml+9T3mrO9X h8z3r0elhZIj7xc38pYREfwy7T/xgJJya8HleTSlboZpWaZv/zCkFhj2mHC8cEYBjeHtHYtwf8nsu UPspfWTaNEXjDY2dEGf6jF03UltclDhooOMOxR7+NQCTBR2G+1pFV2tEaPtOCLwU7k+FBk9hq1Uog KNjmUtQr1kN3/Ctrh126K0Z98MVVM2rpYz/PLYNcPASvhA+6BMSVShp8O/S5ftawWqHr6tyqIfI15 hBloo3Org3ShKsF2ngMJE0DoDZ6wN1ZQkI6fFW3NkkfoKU07/vU+b4noAnxH4rmV3doStD7tqgnTw pzLXhJE1yNvnW2qevqaA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rp3CL-00000003qAu-3wOb; Tue, 26 Mar 2024 09:34:25 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rp3CJ-00000003q9W-00LV for linux-arm-kernel@lists.infradead.org; Tue, 26 Mar 2024 09:34:24 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 5331E609FB; Tue, 26 Mar 2024 09:34:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DEB4C433F1; Tue, 26 Mar 2024 09:34:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711445662; bh=AZ7WhVjfVF9+3PXLZJemfpeJ0K4DmTvVso6Twrnixps=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=P2aSG/SNF26qR8hi6z+BJidIN+uX4e0bgXQvmftxmQgYQ60S4N/CPMeggw2N4kNaU cvdJuJflQrdv7QnAQ11I98AcZ878fT3PBwZhlbyebgbBpylLeIUUgLJn67wyscgtOf 7id6ta27MYJ4SW8PurdqMSFZj0TyuXXYSgj6OZ5YJgx/8pcxB4uvg0ZYBKGz7ivKeW igJi4dtA3FnUJZZN9k2DRWJ6Qo7lSQm96NWS0oWx2JrNz2loVLnZe254n+k5WjnddS 6IeBA5jzhfPxW2M2FCEMCoXW5+R9+pBizGaEsF2X51nQYSEiQ9M4lBoSTJrduSAjUV B+ehmrZLcBtog== Date: Tue, 26 Mar 2024 09:34:16 +0000 From: Will Deacon To: Oliver Upton Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, Catalin Marinas , Gavin Shan , Marc Zyngier , Mostafa Saleh , Quentin Perret , Raghavendra Rao Ananta , Ryan Roberts , Shaoqin Huang , Suzuki K Poulose , Zenghui Yu Subject: Re: [PATCH 2/3] KVM: arm64: Don't pass a TLBI level hint when zapping table entries Message-ID: <20240326093415.GA9216@willie-the-truck> References: <20240325185158.8565-1-will@kernel.org> <20240325185158.8565-3-will@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240326_023423_116849_6EC321A7 X-CRM114-Status: GOOD ( 18.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Mar 26, 2024 at 01:37:43AM -0700, Oliver Upton wrote: > On Mon, Mar 25, 2024 at 06:51:57PM +0000, Will Deacon wrote: > > The TLBI level hints are for leaf entries only, so take care not to pass > > them incorrectly after clearing a table entry. > > > > Cc: Gavin Shan > > Cc: Marc Zyngier > > Cc: Quentin Perret > > Fixes: 82bb02445de5 ("KVM: arm64: Implement kvm_pgtable_hyp_unmap() at EL2") > > Fixes: 6d9d2115c480 ("KVM: arm64: Add support for stage-2 map()/unmap() in generic page-table") > > Signed-off-by: Will Deacon > > --- > > arch/arm64/kvm/hyp/pgtable.c | 12 +++++++----- > > 1 file changed, 7 insertions(+), 5 deletions(-) > > > > diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c > > index de0b667ba296..a40dafc43bb6 100644 > > --- a/arch/arm64/kvm/hyp/pgtable.c > > +++ b/arch/arm64/kvm/hyp/pgtable.c > > @@ -528,7 +528,7 @@ static int hyp_unmap_walker(const struct kvm_pgtable_visit_ctx *ctx, > > > > kvm_clear_pte(ctx->ptep); > > dsb(ishst); > > - __tlbi_level(vae2is, __TLBI_VADDR(ctx->addr, 0), ctx->level); > > + __tlbi_level(vae2is, __TLBI_VADDR(ctx->addr, 0), TLBI_TTL_UNKNOWN); > > } else { > > if (ctx->end - ctx->addr < granule) > > return -EINVAL; > > @@ -896,10 +896,12 @@ static void stage2_unmap_put_pte(const struct kvm_pgtable_visit_ctx *ctx, > > if (kvm_pte_valid(ctx->old)) { > > kvm_clear_pte(ctx->ptep); > > > > - if (!stage2_unmap_defer_tlb_flush(pgt) || > > - kvm_pte_table(ctx->old, ctx->level)) { > > - kvm_call_hyp(__kvm_tlb_flush_vmid_ipa, mmu, > > - ctx->addr, ctx->level); > > + if (kvm_pte_table(ctx->old, ctx->level)) { > > + kvm_call_hyp(__kvm_tlb_flush_vmid_ipa, mmu, ctx->addr, > > + TLBI_TTL_UNKNOWN); > > Ah, here it is! Can you add this invalidation to patch #1? Otherwise the > fix will intermediately introduce another bug, AFAICT. Heh, well I'd argue that bug already exists in the case that TLB invalidation isn't deferred, so that's why I kept them separate. But happy to fold in if you prefer. Main thing is to get it fixed! Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel