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 B6CFCECE582 for ; Tue, 10 Sep 2024 17:02:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=EA6VNuGzG17LiPCZK+aqRo3QHbsUuV6eumr1ieEuCe0=; b=1v6LMUuNLqYmd7sm9GhnxF8Eyd RpPECHNQf3QI4gnKIcCZqrY/pu712CfikG0RQ7m3ioPmVay0KCXZOZgvlIj/Nxc0t4Lxs6wwO48ok AanB14MR6i7jS/pHzAI8WWEGzpsJYdpgkzC8V7XcY7hTZBKcNG/jDB7oJehWnd9wn7PcQnYaRbMoO YmqRmH6SRfsDO7o7U9z9KK43UONg/ThZVObyeIZKKWuSCHmZyrqlddLJxd0k2sOVfKM710s2kDLq8 ryEv8QOIRzs7zPebbl0QKlDqpbL/6PP7gLb2K7MPcivvzJ7jr8ElB220oTR2zgl40EikLjZ/bzYzV sXiwVrIA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1so4Fz-00000006S4F-1Uhi; Tue, 10 Sep 2024 17:02:23 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1so4DW-00000006RcW-3vJV for linux-arm-kernel@lists.infradead.org; Tue, 10 Sep 2024 16:59:52 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 9B0995C0360; Tue, 10 Sep 2024 16:59:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2F4CC4CEC3; Tue, 10 Sep 2024 16:59:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725987589; bh=3wuFIoLr691b/skwnVl1HScAP75KBHcXvy/8/CQt2WQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=rMWgz2BD95r+OzSxcnV1ug802GJby0Nl3G+E7GaDhe2myIcFLUMgUAcy83hFvvyYv 49QXK+X0dNKojqKsAVOXx7g58v01C4nXNCmrBpY35i0vjwHH3wsP6NFCg8Cpsvi51c D5Uc16seSI3iKgV8lQnM49ucEnSRrGjJski63YAkQyHHAhP6pIa+Hx4AIbMvepFKSp 16Nrh3InpnJZOmZ2r4QT8xgM73vpgLVTkGMwrGsaLvVZVmAT8yApx08ybQxDnee0b1 MPfy4psKrzlfc5icIE3WwtvBafdcj5wr8hLULv509j+vP5vbol7oVekK9XFuAbQfoJ Twt4AQ9CFsDag== 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 1so4DT-00BoOW-Ag; Tue, 10 Sep 2024 17:59:47 +0100 Date: Tue, 10 Sep 2024 17:59:46 +0100 Message-ID: <86seu778cd.wl-maz@kernel.org> From: Marc Zyngier To: Will Deacon Cc: Sebastian Ene , 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, 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 2/5] arm64: ptdump: Expose the attribute parsing functionality In-Reply-To: <20240910095718.GB20813@willie-the-truck> References: <20240909124721.1672199-1-sebastianene@google.com> <20240909124721.1672199-3-sebastianene@google.com> <20240910095718.GB20813@willie-the-truck> 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) 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: will@kernel.org, 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, 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240910_095951_127758_974959F4 X-CRM114-Status: GOOD ( 31.04 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, 10 Sep 2024 10:57:18 +0100, Will Deacon wrote: > > On Mon, Sep 09, 2024 at 12:47:18PM +0000, Sebastian Ene wrote: > > Reuse the descriptor parsing functionality to keep the same output format > > as the original ptdump code. In order for this to happen, move the state > > tracking objects into a common header. > > > > Signed-off-by: Sebastian Ene > > --- > > arch/arm64/include/asm/ptdump.h | 41 +++++++++++++++++++++++- > > arch/arm64/mm/ptdump.c | 55 +++++++-------------------------- > > 2 files changed, 51 insertions(+), 45 deletions(-) > > > > diff --git a/arch/arm64/include/asm/ptdump.h b/arch/arm64/include/asm/ptdump.h > > index 5b1701c76d1c..bd5d3ee3e8dc 100644 > > --- a/arch/arm64/include/asm/ptdump.h > > +++ b/arch/arm64/include/asm/ptdump.h > > @@ -9,6 +9,7 @@ > > > > #include > > #include > > +#include > > > > struct addr_marker { > > unsigned long start_address; > > @@ -21,14 +22,52 @@ struct ptdump_info { > > unsigned long base_addr; > > }; > > > > +struct ptdump_prot_bits { > > + u64 mask; > > + u64 val; > > + const char *set; > > + const char *clear; > > +}; > > + > > +struct ptdump_pg_level { > > + const struct ptdump_prot_bits *bits; > > + char name[4]; > > + int num; > > + u64 mask; > > +}; > > + > > +/* > > + * The page dumper groups page table entries of the same type into a single > > + * description. It uses pg_state to track the range information while > > + * iterating over the pte entries. When the continuity is broken it then > > + * dumps out a description of the range. > > + */ > > +struct ptdump_pg_state { > > + struct ptdump_state ptdump; > > + struct seq_file *seq; > > + const struct addr_marker *marker; > > + const struct mm_struct *mm; > > + unsigned long start_address; > > + int level; > > + u64 current_prot; > > + bool check_wx; > > + unsigned long wx_pages; > > + unsigned long uxn_pages; > > +}; > > + > > void ptdump_walk(struct seq_file *s, struct ptdump_info *info); > > +void note_page(struct ptdump_state *pt_st, unsigned long addr, int level, > > + u64 val); > > #ifdef CONFIG_PTDUMP_DEBUGFS > > #define EFI_RUNTIME_MAP_END DEFAULT_MAP_WINDOW_64 > > void __init ptdump_debugfs_register(struct ptdump_info *info, const char *name); > > #else > > static inline void ptdump_debugfs_register(struct ptdump_info *info, > > const char *name) { } > > -#endif > > +#endif /* CONFIG_PTDUMP_DEBUGFS */ > > +#else > > +static inline void note_page(void *pt_st, unsigned long addr, > > + int level, u64 val) { } > > nit: but why isn't 'pt_st' a pointer to 'struct ptdump_state'? > > Perhaps you should #include before the #ifdef > CONFIG_PTDUMP_CORE ? Yup, that seems to do the trick. I'm folding this into the patch: diff --git a/arch/arm64/include/asm/ptdump.h b/arch/arm64/include/asm/ptdump.h index 71a7ed01153a4..6cf4aae052191 100644 --- a/arch/arm64/include/asm/ptdump.h +++ b/arch/arm64/include/asm/ptdump.h @@ -5,11 +5,12 @@ #ifndef __ASM_PTDUMP_H #define __ASM_PTDUMP_H +#include + #ifdef CONFIG_PTDUMP_CORE #include #include -#include struct addr_marker { unsigned long start_address; @@ -67,7 +68,7 @@ static inline void ptdump_debugfs_register(struct ptdump_info *info, const char *name) { } #endif /* CONFIG_PTDUMP_DEBUGFS */ #else -static inline void note_page(void *pt_st, unsigned long addr, +static inline void note_page(struct ptdump_state *pt_st, unsigned long addr, int level, u64 val) { } #endif /* CONFIG_PTDUMP_CORE */ > In any case, the meat of the patch is fine: > > Acked-by: Will Deacon Thanks, M. -- Without deviation from the norm, progress is not possible.