Re: [RFC] mm: Drop pxd_ERROR()

Anshuman Khandual <[email protected]>
Newsgroups gmane.linux.kernel.cross-arch,gmane.linux.kernel.mm,gmane.linux.kernel
Message-ID <cvv4iwa33bpfrqn5vbg7qjomvazrxm55i4u4gubgcllwm2so5n@2hdj5rbzmcd6>
On Thu, Aug 06, 2026 at 01:47:23PM +0200, David Hildenbrand (Arm) wrote:
> On 8/6/26 10:06, Anshuman Khandual wrote:
> > pxd_ERROR() has been used in generic mm just to print the page table entry
> > in pxd_clear_bad() before clearing those out with pxd_clear() later. These
> > pxd_ERROR() macros have been provided by all platforms which basically did
> > the same thing.
> > 
> > Make pxd_clear_bad() use recently added ptval_to_str() instead for printing
> > page table entries thus completely dropping dependency on platform provided
> > pxd_ERROR() macros which can then be dropped off. First move all required
> > helpers in core MM into a header file which could then be used else where.
> > 
> > Although some platforms still use those macros internally as well. In which
> > case just move these macros inside the platform for now.
> 
> No, just get rid of them first.
> 
> The ones in arch/sh/mm/init.c are just supid:
> 
> if (pgd_none(*pgd)) {
> 	pgd_ERROR(*pgd);
> 
> printing a none PGD? Stupid. :)

Will drop them from arch/sh in a pre-requsite patch.

> 
> Then there is arch/parisc/kernel/pci-dma.c, which just open-codes
> pmd_clear_bad() ?
> 
> 	pmd_ERROR(*pmd);
> 	pmd_clear(pmd);

Will replace these instances in arch/parisc/ with corresponding generic
[pmd|pgd]_clear_bad() helpers as necessary in a pre-requsite patch.

> 
> 
> Anything else?

Just one more instance inside arch/loongarch/mm/init.c which could be
dropped as well.

        if (!pte_none(ptep_get(ptep))) {
                pte_ERROR(*ptep);
                return;
        }
> 
> > 
> > Cc: David Hildenbrand (Arm) <[email protected]>
> > Cc: Andrew Morton <[email protected]> 
> > Cc: [email protected]
> > Cc: [email protected]
> > Cc: [email protected]
> > Signed-off-by: Anshuman Khandual <[email protected]>
> > ---
> > This applies on v7.2-rc6 but after the following patch
> > 
> > https://lore.kernel.org/all/[email protected]/
> > 
> > Would it also make sense to just drop __FILE__ and __LINE__ from the output
> > in pxd_clear_bad() helpers as they always print the same details regardless
> > the error path and does not add much value.
> 
> Yes, drop that, it's nonsensical given that all relevant calls are from
> mm/pgtable-generic.c

Will drop them.

> 
> Thanks for looking into this!
> 
> -- 
> Cheers,
> 
> David
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.