Re: [RFC 1/2] lib/vsprintf: Add support for pte_t
From: Matthew Wilcox
Date: Thu Jun 19 2025 - 09:31:23 EST
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).
So no, NACK.