Re: [RFC V2 1/6] loongarch/mm: Stop using pte_ERROR()

"David Hildenbrand (Arm)" <[email protected]>
Newsgroups org.kernel.vger.linux-alpha,dev.linux.lists.loongarch,org.infradead.lists.linux-arm-kernel,org.infradead.lists.linux-riscv,org.infradead.lists.linux-snps-arc,org.infradead.lists.linux-um,org.kernel.vger.linux-arch,org.kernel.vger.linux-csky,org.kernel.vger.linux-hexagon,org.kernel.vger.linux-kernel,org.kernel.vger.linux-m68k,org.kernel.vger.linux-mips,org.kernel.vger.linux-openrisc,org.kernel.vger.linux-parisc,org.kernel.vger.linux-s390,org.kernel.vger.linux-sh,org.kernel.vger.sparclinux,org.kvack.linux-mm,org.ozlabs.lists.linuxppc-dev
Message-ID <[email protected]>
On 8/11/26 06:21, Anshuman Khandual wrote:
> Directly use pr_err() in __set_fixmap() and drop pte_ERROR() which helps in
> eventually dropping pte_ERROR() macro across the tree. In this new printing
> __FILE__ and __LINE__ has been dropped because they are always the same and
> don't really add any value.
> 
> Cc: Huacai Chen <[email protected]>
> Cc: WANG Xuerui <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Signed-off-by: Anshuman Khandual <[email protected]>
> ---
>  arch/loongarch/include/asm/pgtable.h | 2 --
>  arch/loongarch/mm/init.c             | 2 +-
>  2 files changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/arch/loongarch/include/asm/pgtable.h b/arch/loongarch/include/asm/pgtable.h
> index 223528c04d73..a32a8fff70c1 100644
> --- a/arch/loongarch/include/asm/pgtable.h
> +++ b/arch/loongarch/include/asm/pgtable.h
> @@ -128,8 +128,6 @@ struct vm_area_struct;
>  #define ptep_get(ptep) READ_ONCE(*(ptep))
>  #define pmdp_get(pmdp) READ_ONCE(*(pmdp))
>  
> -#define pte_ERROR(e) \
> -	pr_err("%s:%d: bad pte %016lx.\n", __FILE__, __LINE__, pte_val(e))
>  #ifndef __PAGETABLE_PMD_FOLDED
>  #define pmd_ERROR(e) \
>  	pr_err("%s:%d: bad pmd %016lx.\n", __FILE__, __LINE__, pmd_val(e))
> diff --git a/arch/loongarch/mm/init.c b/arch/loongarch/mm/init.c
> index 3407030f3e7a..be9b127daef2 100644
> --- a/arch/loongarch/mm/init.c
> +++ b/arch/loongarch/mm/init.c
> @@ -203,7 +203,7 @@ void __init __set_fixmap(enum fixed_addresses idx,
>  
>  	ptep = populate_kernel_pte(addr);
>  	if (!pte_none(ptep_get(ptep))) {
> -		pte_ERROR(*ptep);
> +		pr_err("bad pte %016lx\n", pte_val(*ptep));
>  		return;
>  	}
>  

Ah, I missed that we want to print actual values, I somehow thought that we
would be printing pte_none() ...

Maybe we should just be more verbose while at it?

pr_err("unexpected set PTE at %ul in __set_fixmap: %016lx\n",
       addr, pte_val(*ptep));

-- 
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.