Subject: Re: [RFC 5/8] powerpc/ptdump: Dump PXX level info for kernel_page_tables

From: Ritesh Harjani (IBM) <[email-masked]>
Date: Sat, 30 Aug 2025 12:55:49 +0530

Christophe Leroy <[email-masked]> writes:

> Le 30/08/2025 à 05:51, Ritesh Harjani (IBM) a écrit :
>> This patch adds PGD/PUD/PMD/PTE level information while dumping kernel
>> page tables. Before this patch it was hard to identify which entries
>> belongs to which page table level e.g.
>> 
>> ~ # dmesg |grep -i radix
>> [0.000000] radix-mmu: Mapped 0x0000000000000000-0x0000000005400000 with 2.00 MiB pages (exec)
>> [0.000000] radix-mmu: Mapped 0x0000000005400000-0x0000000040000000 with 2.00 MiB pages
>> [0.000000] radix-mmu: Mapped 0x0000000040000000-0x0000000100000000 with 1.00 GiB pages
>> [0.000000] radix-mmu: Initializing Radix MMU
>> 
>> Before:
>> ---[ Start of kernel VM ]---
>> 0xc000000000000000-0xc000000003ffffff  XXX   64M   r      X   pte  valid  present  dirty  accessed
>> 0xc000000004000000-0xc00000003fffffff  XXX  960M   r  w       pte  valid  present  dirty  accessed
>> 0xc000000040000000-0xc0000000ffffffff  XXX    3G   r  w       pte  valid  present  dirty  accessed
>> ...
>> ---[ vmemmap start ]---
>> 0xc00c000000000000-0xc00c0000003fffff  XXX    4M   r  w       pte  valid  present  dirty  accessed
>> 
>> After:
>> ---[ Start of kernel VM ]---
>> 0xc000000000000000-0xc000000003ffffff  XXX   64M PMD  r      X   pte  valid  present  dirty  accessed
>> 0xc000000004000000-0xc00000003fffffff  XXX  960M PMD  r  w       pte  valid  present  dirty  accessed
>> 0xc000000040000000-0xc0000000ffffffff  XXX    3G PUD  r  w       pte  valid  present  dirty  accessed
>> ...
>> ---[ vmemmap start ]---
>> 0xc00c000000000000-0xc00c0000003fffff  XXX    4M PMD  r  w       pte  valid  present  dirty  accessed
>> 
>> Cc: Madhavan Srinivasan <[email-masked]>
>> Cc: Michael Ellerman <[email-masked]>
>> Cc: Nicholas Piggin <[email-masked]>
>> Cc: Christophe Leroy <[email-masked]>
>> Cc: Paul Mackerras <[email-masked]>
>> Cc: "Aneesh Kumar K.V" <[email-masked]>
>> Cc: Donet Tom <[email-masked]>
>> Cc: [email-masked]
>> Signed-off-by: Ritesh Harjani (IBM) <[email-masked]>
>> ---
>>   arch/powerpc/mm/ptdump/8xx.c      | 5 +++++
>>   arch/powerpc/mm/ptdump/book3s64.c | 5 +++++
>>   arch/powerpc/mm/ptdump/ptdump.c   | 1 +
>>   arch/powerpc/mm/ptdump/ptdump.h   | 1 +
>>   arch/powerpc/mm/ptdump/shared.c   | 5 +++++
>>   5 files changed, 17 insertions(+)
>> 
>> diff --git a/arch/powerpc/mm/ptdump/8xx.c b/arch/powerpc/mm/ptdump/8xx.c
>> index b5c79b11ea3c..1dc0f2438a73 100644
>> --- a/arch/powerpc/mm/ptdump/8xx.c
>> +++ b/arch/powerpc/mm/ptdump/8xx.c
>> @@ -71,18 +71,23 @@ static const struct flag_info flag_array[] = {
>> 
>>   struct pgtable_level pg_level[5] = {
>>   	{ /* pgd */
>> +		.name	= "PGD",
>>   		.flag	= flag_array,
>>   		.num	= ARRAY_SIZE(flag_array),
>>   	}, { /* p4d */
>> +		.name	= "P4D",
>>   		.flag	= flag_array,
>>   		.num	= ARRAY_SIZE(flag_array),
>>   	}, { /* pud */
>> +		.name	= "PUD",
>>   		.flag	= flag_array,
>>   		.num	= ARRAY_SIZE(flag_array),
>>   	}, { /* pmd */
>> +		.name	= "PMD",
>>   		.flag	= flag_array,
>>   		.num	= ARRAY_SIZE(flag_array),
>>   	}, { /* pte */
>> +		.name	= "PTX",
>
> Why PTX not PTE ?
>

My bad I was checking something on 8xx and I missed reverting that back. 
Thanks for pointing out. Will fix it in the next revision.

-ritesh