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 A9221CD11DD for ; Tue, 26 Mar 2024 13:13:31 +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=g5WG0FhpbWg6Rgkmghgd9EfkQxNTPBGR0lUlA0TAb00=; b=OMbmmTtIPTzUzs FdkmT50Qx2kLcLCoKGrjiFiLC8r5eiLunMFEQDbsYRfsrpY5pUavDEDjejVu8NSUdlinoaxLMygjZ SIaPTeqLxqRh11jPKHZk2HmDV02d+hxxQAT/Iyw3x9pxv1L9X8VPY/Qw556pAp1SFNp9CAo21fe2+ giyweVw7M2jxPi3YX6d72YF6S21/Jw2fDc1n+RjXgaEIPbUvmoA2MqOwCjQMPk52dNj93HDTIDX6i GTgbLSF50hDPcOyWjCjpb4+pTPq8bUQzNLvid0mtLbqT5vr30roHKH6QXt9iqG/Z4hOWIa8QW28if tVQRmEf57xOvkgNyYQbQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rp6cA-00000004bpP-1xe0; Tue, 26 Mar 2024 13:13:18 +0000 Received: from out-180.mta1.migadu.com ([2001:41d0:203:375::b4]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rp6c4-00000004bo4-2rxf for linux-arm-kernel@lists.infradead.org; Tue, 26 Mar 2024 13:13:17 +0000 Date: Tue, 26 Mar 2024 06:12:55 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1711458786; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=5suALL5bYJBXW2Jp0/15k9lhoJmOs5VMMCmUrHyEkD4=; b=JHKs+qgcDn7cmoqUcn4GpkP3j/RnmWSuEVHBiWOz/USEz5snhkdm0GCqKoC7095L6z4qte XFGN9Bm6bN5F/XPgSIMd/JIlHpzofls2DMegQuxILpLRQDRbEZsRmgJ0kvISYJBVgTbFQq Bow5YKYslVo8chZ8S1U+RcpExoAagPQ= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Will Deacon 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: References: <20240325185158.8565-1-will@kernel.org> <20240325185158.8565-3-will@kernel.org> <20240326093415.GA9216@willie-the-truck> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240326093415.GA9216@willie-the-truck> X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240326_061313_105590_ABF48B59 X-CRM114-Status: GOOD ( 21.75 ) 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 09:34:16AM +0000, Will Deacon wrote: > 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. Ah, that's fine, when I was looking at this earlier I thought this patch was getting blamed on LPA2, although patch #1 needs to go a bit further back. I'm fine with this as is, but maybe add a blurb to the changelog hinting that the level hint is BS but will be fixed in a future change. -- Thanks, Oliver _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel