[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <16c12c3f-f2c2-45fa-9db6-4dfaeb002059@arm.com>
Date: Mon, 17 Mar 2025 09:28:48 +0000
From: Ryan Roberts <ryan.roberts@....com>
To: Anshuman Khandual <anshuman.khandual@....com>, linux-mm@...ck.org
Cc: Catalin Marinas <catalin.marinas@....com>, Will Deacon <will@...nel.org>,
Steven Price <steven.price@....com>,
Madhavan Srinivasan <maddy@...ux.ibm.com>,
Nicholas Piggin <npiggin@...il.com>, Paul Walmsley
<paul.walmsley@...ive.com>, Palmer Dabbelt <palmer@...belt.com>,
Gerald Schaefer <gerald.schaefer@...ux.ibm.com>,
Heiko Carstens <hca@...ux.ibm.com>, Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org, linux-riscv@...ts.infradead.org,
linux-s390@...r.kernel.org, Marc Zyngier <maz@...nel.org>
Subject: Re: [PATCH 2/2] arm64/ptdump: Replace u64 with pteval_t
On 17/03/2025 06:18, Anshuman Khandual wrote:
> Page table entry's value, mask and protection are represented with pteval_t
> data type format not u64 that has been assumed while dumping the page table
> entries. Replace all such u64 instances with pteval_t instead as required.
>
> Cc: Catalin Marinas <catalin.marinas@....com>
> Cc: Will Deacon <will@...nel.org>
> Cc: Marc Zyngier <maz@...nel.org>
> Cc: linux-arm-kernel@...ts.infradead.org
> Cc: linux-kernel@...r.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@....com>
> ---
> arch/arm64/include/asm/ptdump.h | 8 ++++----
> arch/arm64/mm/ptdump.c | 2 +-
> 2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/arch/arm64/include/asm/ptdump.h b/arch/arm64/include/asm/ptdump.h
> index e5da9ce8a515..476a870489b9 100644
> --- a/arch/arm64/include/asm/ptdump.h
> +++ b/arch/arm64/include/asm/ptdump.h
> @@ -24,8 +24,8 @@ struct ptdump_info {
> };
>
> struct ptdump_prot_bits {
> - u64 mask;
> - u64 val;
> + pteval_t mask;
> + pteval_t val;
Given Ard's suggestion of using "ptdesc" as a generic term for PTDESC_SHIFT (or
PTDESC_ORDER, or whatever we ended up calling it), I wonder if it would be
cleaner to do the same with the types? We could have a ptdesc_t, which is
typedef'ed as u64 (or u128), then pteval_t, pmdval_t, ..., could all be
typedef'ed as ptdesc_t. Then for code that just wants a generic pgtable
descriptor value, we can use that type to indicate that it can be at any level.
Thanks,
Ryan
> const char *set;
> const char *clear;
> };
> @@ -34,7 +34,7 @@ struct ptdump_pg_level {
> const struct ptdump_prot_bits *bits;
> char name[4];
> int num;
> - u64 mask;
> + pteval_t mask;
> };
>
> /*
> @@ -51,7 +51,7 @@ struct ptdump_pg_state {
> const struct mm_struct *mm;
> unsigned long start_address;
> int level;
> - u64 current_prot;
> + pteval_t current_prot;
> bool check_wx;
> unsigned long wx_pages;
> unsigned long uxn_pages;
> diff --git a/arch/arm64/mm/ptdump.c b/arch/arm64/mm/ptdump.c
> index fd1610b4fd15..a5651be95868 100644
> --- a/arch/arm64/mm/ptdump.c
> +++ b/arch/arm64/mm/ptdump.c
> @@ -194,7 +194,7 @@ void note_page(struct ptdump_state *pt_st, unsigned long addr, int level,
> struct ptdump_pg_state *st = container_of(pt_st, struct ptdump_pg_state, ptdump);
> struct ptdump_pg_level *pg_level = st->pg_level;
> static const char units[] = "KMGTPE";
> - u64 prot = 0;
> + pteval_t prot = 0;
>
> /* check if the current level has been folded dynamically */
> if (st->mm && ((level == 1 && mm_p4d_folded(st->mm)) ||
Powered by blists - more mailing lists