From: Anshuman Khandual <anshuman.khandual@arm.com>
To: "David Hildenbrand (Arm)" <david@kernel.org>, linux-mm@kvack.org
Cc: andriy.shevchenko@linux.intel.com, usama.arif@linux.dev,
hughd@google.com, willy@infradead.org, ryan.roberts@arm.com,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH V2] mm: Standardize printing for pgtable entries
Date: Wed, 8 Jul 2026 14:13:26 +0530 [thread overview]
Message-ID: <437505b8-8616-4341-8d19-033d5b6b1d51@arm.com> (raw)
In-Reply-To: <876c533f-6709-43a0-8595-143a8b9c9201@kernel.org>
On 08/07/26 1:31 PM, David Hildenbrand (Arm) wrote:
> On 7/8/26 05:28, Anshuman Khandual wrote:
>> From: "David Hildenbrand (Arm)" <david@kernel.org>
>>
>> Bad page map reporting currently stores page table entry values in an
>> unsigned long long and prints them with fixed 64-bit-oriented format
>> strings. This is inconsistent across call sites and does not work well for
>> architectures where page table entry values are not naturally represented
>> as 64-bit values, such as 32-bit or 128-bit entries.
>>
>> Introduce a common helper to convert raw page table entry values into a
>> fixed-width hexadecimal string based on the actual entry size. Use it for
>> bad page map reporting and for dumping the page table walk in
>> __print_bad_page_map_pgtable().
>>
>> Pass page table entry values to the reporting path as raw bytes together
>> with their size, instead of forcing them through an unsigned long long.
>> It keeps the printed output consistent and avoids truncation or misleading
>> formatting for non-64-bit page table entries.
>>
>> Cc: Andrew Morton <akpm@linux-foundation.org>
>> Cc: linux-mm@kvack.org
>> Cc: linux-kernel@vger.kernel.org
>> Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
>
> I still think you should add your
>
> Co-developed-by :)
OK - will add.
>
>> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
>> ---
>> This patch applies on v7.2-rc2
>>
>> Changes in V2:
>>
>> - Dropped space after ":" during print per Matthew
>> - Dropped CONFIG_CPU_BIG_ENDIAN per David
>>
>> Changes in V1:
>>
>> https://lore.kernel.org/all/20260707041703.658021-1-anshuman.khandual@arm.com/
>>
>> mm/memory.c | 98 ++++++++++++++++++++++++++++++++++++++++-------------
>> 1 file changed, 75 insertions(+), 23 deletions(-)
>>
>
> In general, LGTM (I wrote of it, lol)
>
>> diff --git a/mm/memory.c b/mm/memory.c
>> index ff338c2abe92..a2b63af82792 100644
>> --- a/mm/memory.c
>> +++ b/mm/memory.c
>> @@ -519,9 +519,48 @@ static bool is_bad_page_map_ratelimited(void)
>> return false;
>> }
>>
>> +#define PTVAL_STR_MAX (32 + 1) /* Max 128-bit value in hex + NUL */
>
> We could reduce the stack space for !__SIZEOF_INT128__, but not sure if worth it.
>
> __print_bad_page_map_pgtable() will currently consume 132 bytes for strings,
> guess that's still tolerable.
>
That's a good point. Are you looking for something like the following
where stack space can be saved if __SIZEOF_INT128__ is not supported.
#if defined(__SIZEOF_INT128__)
#define PTVAL_STR_MAX (32 + 1) /* Max 128-bit value in hex + NUL */
#else
#define PTVAL_STR_MAX (16 + 1) /* Max 64-bit value in hex + NUL */
#endif
Besides will move the macro just before __print_bad_page_map_pgtable()
where it gets used.
next prev parent reply other threads:[~2026-07-08 8:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-08 3:28 [PATCH V2] mm: Standardize printing for pgtable entries Anshuman Khandual
2026-07-08 8:01 ` David Hildenbrand (Arm)
2026-07-08 8:43 ` Anshuman Khandual [this message]
2026-07-08 8:52 ` David Hildenbrand (Arm)
2026-07-08 11:17 ` Andy Shevchenko
2026-07-09 3:42 ` Anshuman Khandual
2026-07-08 11:22 ` Ryan Roberts
2026-07-08 11:27 ` David Hildenbrand (Arm)
2026-07-08 12:43 ` Ryan Roberts
2026-07-08 12:58 ` David Hildenbrand (Arm)
2026-07-09 3:54 ` Anshuman Khandual
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=437505b8-8616-4341-8d19-033d5b6b1d51@arm.com \
--to=anshuman.khandual@arm.com \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=david@kernel.org \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ryan.roberts@arm.com \
--cc=usama.arif@linux.dev \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox