Re: [PATCH V3] mm: Standardize printing for pgtable entries
From: Andy Shevchenko
Date: Mon Jul 13 2026 - 07:37:16 EST
On Mon, Jul 13, 2026 at 11:30:08AM +0200, David Hildenbrand (Arm) wrote:
> 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:
...
> >>> 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.
FWIW, we have hex_dump_to_buffer() for that already.
--
With Best Regards,
Andy Shevchenko