Re: [RFC 1/2] lib/vsprintf: Add support for pte_t
From: Anshuman Khandual
Date: Fri Jun 20 2025 - 04:14:14 EST
On 19/06/25 6:56 PM, Matthew Wilcox wrote:
> On Wed, Jun 18, 2025 at 09:42:34AM +0530, Anshuman Khandual wrote:
>> +++ b/mm/memory.c
>> @@ -522,9 +522,8 @@ static void print_bad_pte(struct vm_area_struct *vma, unsigned long addr,
>> mapping = vma->vm_file ? vma->vm_file->f_mapping : NULL;
>> index = linear_page_index(vma, addr);
>>
>> - pr_alert("BUG: Bad page map in process %s pte:%08llx pmd:%08llx\n",
>> - current->comm,
>> - (long long)pte_val(pte), (long long)pmd_val(*pmd));
>> + pr_alert("BUG: Bad page map in process %s pte:%ppte pmd:%ppte\n",
>> + current->comm, &pte, pmd);
>
> Unfortunately, the one example you've converted shows why this is a bad
> idea. You're passing a pmd_t pointer to a function which is assuming a
> pte_t pointer. And a pmd_t and a pte_t are sometimes different sizes!
> (eg sometimes one is 64 bit and the other 32 bit).
As discussed on a separate thread, this might be addressed via separate
printf formats for each page table level e.g %ppte, %ppmd, and %ppud etc.
>
> So no, NACK.
>