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 425C4198842; Tue, 10 Sep 2024 16:59:49 +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=1725987590; cv=none; b=lfx+yA8IxXpNHGDJ78DcBELM1hE1RAjDzdnYXLRpyrl6VFYwztTgRAml5LI6uqZuopEpnK4qeCEnIvk66MO1Fl1qYrK1WHChR7BRm3fIv2DsQ1RFcZ++CtP97K/A42fv7Zqmy7nCmdk34H/w7U9Zr2eEMo1/85vm/q5NOqe0zIA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725987590; c=relaxed/simple; bh=3wuFIoLr691b/skwnVl1HScAP75KBHcXvy/8/CQt2WQ=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=QFkWcq8r/4TQeXnavWORnBJWusimRGSVKEABFQ8AUQdQKbxjh/4+PO8JDREqEsXwVkKihdEySo+5uqEH2OWTTOG0ultSYz/WxLWYHty3y7zxPLBF6628wqnzP06+hWrElRsG2v6KR12AZ4suTl2s6NR1D+yLknNMU+pKyJIDG1s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rMWgz2BD; 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="rMWgz2BD" 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) 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: 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 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.