Re: [PATCH V3] mm: Standardize printing for pgtable entries
From: David Hildenbrand (Arm)
Date: Mon Jul 13 2026 - 05:32:10 EST
On 7/13/26 04:37, Anshuman Khandual wrote:
>
>
> On 11/07/26 10:28 AM, Matthew Wilcox wrote:
>> On Thu, Jul 09, 2026 at 10:13:34AM +0530, Anshuman Khandual wrote:
>>> @@ -532,34 +575,34 @@ static void __print_bad_page_map_pgtable(struct mm_struct *mm, unsigned long add
>>> * see locking requirements for print_bad_page_map().
>>> */
>>> pgdp = pgd_offset(mm, addr);
>>> - pgdv = pgd_val(*pgdp);
>>> + ptval_to_str(pgd_str, pgd_val(*pgdp));
>>>
>>> if (!pgd_present(*pgdp) || pgd_leaf(*pgdp)) {
>>> - pr_alert("pgd:%08llx\n", pgdv);
>>> + pr_alert("pgd:%s\n", pgd_str);
>>
>> Why can't we do this as:
>>
>> pr_alert("pgd:%*phN\n", sizeof(pgdv), &pgdv);
>
> %*phN dumps raw memory bytes and will have different formats on little
> vs big endian platforms which is not desired here. Debug print here is
> expected to report pgtable entry canonical value where various platform
> specific fields can be inspected.
If we'd want to go that route I guess we'd have to add a new specifier that will
print the pointed number in the size specified by the second argument. We could
start by supporting 8/16/32/64/128 bit only, no weird stuff in between.
--
Cheers,
David