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 C03DAC433EF for ; Thu, 25 Nov 2021 13:52:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355544AbhKYNzO (ORCPT ); Thu, 25 Nov 2021 08:55:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:60586 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355330AbhKYNxN (ORCPT ); Thu, 25 Nov 2021 08:53:13 -0500 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4CAFE60EB5; Thu, 25 Nov 2021 13:50:02 +0000 (UTC) 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 1mqF8R-007oqV-So; Thu, 25 Nov 2021 13:50:00 +0000 Date: Thu, 25 Nov 2021 13:49:59 +0000 Message-ID: <87bl28cpko.wl-maz@kernel.org> From: Marc Zyngier To: Ganapatrao Kulkarni Cc: catalin.marinas@arm.com, will@kernel.org, andre.przywara@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, darren@os.amperecomputing.com, d.scott.phillips@amperecomputing.com, Quentin Perret Subject: Re: [PATCH 1/2] KVM: arm64: Use appropriate mmu pointer in stage2 page table init. In-Reply-To: <20211122095803.28943-2-gankulkarni@os.amperecomputing.com> References: <20211122095803.28943-1-gankulkarni@os.amperecomputing.com> <20211122095803.28943-2-gankulkarni@os.amperecomputing.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: gankulkarni@os.amperecomputing.com, catalin.marinas@arm.com, will@kernel.org, andre.przywara@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, darren@os.amperecomputing.com, d.scott.phillips@amperecomputing.com, qperret@google.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 [+ Quentin] Hi Ganapatro, On Mon, 22 Nov 2021 09:58:02 +0000, Ganapatrao Kulkarni wrote: > > The kvm_pgtable_stage2_init/kvm_pgtable_stage2_init_flags function > assume arch->mmu is same across all stage 2 mmu and initializes > the pgt(page table) using arch->mmu. > Using armc->mmu is not appropriate when nested virtualization is enabled > since there are multiple stage 2 mmu tables are initialized to manage > Guest-Hypervisor as well as Nested VM for the same vCPU. > > Add a mmu argument to kvm_pgtable_stage2_init that can be used during > initialization. This patch is a preparatory patch for the > nested virtualization series and no functional changes. Thanks for having had a look, and for the analysis. This is obviously a result of a hasty conversion to the 'new' page table code, and a total oversight on my part. I'm however not particularly thrilled with the approach you have taken though, as carrying both the kvm->arch pointer *and* the mmu pointer seems totally redundant (the mmu structure already has a backpointer to kvm->arch or its pkvm equivalent). All we need is to rework the initialisation for this pointer to be correct at the point of where we follow it first. I've pushed out my own version of this[1]. Please have a look. Thanks, M. [1] https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git/commit/?h=kvm-arm64/nv-5.16-WIP&id=21790a24d88c3ed37989533709dad3d40905f5c3 -- Without deviation from the norm, progress is not possible.