mm: rename pud_page_vaddr to pud_pgtable and make it return pmd_t *
Subsystems (16)
PATCH v2 1/2 mm: rename pud_page_vaddr to pud_pgtable and make it return pmd_t *
No functional change in this patch.
--- arch/alpha/include/asm/pgtable.h | 8 +++++--- arch/arm/include/asm/pgtable-3level.h | 2 +- arch/arm64/include/asm/pgtable.h | 4 ++-- arch/ia64/include/asm/pgtable.h | 2 +- arch/m68k/include/asm/motorola_pgtable.h | 2 +- arch/mips/include/asm/pgtable-64.h | 4 ++-- arch/parisc/include/asm/pgtable.h | 4 ++-- arch/powerpc/include/asm/book3s/64/pgtable.h | 6 +++++- arch/powerpc/include/asm/nohash/64/pgtable.h | 6 +++++- arch/powerpc/mm/book3s64/radix_pgtable.c | 4 ++-- arch/powerpc/mm/pgtable_64.c | 2 +- arch/riscv/include/asm/pgtable-64.h | 4 ++-- arch/sh/include/asm/pgtable-3level.h | 4 ++-- arch/sparc/include/asm/pgtable_32.h | 4 ++-- arch/sparc/include/asm/pgtable_64.h | 6 +++--- arch/um/include/asm/pgtable-3level.h | 2 +- arch/x86/include/asm/pgtable.h | 4 ++-- arch/x86/mm/pat/set_memory.c | 4 ++-- arch/x86/mm/pgtable.c | 2 +- include/asm-generic/pgtable-nopmd.h | 2 +- include/asm-generic/pgtable-nopud.h | 2 +- include/linux/pgtable.h | 2 +- 22 files changed, 45 insertions(+), 35 deletions(-)
arch/alpha/include/asm/pgtable.h +5 -3
@@ -239,8 +239,10 @@ pmd_page_vaddr(pmd_t pmd)#define pmd_page (pmd) (pfn_to_page(pmd_val(pmd) >> 32))#define pud_page (pud) (pfn_to_page(pud_val(pud) >> 32)) -extern inline unsigned long pud_page_vaddr (pud_t pgd) -{return PAGE_OFFSET + ((pud_val (pgd) & _PFN_MASK) >> (32 -PAGE_SHIFT )); } +static inline pmd_t *pud_pgtable (pud_t pgd) +{ +return (pmd_t *)(PAGE_OFFSET + ((pud_val (pgd) & _PFN_MASK) >> (32 -PAGE_SHIFT ))); +}extern inline int pte_none (pte_t pte) {return !pte_val (pte); }extern inline int pte_present (pte_t pte) {return pte_val (pte) & _PAGE_VALID; }
@@ -290,7 +292,7 @@ extern inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= __ACCESS_BITS; retu/* Find an entry in the second-level page table.. */ extern inline pmd_t *pmd_offset (pud_t * dir,unsigned long address) { -pmd_t *ret = (pmd_t *)pud_page_vaddr (*dir) + ((address >>PMD_SHIFT ) & (PTRS_PER_PAGE -1 )); +pmd_t *ret =pud_pgtable (*dir) + ((address >>PMD_SHIFT ) & (PTRS_PER_PAGE -1 ));smp_rmb ();/* see above */ return ret; }
arch/arm/include/asm/pgtable-3level.h +1 -1
@@ -130,7 +130,7 @@flush_pmd_entry (pudp); \ }while (0 ) -static inline pmd_t *pud_page_vaddr(pud_t pud) +static inline pmd_t *pud_pgtable(pud_t pud) {return __va (pud_val (pud) &PHYS_MASK & (s32 )PAGE_MASK ); }
arch/arm64/include/asm/pgtable.h +2 -2
@@ -636,9 +636,9 @@ static inline phys_addr_t pud_page_paddr(pud_t pud)return __pud_to_phys (pud); } -static inline unsigned long pud_page_vaddr (pud_t pud) +static inline pmd_t *pud_pgtable (pud_t pud) { -return (unsigned long )__va (pud_page_paddr (pud)); +return (pmd_t *)__va (pud_page_paddr (pud)); }/* Find an entry in the second-level page table. */
arch/ia64/include/asm/pgtable.h +1 -1
@@ -274,7 +274,7 @@ ia64_phys_addr_valid (unsigned long addr)#define pud_bad (pud) (!ia64_phys_addr_valid(pud_val(pud)))#define pud_present (pud) (pud_val(pud) != 0UL)#define pud_clear (pudp) (pud_val(*(pudp)) = 0UL) -#define pud_page_vaddr (pud) ((unsigned long) __va(pud_val(pud) & _PFN_MASK)) +#define pud_pgtable (pud) ((pmd_t *) __va(pud_val(pud) & _PFN_MASK))#define pud_page (pud) virt_to_page((pud_val(pud) + PAGE_OFFSET))#if CONFIG_PGTABLE_LEVELS ==4
arch/m68k/include/asm/motorola_pgtable.h +1 -1
@@ -129,7 +129,7 @@ static inline void pud_set(pud_t *pudp, pmd_t *pmdp)#define __pte_page (pte) ((unsigned long)__va(pte_val(pte) & PAGE_MASK))#define pmd_page_vaddr (pmd) ((unsigned long)__va(pmd_val(pmd) & _TABLE_MASK)) -#define pud_page_vaddr (pud) ((unsigned long)__va(pud_val(pud) & _TABLE_MASK)) +#define pud_pgtable (pud) ((pmd_t *)__va(pud_val(pud) & _TABLE_MASK))#define pte_none (pte) (!pte_val(pte))
arch/mips/include/asm/pgtable-64.h +2 -2
@@ -314,9 +314,9 @@ static inline void pud_clear(pud_t *pudp)#endif #ifndef __PAGETABLE_PMD_FOLDED -static inline unsigned long pud_page_vaddr (pud_t pud) +static inline pmd_t *pud_pgtable (pud_t pud) { -return pud_val (pud); +return (pmd_t *)pud_val (pud); }#define pud_phys (pud) virt_to_phys((void *)pud_val(pud))#define pud_page (pud) (pfn_to_page(pud_phys(pud) >> PAGE_SHIFT))
arch/parisc/include/asm/pgtable.h +2 -2
@@ -324,8 +324,8 @@ static inline void pmd_clear(pmd_t *pmd) {#if CONFIG_PGTABLE_LEVELS ==3 -#define pud_page_vaddr (pud) ((unsigned long) __va(pud_address(pud))) -#define pud_page (pud) virt_to_page((void *)pud_page_vaddr(pud)) +#define pud_pgtable (pud) ((pmd_t *) __va(pud_address(pud))) +#define pud_page (pud) virt_to_page((void *)pud_pgtable(pud))/* For 64 bit we have three level tables */
arch/powerpc/include/asm/book3s/64/pgtable.h +5 -1
@@ -1048,9 +1048,13 @@ extern struct page *p4d_page(p4d_t p4d);/* Pointers in the page table tree are physical addresses */ #define __pgtable_ptr_val (ptr) __pa(ptr) -#define pud_page_vaddr (pud) __va(pud_val(pud) & ~PUD_MASKED_BITS)#define p4d_page_vaddr (p4d) __va(p4d_val(p4d) & ~P4D_MASKED_BITS) +static inline pmd_t *pud_pgtable (pud_t pud) +{ +return (pmd_t *)__va (pud_val (pud) & ~PUD_MASKED_BITS ); +} +#define pte_ERROR (e) \ pr_err("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e))#define pmd_ERROR (e) \
arch/powerpc/include/asm/nohash/64/pgtable.h +5 -1
@@ -164,7 +164,11 @@ static inline void pud_clear(pud_t *pudp)#define pud_bad (pud) (!is_kernel_addr(pud_val(pud)) \ || (pud_val(pud) & PUD_BAD_BITS))#define pud_present (pud) (pud_val(pud) != 0) -#define pud_page_vaddr (pud) (pud_val(pud) & ~PUD_MASKED_BITS) + +static inline pmd_t *pud_pgtable (pud_t pud) +{ +return (pmd_t *)(pud_val (pud) & ~PUD_MASKED_BITS ); +}extern struct page *pud_page (pud_t pud);
arch/powerpc/mm/book3s64/radix_pgtable.c +2 -2
@@ -825,7 +825,7 @@ static void __meminit remove_pud_table(pud_t *pud_start, unsigned long addr,continue ; } - pmd_base = (pmd_t *)pud_page_vaddr (*pud); + pmd_base =pud_pgtable (*pud);remove_pmd_table (pmd_base, addr, next);free_pmd_table (pmd_base, pud); }
@@ -1110,7 +1110,7 @@ int pud_free_pmd_page(pud_t *pud, unsigned long addr)pmd_t *pmd;int i; - pmd = (pmd_t *)pud_page_vaddr (*pud); + pmd =pud_pgtable (*pud);pud_clear (pud);flush_tlb_kernel_range (addr, addr +PUD_SIZE );
arch/powerpc/mm/pgtable_64.c +1 -1
@@ -115,7 +115,7 @@ struct page *pud_page(pud_t pud)VM_WARN_ON (!pud_huge (pud));return pte_page (pud_pte (pud)); } -return virt_to_page (pud_page_vaddr (pud)); +return virt_to_page (pud_pgtable (pud)); }/*
arch/riscv/include/asm/pgtable-64.h +2 -2
@@ -60,9 +60,9 @@ static inline void pud_clear(pud_t *pudp)set_pud (pudp,__pud (0 )); } -static inline unsigned long pud_page_vaddr (pud_t pud) +static inline pmd_t *pud_pgtable (pud_t pud) { -return (unsigned long )pfn_to_virt (pud_val (pud) >> _PAGE_PFN_SHIFT); +return (pmd_t *)pfn_to_virt (pud_val (pud) >> _PAGE_PFN_SHIFT); }static inline struct page *pud_page (pud_t pud)
arch/sh/include/asm/pgtable-3level.h +2 -2
@@ -32,9 +32,9 @@ typedef struct { unsigned long long pmd; } pmd_t;#define pmd_val (x) ((x).pmd)#define __pmd (x) ((pmd_t) { (x) } ) -static inline unsigned long pud_page_vaddr (pud_t pud) +static inline pmd_t *pud_pgtable (pud_t pud) { -return pud_val (pud); +return (pmd_t *)pud_val (pud); }/* only used by the stubbed out hugetlb gup code, should never be called */
arch/sparc/include/asm/pgtable_32.h +2 -2
@@ -152,13 +152,13 @@ static inline unsigned long pmd_page_vaddr(pmd_t pmd)return (unsigned long )__nocache_va (v <<4 ); } -static inline unsigned long pud_page_vaddr (pud_t pud) +static inline pmd_t *pud_pgtable (pud_t pud) {if (srmmu_device_memory (pud_val (pud))) {return ~0 ; }else {unsigned long v =pud_val (pud) &SRMMU_PTD_PMASK ; -return (unsigned long )__nocache_va (v <<4 ); +return (pmd_t *)__nocache_va (v <<4 ); } }
arch/sparc/include/asm/pgtable_64.h +3 -3
@@ -845,18 +845,18 @@ static inline unsigned long pmd_page_vaddr(pmd_t pmd)return ((unsigned long )__va (pfn <<PAGE_SHIFT )); } -static inline unsigned long pud_page_vaddr (pud_t pud) +static inline pmd_t *pud_pgtable (pud_t pud) {pte_t pte =__pte (pud_val (pud));unsigned long pfn; pfn =pte_pfn (pte); -return ((unsigned long )__va (pfn <<PAGE_SHIFT )); +return ((pmd_t *)__va (pfn <<PAGE_SHIFT )); }#define pmd_page (pmd) virt_to_page((void *)pmd_page_vaddr(pmd)) -#define pud_page (pud) virt_to_page((void *)pud_page_vaddr(pud)) +#define pud_page (pud) virt_to_page((void *)pud_pgtable(pud))#define pmd_clear (pmdp) (pmd_val(*(pmdp)) = 0UL)#define pud_present (pud) (pud_val(pud) != 0U)#define pud_clear (pudp) (pud_val(*(pudp)) = 0UL)
arch/um/include/asm/pgtable-3level.h +1 -1
@@ -84,7 +84,7 @@ static inline void pud_clear (pud_t *pud) }#define pud_page (pud) phys_to_page(pud_val(pud) & PAGE_MASK) -#define pud_page_vaddr (pud) ((unsigned long) __va(pud_val(pud) & PAGE_MASK)) +#define pud_pgtable (pud) ((pmd_t *) __va(pud_val(pud) & PAGE_MASK))static inline unsigned long pte_pfn (pte_t pte) {
arch/x86/include/asm/pgtable.h +2 -2
@@ -865,9 +865,9 @@ static inline int pud_present(pud_t pud)return pud_flags (pud) & _PAGE_PRESENT; } -static inline unsigned long pud_page_vaddr (pud_t pud) +static inline pmd_t *pud_pgtable (pud_t pud) { -return (unsigned long )__va (pud_val (pud) &pud_pfn_mask (pud)); +return (pmd_t *)__va (pud_val (pud) &pud_pfn_mask (pud)); }/*
arch/x86/mm/pat/set_memory.c +2 -2
@@ -1134,7 +1134,7 @@ static void __unmap_pmd_range(pud_t *pud, pmd_t *pmd, unsigned long start, unsigned long end) { if (unmap_pte_range(pmd, start, end)) - if (try_to_free_pmd_page((pmd_t *)pud_page_vaddr(*pud))) + if (try_to_free_pmd_page(pud_pgtable(*pud))) pud_clear(pud); }
@@ -1178,7 +1178,7 @@ static void unmap_pmd_range(pud_t *pud, unsigned long start, unsigned long end)* Try again to free the PMD page if haven't succeeded above. */ if (!pud_none (*pud)) -if (try_to_free_pmd_page ((pmd_t *)pud_page_vaddr (*pud))) +if (try_to_free_pmd_page (pud_pgtable (*pud)))pud_clear (pud); }
arch/x86/mm/pgtable.c +1 -1
@@ -797,7 +797,7 @@ int pud_free_pmd_page(pud_t *pud, unsigned long addr)pte_t *pte;int i; - pmd = (pmd_t *)pud_page_vaddr (*pud); + pmd =pud_pgtable (*pud); pmd_sv = (pmd_t *)__get_free_page (GFP_KERNEL );if (!pmd_sv)return 0 ;
include/asm-generic/pgtable-nopmd.h +1 -1
@@ -51,7 +51,7 @@ static inline pmd_t * pmd_offset(pud_t * pud, unsigned long address)#define __pmd (x) ((pmd_t) { __pud(x) } )#define pud_page (pud) (pmd_page((pmd_t){ pud })) -#define pud_page_vaddr (pud) (pmd_page_vaddr((pmd_t){ pud })) +#define pud_pgtable (pud) ((pmd_t *)(pmd_page_vaddr((pmd_t){ pud })))/* * allocating and freeing a pmd is trivial: the 1-entry pmd is
include/asm-generic/pgtable-nopud.h +1 -1
@@ -49,7 +49,7 @@ static inline pud_t *pud_offset(p4d_t *p4d, unsigned long address)#define __pud (x) ((pud_t) { __p4d(x) })#define p4d_page (p4d) (pud_page((pud_t){ p4d })) -#define p4d_page_vaddr (p4d) (pud_page_vaddr((pud_t){ p4d })) +#define p4d_page_vaddr (p4d) (pud_pgtable((pud_t){ p4d }))/* * allocating and freeing a pud is trivial: the 1-entry pud is
include/linux/pgtable.h +1 -1
@@ -88,7 +88,7 @@ static inline pte_t *pte_offset_kernel(pmd_t *pmd, unsigned long address)#ifndef pmd_offsetstatic inline pmd_t *pmd_offset (pud_t *pud,unsigned long address) { -return (pmd_t *)pud_page_vaddr (*pud) +pmd_index (address); +return pud_pgtable (*pud) +pmd_index (address); }#define pmd_offset pmd_offset#endif
Signature · 1 line
2.31.1
PATCH v2 2/2 mm: rename p4d_page_vaddr to p4d_pgtable and make it return pud_t *
No functional change in this patch.
--- arch/arm64/include/asm/pgtable.h | 4 ++-- arch/ia64/include/asm/pgtable.h | 2 +- arch/mips/include/asm/pgtable-64.h | 4 ++-- arch/powerpc/include/asm/book3s/64/pgtable.h | 5 ++++- arch/powerpc/include/asm/nohash/64/pgtable-4k.h | 6 +++++- arch/powerpc/mm/book3s64/radix_pgtable.c | 2 +- arch/powerpc/mm/pgtable_64.c | 2 +- arch/sparc/include/asm/pgtable_64.h | 4 ++-- arch/x86/include/asm/pgtable.h | 4 ++-- arch/x86/mm/init_64.c | 4 ++-- include/asm-generic/pgtable-nop4d.h | 2 +- include/asm-generic/pgtable-nopud.h | 2 +- include/linux/pgtable.h | 2 +- 13 files changed, 25 insertions(+), 18 deletions(-)
arch/arm64/include/asm/pgtable.h +2 -2
@@ -697,9 +697,9 @@ static inline phys_addr_t p4d_page_paddr(p4d_t p4d)return __p4d_to_phys (p4d); } -static inline unsigned long p4d_page_vaddr (p4d_t p4d) +static inline pud_t *p4d_pgtable (p4d_t p4d) { -return (unsigned long )__va (p4d_page_paddr (p4d)); +return (pud_t *)__va (p4d_page_paddr (p4d)); }/* Find an entry in the frst-level page table. */
arch/ia64/include/asm/pgtable.h +1 -1
@@ -282,7 +282,7 @@ ia64_phys_addr_valid (unsigned long addr)#define p4d_bad (p4d) (!ia64_phys_addr_valid(p4d_val(p4d)))#define p4d_present (p4d) (p4d_val(p4d) != 0UL)#define p4d_clear (p4dp) (p4d_val(*(p4dp)) = 0UL) -#define p4d_page_vaddr (p4d) ((unsigned long) __va(p4d_val(p4d) & _PFN_MASK)) +#define p4d_pgtable (p4d) ((pud_t *) __va(p4d_val(p4d) & _PFN_MASK))#define p4d_page (p4d) virt_to_page((p4d_val(p4d) + PAGE_OFFSET))#endif
arch/mips/include/asm/pgtable-64.h +2 -2
@@ -210,9 +210,9 @@ static inline void p4d_clear(p4d_t *p4dp)p4d_val (*p4dp) = (unsigned long )invalid_pud_table; } -static inline unsigned long p4d_page_vaddr (p4d_t p4d) +static inline pud_t *p4d_pgtable (p4d_t p4d) { -return p4d_val (p4d); +return (pud_t *)p4d_val (p4d); }#define p4d_phys (p4d) virt_to_phys((void *)p4d_val(p4d))
arch/powerpc/include/asm/book3s/64/pgtable.h +4 -1
@@ -1048,7 +1048,10 @@ extern struct page *p4d_page(p4d_t p4d);/* Pointers in the page table tree are physical addresses */ #define __pgtable_ptr_val (ptr) __pa(ptr) -#define p4d_page_vaddr (p4d) __va(p4d_val(p4d) & ~P4D_MASKED_BITS) +static inline pud_t *p4d_pgtable (p4d_t p4d) +{ +return (pud_t *)__va (p4d_val (p4d) & ~P4D_MASKED_BITS ); +}static inline pmd_t *pud_pgtable (pud_t pud) {
arch/powerpc/include/asm/nohash/64/pgtable-4k.h +5 -1
@@ -56,10 +56,14 @@#define p4d_none (p4d) (!p4d_val(p4d))#define p4d_bad (p4d) (p4d_val(p4d) == 0)#define p4d_present (p4d) (p4d_val(p4d) != 0) -#define p4d_page_vaddr (p4d) (p4d_val(p4d) & ~P4D_MASKED_BITS)#ifndef __ASSEMBLY__ +static inline pud_t *p4d_pgtable (p4d_t p4d) +{ +return (pud_t *) (p4d_val (p4d) & ~P4D_MASKED_BITS ); +} +static inline void p4d_clear (p4d_t *p4dp) { *p4dp =__p4d (0 );
arch/powerpc/mm/book3s64/radix_pgtable.c +1 -1
@@ -859,7 +859,7 @@ static void __meminit remove_pagetable(unsigned long start, unsigned long end)continue ; } - pud_base = (pud_t *)p4d_page_vaddr (*p4d); + pud_base =p4d_pgtable (*p4d);remove_pud_table (pud_base, addr, next);free_pud_table (pud_base, p4d); }
arch/powerpc/mm/pgtable_64.c +1 -1
@@ -105,7 +105,7 @@ struct page *p4d_page(p4d_t p4d)VM_WARN_ON (!p4d_huge (p4d)); return pte_page(p4d_pte(p4d)); } -return virt_to_page (p4d_page_vaddr (p4d)); +return virt_to_page (p4d_pgtable (p4d)); }#endif
arch/sparc/include/asm/pgtable_64.h +2 -2
@@ -860,8 +860,8 @@ static inline pmd_t *pud_pgtable(pud_t pud)#define pmd_clear (pmdp) (pmd_val(*(pmdp)) = 0UL)#define pud_present (pud) (pud_val(pud) != 0U)#define pud_clear (pudp) (pud_val(*(pudp)) = 0UL) -#define p4d_page_vaddr (p4d) \ - ((unsigned long) __va(p4d_val(p4d))) +#define p4d_pgtable (p4d) \ + ((pud_t *) __va(p4d_val(p4d)))#define p4d_present (p4d) (p4d_val(p4d) != 0U)#define p4d_clear (p4dp) (p4d_val(*(p4dp)) = 0UL)
arch/x86/include/asm/pgtable.h +2 -2
@@ -906,9 +906,9 @@ static inline int p4d_present(p4d_t p4d)return p4d_flags (p4d) & _PAGE_PRESENT; } -static inline unsigned long p4d_page_vaddr (p4d_t p4d) +static inline pud_t *p4d_pgtable (p4d_t p4d) { -return (unsigned long )__va (p4d_val (p4d) &p4d_pfn_mask (p4d)); +return (pud_t *)__va (p4d_val (p4d) &p4d_pfn_mask (p4d)); }/*
arch/x86/mm/init_64.c +2 -2
@@ -193,8 +193,8 @@ static void sync_global_pgds_l4(unsigned long start, unsigned long end)spin_lock (pgt_lock);if (!p4d_none (*p4d_ref) && !p4d_none (*p4d)) -BUG_ON (p4d_page_vaddr (*p4d) - !=p4d_page_vaddr (*p4d_ref)); +BUG_ON (p4d_pgtable (*p4d) + !=p4d_pgtable (*p4d_ref));if (p4d_none (*p4d))set_p4d (p4d, *p4d_ref);
include/asm-generic/pgtable-nop4d.h +1 -1
@@ -42,7 +42,7 @@ static inline p4d_t *p4d_offset(pgd_t *pgd, unsigned long address)#define __p4d (x) ((p4d_t) { __pgd(x) })#define pgd_page (pgd) (p4d_page((p4d_t){ pgd })) -#define pgd_page_vaddr (pgd) (p4d_page_vaddr((p4d_t){ pgd })) +#define pgd_page_vaddr (pgd) (p4d_pgtable((p4d_t){ pgd }))/* * allocating and freeing a p4d is trivial: the 1-entry p4d is
include/asm-generic/pgtable-nopud.h +1 -1
@@ -49,7 +49,7 @@ static inline pud_t *pud_offset(p4d_t *p4d, unsigned long address)#define __pud (x) ((pud_t) { __p4d(x) })#define p4d_page (p4d) (pud_page((pud_t){ p4d })) -#define p4d_page_vaddr (p4d) (pud_pgtable((pud_t){ p4d })) +#define p4d_pgtable (p4d) ((pud_t *)(pud_pgtable((pud_t){ p4d })))/* * allocating and freeing a pud is trivial: the 1-entry pud is
include/linux/pgtable.h +1 -1
@@ -96,7 +96,7 @@ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long address)#ifndef pud_offsetstatic inline pud_t *pud_offset (p4d_t *p4d,unsigned long address) { -return (pud_t *)p4d_page_vaddr (*p4d) +pud_index (address); +return p4d_pgtable (*p4d) +pud_index (address); }#define pud_offset pud_offset#endif
Signature · 1 line
2.31.1
Quoted 5 lines · Aneesh Kumar K.V
No functional change in this patch.
Signed-off-by Aneesh Kumar K.V <[email protected]>arch/m68k/include/asm/motorola_pgtable.h | 2 +-
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
kernel test robot
build botRe: [PATCH v2 2/2] mm: rename p4d_page_vaddr to p4d_pgtable and make it return pud_t *
In reply to Aneesh Kumar K.VI love your patch! Perhaps something to improve:
Hi "Aneesh,
I love your patch! Perhaps something to improve:
[auto build test WARNING on powerpc/next]
[also build test WARNING on asm-generic/master tip/x86/mm linus/master sparc/master v5.13-rc6 next-20210615] [cannot apply to hnaz-linux-mm/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Aneesh-Kumar-K-V/mm-rename-pud_page_vaddr-to-pud_pgtable-and-make-it-return-pmd_t/20210616-162847 base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next config: m68k-allmodconfig (attached as .config) compiler: m68k-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/3eb7b4e26cc0ea2cf27fc7b23daa95f1f681cfd8
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Aneesh-Kumar-K-V/mm-rename-pud_page_vaddr-to-pud_pgtable-and-make-it-return-pmd_t/20210616-162847 git checkout 3eb7b4e26cc0ea2cf27fc7b23daa95f1f681cfd8
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=m68k
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
arch/m68k/mm/motorola.c: In function 'kernel_ptr_table':
>> arch/m68k/mm/motorola.c:265:8: warning: assignment to 'long unsigned int' from 'pud_t *' {aka 'struct <anonymous> *'} makes integer from pointer without a cast [-Wint-conversion]
265 | pmd = pgd_page_vaddr(kernel_pg_dir[i]);
| ^
arch/m68k/mm/motorola.c: At top level:
arch/m68k/mm/motorola.c:390:13: warning: no previous prototype for 'paging_init' [-Wmissing-prototypes]
390 | void __init paging_init(void)
| ^~~~~~~~~~~vim +265 arch/m68k/mm/motorola.c
^1da177e4c3f415 Linus Torvalds 2005-04-16 248
^1da177e4c3f415 Linus Torvalds 2005-04-16 249 static pmd_t * __init kernel_ptr_table(void)
^1da177e4c3f415 Linus Torvalds 2005-04-16 250 {
ef9285f69f0efbc Peter Zijlstra 2020-01-31 251 if (!last_pmd_table) {
^1da177e4c3f415 Linus Torvalds 2005-04-16 252 unsigned long pmd, last;
^1da177e4c3f415 Linus Torvalds 2005-04-16 253 int i;
^1da177e4c3f415 Linus Torvalds 2005-04-16 254
^1da177e4c3f415 Linus Torvalds 2005-04-16 255 /* Find the last ptr table that was used in head.S and
^1da177e4c3f415 Linus Torvalds 2005-04-16 256 * reuse the remaining space in that page for further
^1da177e4c3f415 Linus Torvalds 2005-04-16 257 * ptr tables.
^1da177e4c3f415 Linus Torvalds 2005-04-16 258 */
^1da177e4c3f415 Linus Torvalds 2005-04-16 259 last = (unsigned long)kernel_pg_dir;
^1da177e4c3f415 Linus Torvalds 2005-04-16 260 for (i = 0; i < PTRS_PER_PGD; i++) {
60e50f34b13e9e4 Mike Rapoport 2019-12-04 261 pud_t *pud = (pud_t *)(&kernel_pg_dir[i]);
60e50f34b13e9e4 Mike Rapoport 2019-12-04 262
60e50f34b13e9e4 Mike Rapoport 2019-12-04 263 if (!pud_present(*pud))
^1da177e4c3f415 Linus Torvalds 2005-04-16 264 continue;
60e50f34b13e9e4 Mike Rapoport 2019-12-04 @265 pmd = pgd_page_vaddr(kernel_pg_dir[i]);
^1da177e4c3f415 Linus Torvalds 2005-04-16 266 if (pmd > last)
^1da177e4c3f415 Linus Torvalds 2005-04-16 267 last = pmd;
^1da177e4c3f415 Linus Torvalds 2005-04-16 268 }
^1da177e4c3f415 Linus Torvalds 2005-04-16 269
ef9285f69f0efbc Peter Zijlstra 2020-01-31 270 last_pmd_table = (pmd_t *)last;
^1da177e4c3f415 Linus Torvalds 2005-04-16 271 #ifdef DEBUG
ef9285f69f0efbc Peter Zijlstra 2020-01-31 272 printk("kernel_ptr_init: %p\n", last_pmd_table);
^1da177e4c3f415 Linus Torvalds 2005-04-16 273 #endif
^1da177e4c3f415 Linus Torvalds 2005-04-16 274 }
^1da177e4c3f415 Linus Torvalds 2005-04-16 275
ef9285f69f0efbc Peter Zijlstra 2020-01-31 276 last_pmd_table += PTRS_PER_PMD;
41f1bf37a63ecdb Geert Uytterhoeven 2020-08-26 277 if (PAGE_ALIGNED(last_pmd_table)) {
7e158826564fbbb Geert Uytterhoeven 2020-08-26 278 last_pmd_table = memblock_alloc_low(PAGE_SIZE, PAGE_SIZE);
ef9285f69f0efbc Peter Zijlstra 2020-01-31 279 if (!last_pmd_table)
8a7f97b902f4fb0 Mike Rapoport 2019-03-11 280 panic("%s: Failed to allocate %lu bytes align=%lx\n",
8a7f97b902f4fb0 Mike Rapoport 2019-03-11 281 __func__, PAGE_SIZE, PAGE_SIZE);
^1da177e4c3f415 Linus Torvalds 2005-04-16 282
ef9285f69f0efbc Peter Zijlstra 2020-01-31 283 clear_page(last_pmd_table);
ef9285f69f0efbc Peter Zijlstra 2020-01-31 284 mmu_page_ctor(last_pmd_table);
^1da177e4c3f415 Linus Torvalds 2005-04-16 285 }
^1da177e4c3f415 Linus Torvalds 2005-04-16 286
ef9285f69f0efbc Peter Zijlstra 2020-01-31 287 return last_pmd_table;
^1da177e4c3f415 Linus Torvalds 2005-04-16 288 }
^1da177e4c3f415 Linus Torvalds 2005-04-16 289 ---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kernel test robot
build botI love your patch! Perhaps something to improve:
Hi "Aneesh,
I love your patch! Perhaps something to improve:
[auto build test WARNING on powerpc/next]
[also build test WARNING on asm-generic/master tip/x86/mm linus/master sparc/master v5.13-rc6 next-20210615] [cannot apply to hnaz-linux-mm/master sparc-next/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Aneesh-Kumar-K-V/mm-rename-pud_page_vaddr-to-pud_pgtable-and-make-it-return-pmd_t/20210616-162847 base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next config: alpha-randconfig-r026-20210615 (attached as .config) compiler: alpha-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/8af9180cf61ec19f32f0594a59277d0cabff5317
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Aneesh-Kumar-K-V/mm-rename-pud_page_vaddr-to-pud_pgtable-and-make-it-return-pmd_t/20210616-162847 git checkout 8af9180cf61ec19f32f0594a59277d0cabff5317
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=alpha
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
arch/alpha/kernel/asm-offsets.c:15:6: warning: no previous prototype for 'foo' [-Wmissing-prototypes]
15 | void foo(void)
| ^~~
In file included from include/linux/pgtable.h:6,
from include/linux/mm.h:33,
from include/linux/pid_namespace.h:7,
from include/linux/ptrace.h:10,
from arch/alpha/kernel/asm-offsets.c:11:
>> arch/alpha/include/asm/pgtable.h:295:15: warning: 'pud_pgtable' is static but used in inline function 'pmd_offset' which is not static
295 | pmd_t *ret = pud_pgtable(*dir) + ((address >> PMD_SHIFT) & (PTRS_PER_PAGE - 1));
| ^~~~~~~~~~~
--
In file included from include/linux/pgtable.h:6,
from include/linux/mm.h:33,
from arch/alpha/include/asm/io.h:8,
from include/linux/io.h:13,
from include/linux/irq.h:20,
from arch/alpha/kernel/irq_srm.c:8:
>> arch/alpha/include/asm/pgtable.h:295:15: warning: 'pud_pgtable' is static but used in inline function 'pmd_offset' which is not static
295 | pmd_t *ret = pud_pgtable(*dir) + ((address >> PMD_SHIFT) & (PTRS_PER_PAGE - 1));
| ^~~~~~~~~~~--
arch/alpha/kernel/traps.c:212:1: warning: no previous prototype for 'do_entArith' [-Wmissing-prototypes]
212 | do_entArith(unsigned long summary, unsigned long write_mask,
| ^~~~~~~~~~~
arch/alpha/kernel/traps.c:234:1: warning: no previous prototype for 'do_entIF' [-Wmissing-prototypes]
234 | do_entIF(unsigned long type, struct pt_regs *regs)
| ^~~~~~~~
arch/alpha/kernel/traps.c:401:1: warning: no previous prototype for 'do_entDbg' [-Wmissing-prototypes]
401 | do_entDbg(struct pt_regs *regs)
| ^~~~~~~~~
arch/alpha/kernel/traps.c:437:1: warning: no previous prototype for 'do_entUna' [-Wmissing-prototypes]
437 | do_entUna(void * va, unsigned long opcode, unsigned long reg,
| ^~~~~~~~~
arch/alpha/kernel/traps.c:722:1: warning: no previous prototype for 'do_entUnaUser' [-Wmissing-prototypes]
722 | do_entUnaUser(void __user * va, unsigned long opcode,
| ^~~~~~~~~~~~~
arch/alpha/kernel/traps.c:977:1: warning: no previous prototype for 'trap_init' [-Wmissing-prototypes]
977 | trap_init(void)
| ^~~~~~~~~
In file included from include/linux/pgtable.h:6,
from include/linux/mm.h:33,
from arch/alpha/kernel/traps.c:13:
>> arch/alpha/include/asm/pgtable.h:295:15: warning: 'pud_pgtable' is static but used in inline function 'pmd_offset' which is not static
295 | pmd_t *ret = pud_pgtable(*dir) + ((address >> PMD_SHIFT) & (PTRS_PER_PAGE - 1));
| ^~~~~~~~~~~--
arch/alpha/kernel/process.c:57:6: warning: no previous prototype for 'arch_cpu_idle' [-Wmissing-prototypes]
57 | void arch_cpu_idle(void)
| ^~~~~~~~~~~~~
arch/alpha/kernel/process.c:63:6: warning: no previous prototype for 'arch_cpu_idle_dead' [-Wmissing-prototypes]
63 | void arch_cpu_idle_dead(void)
| ^~~~~~~~~~~~~~~~~~
In file included from include/linux/pgtable.h:6,
from include/linux/mm.h:33,
from arch/alpha/kernel/process.c:19:
>> arch/alpha/include/asm/pgtable.h:295:15: warning: 'pud_pgtable' is static but used in inline function 'pmd_offset' which is not static
295 | pmd_t *ret = pud_pgtable(*dir) + ((address >> PMD_SHIFT) & (PTRS_PER_PAGE - 1));
| ^~~~~~~~~~~--
arch/alpha/kernel/irq.c:96:1: warning: no previous prototype for 'handle_irq' [-Wmissing-prototypes]
96 | handle_irq(int irq)
| ^~~~~~~~~~
In file included from include/linux/pgtable.h:6,
from include/linux/mm.h:33,
from arch/alpha/include/asm/io.h:8,
from include/linux/io.h:13,
from include/linux/irq.h:20,
from include/asm-generic/hardirq.h:17,
from arch/alpha/include/asm/hardirq.h:8,
from include/linux/hardirq.h:11,
from include/linux/interrupt.h:11,
from include/linux/kernel_stat.h:9,
from arch/alpha/kernel/irq.c:17:
>> arch/alpha/include/asm/pgtable.h:295:15: warning: 'pud_pgtable' is static but used in inline function 'pmd_offset' which is not static
295 | pmd_t *ret = pud_pgtable(*dir) + ((address >> PMD_SHIFT) & (PTRS_PER_PAGE - 1));
| ^~~~~~~~~~~--
arch/alpha/kernel/irq_alpha.c:45:1: warning: no previous prototype for 'do_entInt' [-Wmissing-prototypes]
45 | do_entInt(unsigned long type, unsigned long vector,
| ^~~~~~~~~
arch/alpha/kernel/irq_alpha.c:103:1: warning: no previous prototype for 'init_IRQ' [-Wmissing-prototypes]
103 | init_IRQ(void)
| ^~~~~~~~
In file included from include/linux/pgtable.h:6,
from include/linux/mm.h:33,
from arch/alpha/include/asm/io.h:8,
from include/linux/io.h:13,
from include/linux/irq.h:20,
from arch/alpha/kernel/irq_alpha.c:8:
>> arch/alpha/include/asm/pgtable.h:295:15: warning: 'pud_pgtable' is static but used in inline function 'pmd_offset' which is not static
295 | pmd_t *ret = pud_pgtable(*dir) + ((address >> PMD_SHIFT) & (PTRS_PER_PAGE - 1));
| ^~~~~~~~~~~--
arch/alpha/kernel/signal.c:204:1: warning: no previous prototype for 'do_sigreturn' [-Wmissing-prototypes]
204 | do_sigreturn(struct sigcontext __user *sc)
| ^~~~~~~~~~~~
arch/alpha/kernel/signal.c:232:1: warning: no previous prototype for 'do_rt_sigreturn' [-Wmissing-prototypes]
232 | do_rt_sigreturn(struct rt_sigframe __user *frame)
| ^~~~~~~~~~~~~~~
arch/alpha/kernel/signal.c:522:1: warning: no previous prototype for 'do_work_pending' [-Wmissing-prototypes]
522 | do_work_pending(struct pt_regs *regs, unsigned long thread_flags,
| ^~~~~~~~~~~~~~~
In file included from include/linux/pgtable.h:6,
from include/linux/mm.h:33,
from include/linux/pid_namespace.h:7,
from include/linux/ptrace.h:10,
from arch/alpha/kernel/signal.c:16:
>> arch/alpha/include/asm/pgtable.h:295:15: warning: 'pud_pgtable' is static but used in inline function 'pmd_offset' which is not static
295 | pmd_t *ret = pud_pgtable(*dir) + ((address >> PMD_SHIFT) & (PTRS_PER_PAGE - 1));
| ^~~~~~~~~~~--
arch/alpha/kernel/setup.c:289:1: warning: no previous prototype for 'move_initrd' [-Wmissing-prototypes]
289 | move_initrd(unsigned long mem_limit)
| ^~~~~~~~~~~
In file included from include/linux/pgtable.h:6,
from include/linux/mm.h:33,
from arch/alpha/kernel/setup.c:16:
>> arch/alpha/include/asm/pgtable.h:295:15: warning: 'pud_pgtable' is static but used in inline function 'pmd_offset' which is not static
295 | pmd_t *ret = pud_pgtable(*dir) + ((address >> PMD_SHIFT) & (PTRS_PER_PAGE - 1));
| ^~~~~~~~~~~--
arch/alpha/kernel/ptrace.c:321:26: warning: no previous prototype for 'syscall_trace_enter' [-Wmissing-prototypes]
321 | asmlinkage unsigned long syscall_trace_enter(void)
| ^~~~~~~~~~~~~~~~~~~
arch/alpha/kernel/ptrace.c:333:1: warning: no previous prototype for 'syscall_trace_leave' [-Wmissing-prototypes]
333 | syscall_trace_leave(void)
| ^~~~~~~~~~~~~~~~~~~
In file included from include/linux/pgtable.h:6,
from include/linux/mm.h:33,
from arch/alpha/kernel/ptrace.c:11:
>> arch/alpha/include/asm/pgtable.h:295:15: warning: 'pud_pgtable' is static but used in inline function 'pmd_offset' which is not static
295 | pmd_t *ret = pud_pgtable(*dir) + ((address >> PMD_SHIFT) & (PTRS_PER_PAGE - 1));
| ^~~~~~~~~~~--
arch/alpha/kernel/time.c:64:6: warning: no previous prototype for 'arch_irq_work_raise' [-Wmissing-prototypes]
64 | void arch_irq_work_raise(void)
| ^~~~~~~~~~~~~~~~~~~
arch/alpha/kernel/time.c:390:1: warning: no previous prototype for 'time_init' [-Wmissing-prototypes]
390 | time_init(void)
| ^~~~~~~~~
In file included from include/linux/pgtable.h:6,
from include/linux/mm.h:33,
from arch/alpha/kernel/time.c:28:
>> arch/alpha/include/asm/pgtable.h:295:15: warning: 'pud_pgtable' is static but used in inline function 'pmd_offset' which is not static
295 | pmd_t *ret = pud_pgtable(*dir) + ((address >> PMD_SHIFT) & (PTRS_PER_PAGE - 1));
| ^~~~~~~~~~~
--
arch/alpha/kernel/io.c:637:1: warning: no previous prototype for 'scr_memcpyw' [-Wmissing-prototypes]
637 | scr_memcpyw(u16 *d, const u16 *s, unsigned int count)
| ^~~~~~~~~~~
In file included from include/linux/pgtable.h:6,
from include/linux/mm.h:33,
from arch/alpha/include/asm/io.h:8,
from arch/alpha/kernel/io.c:10:
>> arch/alpha/include/asm/pgtable.h:295:15: warning: 'pud_pgtable' is static but used in inline function 'pmd_offset' which is not static
295 | pmd_t *ret = pud_pgtable(*dir) + ((address >> PMD_SHIFT) & (PTRS_PER_PAGE - 1));
| ^~~~~~~~~~~..
vim +295 arch/alpha/include/asm/pgtable.h
278
279 /*
280 * The smp_rmb() in the following functions are required to order the load of
281 * *dir (the pointer in the top level page table) with any subsequent load of
282 * the returned pmd_t *ret (ret is data dependent on *dir).
283 *
284 * If this ordering is not enforced, the CPU might load an older value of
285 * *ret, which may be uninitialized data. See mm/memory.c:__pte_alloc for
286 * more details.
287 *
288 * Note that we never change the mm->pgd pointer after the task is running, so
289 * pgd_offset does not require such a barrier.
290 */
291
292 /* Find an entry in the second-level page table.. */
293 extern inline pmd_t * pmd_offset(pud_t * dir, unsigned long address)
294 {
> 295 pmd_t *ret = pud_pgtable(*dir) + ((address >> PMD_SHIFT) & (PTRS_PER_PAGE - 1));
296 smp_rmb(); /* see above */
297 return ret;
298 }
299 #define pmd_offset pmd_offset
300
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Hi Andrew,
With all the mailing list on Cc: I find the mails are not reaching the list? Hence private email
Quoted 16 lines · Aneesh Kumar K.V
No functional change in this patch.
arch/alpha/include/asm/pgtable.h +1 -1
@@ -239,7 +239,7 @@ pmd_page_vaddr(pmd_t pmd)#define pmd_page (pmd) (pfn_to_page(pmd_val(pmd) >> 32))#define pud_page (pud) (pfn_to_page(pud_val(pud) >> 32)) -static inline pmd_t *pud_pgtable (pud_t pgd) +extern inline pmd_t *pud_pgtable (pud_t pgd) {return (pmd_t *)(PAGE_OFFSET + ((pud_val (pgd) & _PFN_MASK) >> (32 -PAGE_SHIFT ))); }
Re: [PATCH v2 2/2] mm: rename p4d_page_vaddr to p4d_pgtable and make it return pud_t *
In reply to Aneesh Kumar K.VHi Andrew,
With all the mailing list on Cc: I find the mails are not reaching the list? Hence private email
Quoted 15 lines · Aneesh Kumar K.V
No functional change in this patch.
m68k build error reported by kernel robot.
We may want to fixup pgd_page_vaddr correctly later. pgd_page_vaddr() gets cast to different pointer types based on architecture. But for now this should work? This ensure we keep the pgd_page_vaddr() same as before.
include/asm-generic/pgtable-nop4d.h +1 -1
@@ -42,7 +42,7 @@ static inline p4d_t *p4d_offset(pgd_t *pgd, unsigned long address)#define __p4d (x) ((p4d_t) { __pgd(x) })#define pgd_page (pgd) (p4d_page((p4d_t){ pgd })) -#define pgd_page_vaddr (pgd) (p4d_pgtable((p4d_t){ pgd })) +#define pgd_page_vaddr (pgd) ((unsigned long)(p4d_pgtable((p4d_t){ pgd })))/* * allocating and freeing a p4d is trivial: the 1-entry p4d is