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 mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by smtp.lore.kernel.org (Postfix) with ESMTP id 607E1C433EF for ; Mon, 29 Nov 2021 18:12:53 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id D5A3F4B1AA; Mon, 29 Nov 2021 13:12:52 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@kernel.org Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Vyx9C1E3B2Fr; Mon, 29 Nov 2021 13:12:51 -0500 (EST) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 895444B1AB; Mon, 29 Nov 2021 13:12:51 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 293344B1A9 for ; Mon, 29 Nov 2021 13:12:50 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bavB9+nTaQqo for ; Mon, 29 Nov 2021 13:12:49 -0500 (EST) Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id A86FB4B0E1 for ; Mon, 29 Nov 2021 13:12:48 -0500 (EST) 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 sin.source.kernel.org (Postfix) with ESMTPS id 393D2CE13C7; Mon, 29 Nov 2021 18:12:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68732C53FC7; Mon, 29 Nov 2021 18:12:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1638209563; bh=vt+bCjT54jnhEeJkuJHIggsLka/2q/tr/Bf8TSjbSSw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=MPWv1s2hDNbos+VP+oWbMhK59eGz/ddvi5GXTo2nvaO7h4MvAmJXAJzB766RKNsbl 5+Bt7NTPIW2esg9KESWbl0r/U9+ZxElKbrgViZ8hJjz2vuLZhno1uZmxvrGZuMRPIM cWLx90DPxkWR3xFqc/IHqgUKAnP5Tm7jSG9FMBjH8FurrtU+DXrAJ3FI8jcm2QaTMm AjdCMTSW5rd6oLCflNCkgkZUheU6YnikuxQnOZHwEPgX4uhlkzJJYrfeSbCCHFeH2h te9gbNt+pcUoVAOaQvL7yn6fqCzJFhKpP5940v1AjUbNYeVHWrjx1CF+aSf9QOefSc 0zYIAtQvgYHWg== Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mrl8r-008ewb-69; Mon, 29 Nov 2021 18:12:41 +0000 Date: Mon, 29 Nov 2021 18:12:40 +0000 Message-ID: <87o862n84n.wl-maz@kernel.org> From: Marc Zyngier To: Chase Conklin Subject: Re: [PATCH v4 41/66] KVM: arm64: nv: Trap and emulate TLBI instructions from virtual EL2 In-Reply-To: <20210714164002.84527-1-chase.conklin@arm.com> References: <20210510165920.1913477-42-maz@kernel.org> <20210714164002.84527-1-chase.conklin@arm.com> 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/27.1 (x86_64-pc-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: chase.conklin@arm.com, alexandru.elisei@arm.com, andre.przywara@arm.com, christoffer.dall@arm.com, haibo.xu@linaro.org, james.morse@arm.com, jintack.lim@linaro.org, jintack@cs.columbia.edu, kernel-team@android.com, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, suzuki.poulose@arm.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Cc: kernel-team@android.com, kvm@vger.kernel.org, andre.przywara@arm.com, christoffer.dall@arm.com, kvmarm@lists.cs.columbia.edu, jintack.lim@linaro.org, linux-arm-kernel@lists.infradead.org X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu Hi Chase, Yes, it took that long for me to get back to the NV series. Sorry about that. On Wed, 14 Jul 2021 17:40:03 +0100, Chase Conklin wrote: > I'm noticing a hang while an L2 is booting. From what I can tell, the > L0 is issuing TLBIs to the wrong VMID, so the L2 is getting stuck > taking the same abort repeatedly. > > It seems that kvm_unmap_stage2_range doesn't perform the invalidations > using the mmu passed to it here. Instead, it uses the passed mmu to > get back the kvm before passing that to stage2_apply_range which gets > its mmu from kvm->arch.mmu. This has the effect of applying > invalidations intended for the nested stage-2 of the L2 onto the > stage-2 for the L1. > > It also turns out that for the L2, the mmu != mmu->pgt->mmu. This is > because pgt->mmu is always set to &kvm->arch.mmu by > kvm_pgtable_stage2_init_flags. This too will cause the VMID for the > TLBI to be incorrect because the stage2_unmap_walker gets its mmu from > the pgt passed to it. Yup, and Ganapatrao noticed the same thing[1] (I obviously botched the conversion to the new pgtable code). I *think* this is now fixed in my nv-5.16 branch, but I'd really appreciate if you could have a look. Bonus points if you have access to actual HW (even in emulation), as doing this on the model is majorly frustrating. Thanks, M. [1] https://lore.kernel.org/r/20211122095803.28943-1-gankulkarni@os.amperecomputing.com -- Without deviation from the norm, progress is not possible. _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E663EC433F5 for ; Mon, 29 Nov 2021 18:14:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349784AbhK2SSG (ORCPT ); Mon, 29 Nov 2021 13:18:06 -0500 Received: from sin.source.kernel.org ([145.40.73.55]:45146 "EHLO sin.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345452AbhK2SQE (ORCPT ); Mon, 29 Nov 2021 13:16:04 -0500 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 sin.source.kernel.org (Postfix) with ESMTPS id 6E77ECE13CF for ; Mon, 29 Nov 2021 18:12:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68732C53FC7; Mon, 29 Nov 2021 18:12:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1638209563; bh=vt+bCjT54jnhEeJkuJHIggsLka/2q/tr/Bf8TSjbSSw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=MPWv1s2hDNbos+VP+oWbMhK59eGz/ddvi5GXTo2nvaO7h4MvAmJXAJzB766RKNsbl 5+Bt7NTPIW2esg9KESWbl0r/U9+ZxElKbrgViZ8hJjz2vuLZhno1uZmxvrGZuMRPIM cWLx90DPxkWR3xFqc/IHqgUKAnP5Tm7jSG9FMBjH8FurrtU+DXrAJ3FI8jcm2QaTMm AjdCMTSW5rd6oLCflNCkgkZUheU6YnikuxQnOZHwEPgX4uhlkzJJYrfeSbCCHFeH2h te9gbNt+pcUoVAOaQvL7yn6fqCzJFhKpP5940v1AjUbNYeVHWrjx1CF+aSf9QOefSc 0zYIAtQvgYHWg== Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mrl8r-008ewb-69; Mon, 29 Nov 2021 18:12:41 +0000 Date: Mon, 29 Nov 2021 18:12:40 +0000 Message-ID: <87o862n84n.wl-maz@kernel.org> From: Marc Zyngier To: Chase Conklin Cc: alexandru.elisei@arm.com, andre.przywara@arm.com, christoffer.dall@arm.com, haibo.xu@linaro.org, james.morse@arm.com, jintack.lim@linaro.org, jintack@cs.columbia.edu, kernel-team@android.com, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, suzuki.poulose@arm.com Subject: Re: [PATCH v4 41/66] KVM: arm64: nv: Trap and emulate TLBI instructions from virtual EL2 In-Reply-To: <20210714164002.84527-1-chase.conklin@arm.com> References: <20210510165920.1913477-42-maz@kernel.org> <20210714164002.84527-1-chase.conklin@arm.com> 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/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) 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: chase.conklin@arm.com, alexandru.elisei@arm.com, andre.przywara@arm.com, christoffer.dall@arm.com, haibo.xu@linaro.org, james.morse@arm.com, jintack.lim@linaro.org, jintack@cs.columbia.edu, kernel-team@android.com, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, suzuki.poulose@arm.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Hi Chase, Yes, it took that long for me to get back to the NV series. Sorry about that. On Wed, 14 Jul 2021 17:40:03 +0100, Chase Conklin wrote: > I'm noticing a hang while an L2 is booting. From what I can tell, the > L0 is issuing TLBIs to the wrong VMID, so the L2 is getting stuck > taking the same abort repeatedly. > > It seems that kvm_unmap_stage2_range doesn't perform the invalidations > using the mmu passed to it here. Instead, it uses the passed mmu to > get back the kvm before passing that to stage2_apply_range which gets > its mmu from kvm->arch.mmu. This has the effect of applying > invalidations intended for the nested stage-2 of the L2 onto the > stage-2 for the L1. > > It also turns out that for the L2, the mmu != mmu->pgt->mmu. This is > because pgt->mmu is always set to &kvm->arch.mmu by > kvm_pgtable_stage2_init_flags. This too will cause the VMID for the > TLBI to be incorrect because the stage2_unmap_walker gets its mmu from > the pgt passed to it. Yup, and Ganapatrao noticed the same thing[1] (I obviously botched the conversion to the new pgtable code). I *think* this is now fixed in my nv-5.16 branch, but I'd really appreciate if you could have a look. Bonus points if you have access to actual HW (even in emulation), as doing this on the model is majorly frustrating. Thanks, M. [1] https://lore.kernel.org/r/20211122095803.28943-1-gankulkarni@os.amperecomputing.com -- Without deviation from the norm, progress is not possible. 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 2D1C2C4332F for ; Mon, 29 Nov 2021 18:14:29 +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=l4q+EBKj4GsIAuijWWcNT81zz7hzxMSOlW0XMkpHt5k=; b=FYtKir/dXTQymz gZ8bRmmo2qB6gH0EBgqYSO0auX/frVYTM4inXgluqI2YvNjHwoQL7fNJieA6UoyeR8FDlLVHmHIB9 xNH+YGY6c7tLyxtsgyXOJdsrW3shedJKlikeeeMOUX1RR777078jD03S0//+zEYMUE3DSu/julgxd VBu/TsJCl17zFduhsJ1N2GcQAwlRzsY3Ndvp4M8c9TSS6MY0hWx8CHrKivWg2yiSnaELHu6MA49pZ keBvy0XvthEdy3+wTKJf0hrnVW23katIzkRWtMIWyw7AeMcDDdXJV6cu65mseLTRLanKCcoZE4h+b gmt7/oIWNYTR5jO17QKw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mrl91-001iv1-CV; Mon, 29 Nov 2021 18:12:51 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mrl8x-001iuO-TV for linux-arm-kernel@lists.infradead.org; Mon, 29 Nov 2021 18:12:49 +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 sin.source.kernel.org (Postfix) with ESMTPS id 393D2CE13C7; Mon, 29 Nov 2021 18:12:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68732C53FC7; Mon, 29 Nov 2021 18:12:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1638209563; bh=vt+bCjT54jnhEeJkuJHIggsLka/2q/tr/Bf8TSjbSSw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=MPWv1s2hDNbos+VP+oWbMhK59eGz/ddvi5GXTo2nvaO7h4MvAmJXAJzB766RKNsbl 5+Bt7NTPIW2esg9KESWbl0r/U9+ZxElKbrgViZ8hJjz2vuLZhno1uZmxvrGZuMRPIM cWLx90DPxkWR3xFqc/IHqgUKAnP5Tm7jSG9FMBjH8FurrtU+DXrAJ3FI8jcm2QaTMm AjdCMTSW5rd6oLCflNCkgkZUheU6YnikuxQnOZHwEPgX4uhlkzJJYrfeSbCCHFeH2h te9gbNt+pcUoVAOaQvL7yn6fqCzJFhKpP5940v1AjUbNYeVHWrjx1CF+aSf9QOefSc 0zYIAtQvgYHWg== Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mrl8r-008ewb-69; Mon, 29 Nov 2021 18:12:41 +0000 Date: Mon, 29 Nov 2021 18:12:40 +0000 Message-ID: <87o862n84n.wl-maz@kernel.org> From: Marc Zyngier To: Chase Conklin Cc: alexandru.elisei@arm.com, andre.przywara@arm.com, christoffer.dall@arm.com, haibo.xu@linaro.org, james.morse@arm.com, jintack.lim@linaro.org, jintack@cs.columbia.edu, kernel-team@android.com, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, suzuki.poulose@arm.com Subject: Re: [PATCH v4 41/66] KVM: arm64: nv: Trap and emulate TLBI instructions from virtual EL2 In-Reply-To: <20210714164002.84527-1-chase.conklin@arm.com> References: <20210510165920.1913477-42-maz@kernel.org> <20210714164002.84527-1-chase.conklin@arm.com> 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/27.1 (x86_64-pc-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: chase.conklin@arm.com, alexandru.elisei@arm.com, andre.przywara@arm.com, christoffer.dall@arm.com, haibo.xu@linaro.org, james.morse@arm.com, jintack.lim@linaro.org, jintack@cs.columbia.edu, kernel-team@android.com, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, suzuki.poulose@arm.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-20211129_101248_354603_78D8ACC3 X-CRM114-Status: GOOD ( 21.66 ) 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 Hi Chase, Yes, it took that long for me to get back to the NV series. Sorry about that. On Wed, 14 Jul 2021 17:40:03 +0100, Chase Conklin wrote: > I'm noticing a hang while an L2 is booting. From what I can tell, the > L0 is issuing TLBIs to the wrong VMID, so the L2 is getting stuck > taking the same abort repeatedly. > > It seems that kvm_unmap_stage2_range doesn't perform the invalidations > using the mmu passed to it here. Instead, it uses the passed mmu to > get back the kvm before passing that to stage2_apply_range which gets > its mmu from kvm->arch.mmu. This has the effect of applying > invalidations intended for the nested stage-2 of the L2 onto the > stage-2 for the L1. > > It also turns out that for the L2, the mmu != mmu->pgt->mmu. This is > because pgt->mmu is always set to &kvm->arch.mmu by > kvm_pgtable_stage2_init_flags. This too will cause the VMID for the > TLBI to be incorrect because the stage2_unmap_walker gets its mmu from > the pgt passed to it. Yup, and Ganapatrao noticed the same thing[1] (I obviously botched the conversion to the new pgtable code). I *think* this is now fixed in my nv-5.16 branch, but I'd really appreciate if you could have a look. Bonus points if you have access to actual HW (even in emulation), as doing this on the model is majorly frustrating. Thanks, M. [1] https://lore.kernel.org/r/20211122095803.28943-1-gankulkarni@os.amperecomputing.com -- 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