From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B4FED17C7C9; Tue, 10 Sep 2024 20:27:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726000070; cv=none; b=hIxLpeY6UKPrxqP6QTAVAUg8xIRsHNiaeTRYfV076T2pBjh2yscyMTc2iLeeRXucY+khSyrxuqy/t17bw3AFKyXI8Zm+sR5aFEtY0surs3SOBl+v/7d/hxeYdYb4uZAAEwIdwXXYLEaol7oRRi7iXqUkZUOexGtAFWPolA9ieLI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726000070; c=relaxed/simple; bh=F1/9VLarbTJ9VCxON6d1CtL/BQZZi7nOBEwpu4FUHaA=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=sy52HVe2ZVET8iPLl81U3tycZDlQCcOazXtQz6qIZAKMjBNybPTYsYCkZCt1hK2s6DBMG4haEIEBFHpLnhNPNABCLDS06R7B+bLAIJzKaRtskqndCrI7kuQnoT7M8b1iy1k8CID8LrpUkUb1nZBNECfQg87pqx/jma6cKDFBokc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=A33fyGBi; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="A33fyGBi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87540C4CEC3; Tue, 10 Sep 2024 20:27:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1726000070; bh=F1/9VLarbTJ9VCxON6d1CtL/BQZZi7nOBEwpu4FUHaA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=A33fyGBijBMkVnizFcOT9RMyk3X4W5JkxFmasSOR/p0mBtCxuWRSvb6DvtBdETrGm pvBoFWjtYWd23vigu96nDocpSRQDf4tAkALbcIzMCLh3Gep1c6ZDQLquA4kbNrhYdQ Vy2iJyj125yym7qJ/UDZl+iViuRuAfLnJW3vTseIKaD+9hqQLbcYD/tARb5wYzVsCY VU/GBqakb7x3YFe3kxguXRH1jUq23zYIPY6Qp4tu5AUI8UUX+ZxOxQlWegxbZwS51C tljaJjvhbk5RnSnNDMRMUh9KVNLdDtZNPub4pTLmaagHqIJDJyO1Ep4Ja6Q/52BK6+ 1oaxqUo2UPZpg== 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 1so7Sm-00BsCg-Am; Tue, 10 Sep 2024 21:27:48 +0100 Date: Tue, 10 Sep 2024 21:27:47 +0100 Message-ID: <86plpb6ypo.wl-maz@kernel.org> From: Marc Zyngier To: Sebastian Ene Cc: akpm@linux-foundation.org, alexghiti@rivosinc.com, ankita@nvidia.com, ardb@kernel.org, catalin.marinas@arm.com, christophe.leroy@csgroup.eu, james.morse@arm.com, vdonnefort@google.com, mark.rutland@arm.com, oliver.upton@linux.dev, rananta@google.com, ryan.roberts@arm.com, shahuang@redhat.com, suzuki.poulose@arm.com, will@kernel.org, yuzenghui@huawei.com, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-team@android.com Subject: Re: [PATCH v10 5/5] KVM: arm64: Register ptdump with debugfs on guest creation In-Reply-To: <20240909124721.1672199-6-sebastianene@google.com> References: <20240909124721.1672199-1-sebastianene@google.com> <20240909124721.1672199-6-sebastianene@google.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/29.4 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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: sebastianene@google.com, akpm@linux-foundation.org, alexghiti@rivosinc.com, ankita@nvidia.com, ardb@kernel.org, catalin.marinas@arm.com, christophe.leroy@csgroup.eu, james.morse@arm.com, vdonnefort@google.com, mark.rutland@arm.com, oliver.upton@linux.dev, rananta@google.com, ryan.roberts@arm.com, shahuang@redhat.com, suzuki.poulose@arm.com, will@kernel.org, yuzenghui@huawei.com, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Mon, 09 Sep 2024 13:47:21 +0100, Sebastian Ene wrote: > > While arch/*/mem/ptdump handles the kernel pagetable dumping code, > introduce KVM/ptdump to show the guest stage-2 pagetables. The > separation is necessary because most of the definitions from the > stage-2 pagetable reside in the KVM path and we will be invoking > functionality specific to KVM. Introduce the PTDUMP_STAGE2_DEBUGFS config. > > When a guest is created, register a new file entry under the guest > debugfs dir which allows userspace to show the contents of the guest > stage-2 pagetables when accessed. > > Signed-off-by: Sebastian Ene > Reviewed-by: Vincent Donnefort > --- > arch/arm64/include/asm/kvm_host.h | 6 + > arch/arm64/kvm/Kconfig | 17 ++ > arch/arm64/kvm/Makefile | 1 + > arch/arm64/kvm/arm.c | 1 + > arch/arm64/kvm/ptdump.c | 268 ++++++++++++++++++++++++++++++ > 5 files changed, 293 insertions(+) > create mode 100644 arch/arm64/kvm/ptdump.c > > diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h > index a33f5996ca9f..4acd589f086b 100644 > --- a/arch/arm64/include/asm/kvm_host.h > +++ b/arch/arm64/include/asm/kvm_host.h > @@ -1473,4 +1473,10 @@ void kvm_set_vm_id_reg(struct kvm *kvm, u32 reg, u64 val); > (pa + pi + pa3) == 1; \ > }) > > +#ifdef CONFIG_PTDUMP_STAGE2_DEBUGFS > +void kvm_s2_ptdump_create_debugfs(struct kvm *kvm); > +#else > +static inline void kvm_s2_ptdump_create_debugfs(struct kvm *kvm) {} > +#endif /* CONFIG_PTDUMP_STAGE2_DEBUGFS */ > + I made the executive decision to move this to kvm_mmu.h, as this is slightly more logical. Thanks, M. -- Without deviation from the norm, progress is not possible.