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 A4CE6C77B6E for ; Fri, 14 Apr 2023 07:25:11 +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:MIME-Version:References:In-Reply-To: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=DcEXYYUIOd9963EeHSN28vbO7D2HO1sX74vzkrt3Onc=; b=s/JJaRQv5U4IjR 4+Lpexz0BL5gqp75PQjCXtF0pu3uT0xQFzZFy97JRpP+N4NBD6p4AY0jcZSe8Yq+vrAkf3VdBKvX5 AnZhAAJxV0RaYiUTfClpCHvaShe4LK8uwqli2Ezq0Rl9PN/0UxvIS3Kv/XvQP9Xls90eVMTM0Sidd dWqyNaRMSxc9x6d0GITO+NemsdGEQDkQLE/MaoGawtIRLMO9hdnt2cGHZRI/cFPP7JV/rtvEahK9D WtmSnSkfLBq3YEWCwVtw9onBH9Uofku84JyN3nOvd8Ec5MWrwqyBPU1W3DprwGSu9L1VmLbeTe9Ym Y7zxGQ4tGFnSmToaXyQQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pnDn7-008XYf-2A; Fri, 14 Apr 2023 07:24:17 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pnDn2-008XXk-09 for linux-arm-kernel@lists.infradead.org; Fri, 14 Apr 2023 07:24:16 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4F4E0614F1; Fri, 14 Apr 2023 07:24:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82767C4339B; Fri, 14 Apr 2023 07:24:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681457050; bh=9Mqga408RSOH6xz8vS2LLAa2WbQArV231/GUK7apgDg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=JPUu0dKaIGNM422WiDrADq4O6ND6FKKb1nBIsZQfoVlhmrvi3fQq6jezs6CbevXRH 1MWKMnvp9B5XEwihESJ2A9rNHbUPpcgxXUYcXC2U8Y4QsVspYSTVFl2VIWcdI/okKU wpuGcBLTZ+SD++2wVnaJozTY18mof6AmkufCQm/r3bXbzxLIJ0ZlstkcnIl/5gfU/C mhVzDXtd27NCI6fpfNo3Kja6rm4kyRiBplIsJ4Gp+PMD3BQn7gD++tqSUTI/x2gejE kJ9Vc3T3CAa9ujRk/ukzwEfB4wYVbktzPL3Z7OBY+IV4IrBTitbuEZm/8WRNJp0vdn greb83zSiakOQ== 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.95) (envelope-from ) id 1pnDmy-008HVG-3T; Fri, 14 Apr 2023 08:24:08 +0100 Date: Fri, 14 Apr 2023 08:24:07 +0100 Message-ID: <86fs93kju0.wl-maz@kernel.org> From: Marc Zyngier To: Oliver Upton Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, James Morse , Suzuki K Poulose , Zenghui Yu , Will Deacon , Ricardo Koller Subject: Re: [PATCH v3 2/5] KVM: arm64: nvhe: Synchronise with page table walker on TLBI In-Reply-To: References: <20230413081441.165134-1-maz@kernel.org> <20230413081441.165134-3-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/28.2 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: oliver.upton@linux.dev, kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, james.morse@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, will@kernel.org, ricarkol@google.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230414_002412_159187_9A3D552A X-CRM114-Status: GOOD ( 28.89 ) 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 Thu, 13 Apr 2023 16:53:04 +0100, Oliver Upton wrote: > > On Thu, Apr 13, 2023 at 09:14:38AM +0100, Marc Zyngier wrote: > > A TLBI from EL2 impacting EL1 involves messing with the EL1&0 > > translation regime, and the page table walker may still be > > performing speculative walks. > > > > Piggyback on the existing DSBs to always have a DSB ISH that > > will synchronise all load/store operations that the PTW may > > still have. > > > > Signed-off-by: Marc Zyngier > > Reviewed-by: Oliver Upton Thanks! > > > --- > > arch/arm64/kvm/hyp/nvhe/tlb.c | 38 ++++++++++++++++++++++++++--------- > > 1 file changed, 29 insertions(+), 9 deletions(-) > > > > diff --git a/arch/arm64/kvm/hyp/nvhe/tlb.c b/arch/arm64/kvm/hyp/nvhe/tlb.c > > index d296d617f589..1da2fc35f94e 100644 > > --- a/arch/arm64/kvm/hyp/nvhe/tlb.c > > +++ b/arch/arm64/kvm/hyp/nvhe/tlb.c > > @@ -15,8 +15,31 @@ struct tlb_inv_context { > > }; > > > > static void __tlb_switch_to_guest(struct kvm_s2_mmu *mmu, > > - struct tlb_inv_context *cxt) > > + struct tlb_inv_context *cxt, > > + bool nsh) > > { > > + /* > > + * We have two requirements: > > + * > > + * - ensure that the page table updates are visible to all > > + * CPUs, for which a dsb(DOMAIN-st) is what we need, DOMAIN > > + * being either ish or nsh, depending on the invalidation > > + * type. > > + * > > + * - complete any speculative page table walk started before > > + * we trapped to EL2 so that we can mess with the MM > > + * registers out of context, for which dsb(nsh) is enough > > Looks like a few of these lines are indented with spaces, not tabs. Mind > fixing this when you apply the patches? Ah, well spotted. Now fixed. Cheers, M. -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel