Message ID | 20210616230804.7nsBdkkF4%akpm@linux-foundation.org (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | [to-be-updated] mm-rename-pud_page_vaddr-to-pud_pgtable-and-make-it-return-pmd_t.patch removed from -mm tree | expand |
Hi,
I love your patch! Perhaps something to improve:
[auto build test WARNING on powerpc/next]
[also build test WARNING on tip/x86/mm asm-generic/master linus/master sparc/master v5.13-rc7]
[cannot apply to sparc-next/master next-20210621]
[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/akpm-linux-foundation-org/mm-rename-pud_page_vaddr-to-pud_pgtable-and-make-it-return-pmd_t-patch-removed-from-mm-tree/20210617-075958
base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: m68k-randconfig-r011-20210621 (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/490957abd94a7b67576c0029c771c6691dce1878
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review akpm-linux-foundation-org/mm-rename-pud_page_vaddr-to-pud_pgtable-and-make-it-return-pmd_t-patch-removed-from-mm-tree/20210617-075958
git checkout 490957abd94a7b67576c0029c771c6691dce1878
# 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
Reported-by: kernel test robot <lkp@intel.com>
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 'pmd_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
^1da177e4c3f41 Linus Torvalds 2005-04-16 248
^1da177e4c3f41 Linus Torvalds 2005-04-16 249 static pmd_t * __init kernel_ptr_table(void)
^1da177e4c3f41 Linus Torvalds 2005-04-16 250 {
ef9285f69f0efb Peter Zijlstra 2020-01-31 251 if (!last_pmd_table) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 252 unsigned long pmd, last;
^1da177e4c3f41 Linus Torvalds 2005-04-16 253 int i;
^1da177e4c3f41 Linus Torvalds 2005-04-16 254
^1da177e4c3f41 Linus Torvalds 2005-04-16 255 /* Find the last ptr table that was used in head.S and
^1da177e4c3f41 Linus Torvalds 2005-04-16 256 * reuse the remaining space in that page for further
^1da177e4c3f41 Linus Torvalds 2005-04-16 257 * ptr tables.
^1da177e4c3f41 Linus Torvalds 2005-04-16 258 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 259 last = (unsigned long)kernel_pg_dir;
^1da177e4c3f41 Linus Torvalds 2005-04-16 260 for (i = 0; i < PTRS_PER_PGD; i++) {
60e50f34b13e9e Mike Rapoport 2019-12-04 261 pud_t *pud = (pud_t *)(&kernel_pg_dir[i]);
60e50f34b13e9e Mike Rapoport 2019-12-04 262
60e50f34b13e9e Mike Rapoport 2019-12-04 263 if (!pud_present(*pud))
^1da177e4c3f41 Linus Torvalds 2005-04-16 264 continue;
60e50f34b13e9e Mike Rapoport 2019-12-04 @265 pmd = pgd_page_vaddr(kernel_pg_dir[i]);
^1da177e4c3f41 Linus Torvalds 2005-04-16 266 if (pmd > last)
^1da177e4c3f41 Linus Torvalds 2005-04-16 267 last = pmd;
^1da177e4c3f41 Linus Torvalds 2005-04-16 268 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 269
ef9285f69f0efb Peter Zijlstra 2020-01-31 270 last_pmd_table = (pmd_t *)last;
^1da177e4c3f41 Linus Torvalds 2005-04-16 271 #ifdef DEBUG
ef9285f69f0efb Peter Zijlstra 2020-01-31 272 printk("kernel_ptr_init: %p\n", last_pmd_table);
^1da177e4c3f41 Linus Torvalds 2005-04-16 273 #endif
^1da177e4c3f41 Linus Torvalds 2005-04-16 274 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 275
ef9285f69f0efb Peter Zijlstra 2020-01-31 276 last_pmd_table += PTRS_PER_PMD;
41f1bf37a63ecd Geert Uytterhoeven 2020-08-26 277 if (PAGE_ALIGNED(last_pmd_table)) {
7e158826564fbb Geert Uytterhoeven 2020-08-26 278 last_pmd_table = memblock_alloc_low(PAGE_SIZE, PAGE_SIZE);
ef9285f69f0efb Peter Zijlstra 2020-01-31 279 if (!last_pmd_table)
8a7f97b902f4fb Mike Rapoport 2019-03-11 280 panic("%s: Failed to allocate %lu bytes align=%lx\n",
8a7f97b902f4fb Mike Rapoport 2019-03-11 281 __func__, PAGE_SIZE, PAGE_SIZE);
^1da177e4c3f41 Linus Torvalds 2005-04-16 282
ef9285f69f0efb Peter Zijlstra 2020-01-31 283 clear_page(last_pmd_table);
ef9285f69f0efb Peter Zijlstra 2020-01-31 284 mmu_page_ctor(last_pmd_table);
^1da177e4c3f41 Linus Torvalds 2005-04-16 285 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 286
ef9285f69f0efb Peter Zijlstra 2020-01-31 287 return last_pmd_table;
^1da177e4c3f41 Linus Torvalds 2005-04-16 288 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 289
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Hi,
I love your patch! Perhaps something to improve:
[auto build test WARNING on powerpc/next]
[also build test WARNING on tip/x86/mm asm-generic/master linus/master sparc/master v5.13-rc7]
[cannot apply to sparc-next/master next-20210622]
[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/akpm-linux-foundation-org/mm-rename-pud_page_vaddr-to-pud_pgtable-and-make-it-return-pmd_t-patch-removed-from-mm-tree/20210617-075958
base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: riscv-randconfig-r036-20210622 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project b3634d3e88b7f26534a5057bff182b7dced584fc)
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
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/490957abd94a7b67576c0029c771c6691dce1878
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review akpm-linux-foundation-org/mm-rename-pud_page_vaddr-to-pud_pgtable-and-make-it-return-pmd_t-patch-removed-from-mm-tree/20210617-075958
git checkout 490957abd94a7b67576c0029c771c6691dce1878
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> arch/riscv/mm/kasan_init.c:122:29: warning: comparison between pointer and integer ('pmd_t *' and 'unsigned long') [-Wpointer-integer-compare]
if (pgd_page_vaddr(*pgdp) == (unsigned long)lm_alias(kasan_early_shadow_pmd) &&
~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/riscv/mm/kasan_init.c:154:30: warning: comparison between pointer and integer ('pmd_t *' and 'unsigned long') [-Wpointer-integer-compare]
if (pgd_page_vaddr(*pgd_k) == (unsigned long)lm_alias(kasan_early_shadow_pmd)) {
~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for LOCKDEP
Depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT && (FRAME_POINTER || MIPS || PPC || S390 || MICROBLAZE || ARM || ARC || X86)
Selected by
- LOCK_STAT && DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT
- DEBUG_LOCK_ALLOC && DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT
vim +122 arch/riscv/mm/kasan_init.c
d127c19c7bea61 Alexandre Ghiti 2021-02-08 107
1987501b1130c6 Jisheng Zhang 2021-03-30 108 static void __init kasan_populate_pgd(unsigned long vaddr, unsigned long end)
d127c19c7bea61 Alexandre Ghiti 2021-02-08 109 {
d127c19c7bea61 Alexandre Ghiti 2021-02-08 110 phys_addr_t phys_addr;
d127c19c7bea61 Alexandre Ghiti 2021-02-08 111 pgd_t *pgdp = pgd_offset_k(vaddr);
d127c19c7bea61 Alexandre Ghiti 2021-02-08 112 unsigned long next;
d127c19c7bea61 Alexandre Ghiti 2021-02-08 113
d127c19c7bea61 Alexandre Ghiti 2021-02-08 114 do {
d127c19c7bea61 Alexandre Ghiti 2021-02-08 115 next = pgd_addr_end(vaddr, end);
d7fbcf40df86bb Alexandre Ghiti 2021-02-08 116
d7fbcf40df86bb Alexandre Ghiti 2021-02-08 117 /*
d7fbcf40df86bb Alexandre Ghiti 2021-02-08 118 * pgdp can't be none since kasan_early_init initialized all KASAN
d7fbcf40df86bb Alexandre Ghiti 2021-02-08 119 * shadow region with kasan_early_shadow_pmd: if this is stillthe case,
d7fbcf40df86bb Alexandre Ghiti 2021-02-08 120 * that means we can try to allocate a hugepage as a replacement.
d7fbcf40df86bb Alexandre Ghiti 2021-02-08 121 */
d7fbcf40df86bb Alexandre Ghiti 2021-02-08 @122 if (pgd_page_vaddr(*pgdp) == (unsigned long)lm_alias(kasan_early_shadow_pmd) &&
d7fbcf40df86bb Alexandre Ghiti 2021-02-08 123 IS_ALIGNED(vaddr, PGDIR_SIZE) && (next - vaddr) >= PGDIR_SIZE) {
d7fbcf40df86bb Alexandre Ghiti 2021-02-08 124 phys_addr = memblock_phys_alloc(PGDIR_SIZE, PGDIR_SIZE);
d7fbcf40df86bb Alexandre Ghiti 2021-02-08 125 if (phys_addr) {
d7fbcf40df86bb Alexandre Ghiti 2021-02-08 126 set_pgd(pgdp, pfn_pgd(PFN_DOWN(phys_addr), PAGE_KERNEL));
d7fbcf40df86bb Alexandre Ghiti 2021-02-08 127 continue;
d7fbcf40df86bb Alexandre Ghiti 2021-02-08 128 }
d7fbcf40df86bb Alexandre Ghiti 2021-02-08 129 }
d7fbcf40df86bb Alexandre Ghiti 2021-02-08 130
d127c19c7bea61 Alexandre Ghiti 2021-02-08 131 kasan_populate_pmd(pgdp, vaddr, next);
d127c19c7bea61 Alexandre Ghiti 2021-02-08 132 } while (pgdp++, vaddr = next, vaddr != end);
d127c19c7bea61 Alexandre Ghiti 2021-02-08 133 }
d127c19c7bea61 Alexandre Ghiti 2021-02-08 134
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Hi, I love your patch! Yet something to improve: [auto build test ERROR on powerpc/next] [also build test ERROR on tip/x86/mm asm-generic/master linus/master sparc/master v5.13] [cannot apply to sparc-next/master next-20210629] [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/akpm-linux-foundation-org/mm-rename-pud_page_vaddr-to-pud_pgtable-and-make-it-return-pmd_t-patch-removed-from-mm-tree/20210617-075958 base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next config: sparc-defconfig (attached as .config) compiler: sparc-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/490957abd94a7b67576c0029c771c6691dce1878 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review akpm-linux-foundation-org/mm-rename-pud_page_vaddr-to-pud_pgtable-and-make-it-return-pmd_t-patch-removed-from-mm-tree/20210617-075958 git checkout 490957abd94a7b67576c0029c771c6691dce1878 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sparc If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): In file included from arch/sparc/include/asm/pgtable.h:7, from include/linux/pgtable.h:6, from include/linux/mm.h:33, from include/linux/kallsyms.h:12, from include/linux/ftrace.h:12, from include/linux/kprobes.h:29, from include/linux/kgdb.h:19, from arch/sparc/kernel/kgdb_32.c:7: arch/sparc/include/asm/pgtable_32.h: In function 'pud_pgtable': >> arch/sparc/include/asm/pgtable_32.h:158:10: error: returning 'int' from a function with return type 'pmd_t *' {aka 'long unsigned int *'} makes pointer from integer without a cast [-Werror=int-conversion] 158 | return ~0; | ^ cc1: all warnings being treated as errors -- In file included from arch/sparc/include/asm/pgtable.h:7, from include/linux/pgtable.h:6, from arch/sparc/kernel/traps_32.c:21: arch/sparc/include/asm/pgtable_32.h: In function 'pud_pgtable': >> arch/sparc/include/asm/pgtable_32.h:158:10: error: returning 'int' from a function with return type 'pmd_t *' {aka 'long unsigned int *'} makes pointer from integer without a cast [-Werror=int-conversion] 158 | return ~0; | ^ arch/sparc/kernel/traps_32.c: At top level: arch/sparc/kernel/traps_32.c:368:6: error: no previous prototype for 'trap_init' [-Werror=missing-prototypes] 368 | void trap_init(void) | ^~~~~~~~~ cc1: all warnings being treated as errors -- In file included from arch/sparc/include/asm/pgtable.h:7, from arch/sparc/include/asm/viking.h:13, from arch/sparc/include/asm/mbus.h:12, from arch/sparc/include/asm/elf_32.h:94, from arch/sparc/include/asm/elf.h:7, from include/linux/elf.h:6, from include/linux/module.h:18, from include/linux/moduleloader.h:6, from arch/sparc/kernel/module.c:8: arch/sparc/include/asm/pgtable_32.h: In function 'pud_pgtable': >> arch/sparc/include/asm/pgtable_32.h:158:10: error: returning 'int' from a function with return type 'pmd_t *' {aka 'long unsigned int *'} makes pointer from integer without a cast [-Werror=int-conversion] 158 | return ~0; | ^ arch/sparc/kernel/module.c: In function 'module_frob_arch_sections': arch/sparc/kernel/module.c:62:8: error: variable 'strtab' set but not used [-Werror=unused-but-set-variable] 62 | char *strtab; | ^~~~~~ cc1: all warnings being treated as errors -- In file included from arch/sparc/include/asm/pgtable.h:7, from include/linux/pgtable.h:6, from include/linux/mm.h:33, from include/linux/memblock.h:13, from arch/sparc/mm/srmmu.c:14: arch/sparc/include/asm/pgtable_32.h: In function 'pud_pgtable': >> arch/sparc/include/asm/pgtable_32.h:158:10: error: returning 'int' from a function with return type 'pmd_t *' {aka 'long unsigned int *'} makes pointer from integer without a cast [-Werror=int-conversion] 158 | return ~0; | ^ arch/sparc/mm/srmmu.c: In function 'poke_hypersparc': arch/sparc/mm/srmmu.c:1081:25: error: variable 'clear' set but not used [-Werror=unused-but-set-variable] 1081 | volatile unsigned long clear; | ^~~~~ cc1: all warnings being treated as errors -- In file included from arch/sparc/include/asm/pgtable.h:7, from include/linux/pgtable.h:6, from include/linux/mm.h:33, from arch/sparc/mm/leon_mm.c:14: arch/sparc/include/asm/pgtable_32.h: In function 'pud_pgtable': >> arch/sparc/include/asm/pgtable_32.h:158:10: error: returning 'int' from a function with return type 'pmd_t *' {aka 'long unsigned int *'} makes pointer from integer without a cast [-Werror=int-conversion] 158 | return ~0; | ^ arch/sparc/mm/leon_mm.c: In function 'leon_swprobe': arch/sparc/mm/leon_mm.c:42:25: error: variable 'paddrbase' set but not used [-Werror=unused-but-set-variable] 42 | unsigned int lvl, pte, paddrbase; | ^~~~~~~~~ cc1: all warnings being treated as errors -- In file included from arch/sparc/include/asm/pgtable.h:7, from arch/sparc/include/asm/viking.h:13, from arch/sparc/include/asm/mbus.h:12, from arch/sparc/include/asm/elf_32.h:94, from arch/sparc/include/asm/elf.h:7, from include/linux/elf.h:6, from include/linux/module.h:18, from arch/sparc/lib/cmpdi2.c:2: arch/sparc/include/asm/pgtable_32.h: In function 'pud_pgtable': >> arch/sparc/include/asm/pgtable_32.h:158:10: error: returning 'int' from a function with return type 'pmd_t *' {aka 'long unsigned int *'} makes pointer from integer without a cast [-Werror=int-conversion] 158 | return ~0; | ^ arch/sparc/lib/cmpdi2.c: At top level: arch/sparc/lib/cmpdi2.c:6:11: error: no previous prototype for '__cmpdi2' [-Werror=missing-prototypes] 6 | word_type __cmpdi2(long long a, long long b) | ^~~~~~~~ cc1: all warnings being treated as errors -- In file included from arch/sparc/include/asm/pgtable.h:7, from arch/sparc/include/asm/viking.h:13, from arch/sparc/include/asm/mbus.h:12, from arch/sparc/include/asm/elf_32.h:94, from arch/sparc/include/asm/elf.h:7, from include/linux/elf.h:6, from include/linux/module.h:18, from arch/sparc/lib/ucmpdi2.c:2: arch/sparc/include/asm/pgtable_32.h: In function 'pud_pgtable': >> arch/sparc/include/asm/pgtable_32.h:158:10: error: returning 'int' from a function with return type 'pmd_t *' {aka 'long unsigned int *'} makes pointer from integer without a cast [-Werror=int-conversion] 158 | return ~0; | ^ arch/sparc/lib/ucmpdi2.c: At top level: arch/sparc/lib/ucmpdi2.c:5:11: error: no previous prototype for '__ucmpdi2' [-Werror=missing-prototypes] 5 | word_type __ucmpdi2(unsigned long long a, unsigned long long b) | ^~~~~~~~~ cc1: all warnings being treated as errors vim +158 arch/sparc/include/asm/pgtable_32.h 974b9b2c68f3d3 arch/sparc/include/asm/pgtable_32.h Mike Rapoport 2020-06-08 154 490957abd94a7b arch/sparc/include/asm/pgtable_32.h Andrew Morton 2021-06-16 155 static inline pmd_t *pud_pgtable(pud_t pud) 9701b264d3267b arch/sparc/include/asm/pgtable_32.h Sam Ravnborg 2012-05-13 156 { 7235db268a2777 arch/sparc/include/asm/pgtable_32.h Mike Rapoport 2019-12-04 157 if (srmmu_device_memory(pud_val(pud))) { 9701b264d3267b arch/sparc/include/asm/pgtable_32.h Sam Ravnborg 2012-05-13 @158 return ~0; 9701b264d3267b arch/sparc/include/asm/pgtable_32.h Sam Ravnborg 2012-05-13 159 } else { 7235db268a2777 arch/sparc/include/asm/pgtable_32.h Mike Rapoport 2019-12-04 160 unsigned long v = pud_val(pud) & SRMMU_PTD_PMASK; 490957abd94a7b arch/sparc/include/asm/pgtable_32.h Andrew Morton 2021-06-16 161 return (pmd_t *)__nocache_va(v << 4); 9701b264d3267b arch/sparc/include/asm/pgtable_32.h Sam Ravnborg 2012-05-13 162 } 9701b264d3267b arch/sparc/include/asm/pgtable_32.h Sam Ravnborg 2012-05-13 163 } f5e706ad886b6a include/asm-sparc/pgtable_32.h Sam Ravnborg 2008-07-17 164 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
--- a/arch/alpha/include/asm/pgtable.h~mm-rename-pud_page_vaddr-to-pud_pgtable-and-make-it-return-pmd_t +++ a/arch/alpha/include/asm/pgtable.h @@ -236,8 +236,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; } @@ -287,7 +289,7 @@ extern inline pte_t pte_mkyoung(pte_t pt /* 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; } --- a/arch/arm64/include/asm/pgtable.h~mm-rename-pud_page_vaddr-to-pud_pgtable-and-make-it-return-pmd_t +++ a/arch/arm64/include/asm/pgtable.h @@ -633,9 +633,9 @@ static inline phys_addr_t pud_page_paddr 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. */ --- a/arch/arm/include/asm/pgtable-3level.h~mm-rename-pud_page_vaddr-to-pud_pgtable-and-make-it-return-pmd_t +++ a/arch/arm/include/asm/pgtable-3level.h @@ -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); } --- a/arch/ia64/include/asm/pgtable.h~mm-rename-pud_page_vaddr-to-pud_pgtable-and-make-it-return-pmd_t +++ a/arch/ia64/include/asm/pgtable.h @@ -273,7 +273,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 --- a/arch/m68k/include/asm/motorola_pgtable.h~mm-rename-pud_page_vaddr-to-pud_pgtable-and-make-it-return-pmd_t +++ a/arch/m68k/include/asm/motorola_pgtable.h @@ -131,7 +131,7 @@ static inline void pud_set(pud_t *pudp, #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)) --- a/arch/mips/include/asm/pgtable-64.h~mm-rename-pud_page_vaddr-to-pud_pgtable-and-make-it-return-pmd_t +++ a/arch/mips/include/asm/pgtable-64.h @@ -313,9 +313,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)) --- a/arch/parisc/include/asm/pgtable.h~mm-rename-pud_page_vaddr-to-pud_pgtable-and-make-it-return-pmd_t +++ a/arch/parisc/include/asm/pgtable.h @@ -322,8 +322,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 */ --- a/arch/powerpc/include/asm/book3s/64/pgtable.h~mm-rename-pud_page_vaddr-to-pud_pgtable-and-make-it-return-pmd_t +++ a/arch/powerpc/include/asm/book3s/64/pgtable.h @@ -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) \ --- a/arch/powerpc/include/asm/nohash/64/pgtable.h~mm-rename-pud_page_vaddr-to-pud_pgtable-and-make-it-return-pmd_t +++ a/arch/powerpc/include/asm/nohash/64/pgtable.h @@ -162,7 +162,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); --- a/arch/powerpc/mm/book3s64/radix_pgtable.c~mm-rename-pud_page_vaddr-to-pud_pgtable-and-make-it-return-pmd_t +++ a/arch/powerpc/mm/book3s64/radix_pgtable.c @@ -826,7 +826,7 @@ static void __meminit remove_pud_table(p 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); } @@ -1111,7 +1111,7 @@ int pud_free_pmd_page(pud_t *pud, unsign 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); --- a/arch/powerpc/mm/pgtable_64.c~mm-rename-pud_page_vaddr-to-pud_pgtable-and-make-it-return-pmd_t +++ a/arch/powerpc/mm/pgtable_64.c @@ -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)); } /* --- a/arch/riscv/include/asm/pgtable-64.h~mm-rename-pud_page_vaddr-to-pud_pgtable-and-make-it-return-pmd_t +++ a/arch/riscv/include/asm/pgtable-64.h @@ -59,9 +59,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) --- a/arch/sh/include/asm/pgtable-3level.h~mm-rename-pud_page_vaddr-to-pud_pgtable-and-make-it-return-pmd_t +++ a/arch/sh/include/asm/pgtable-3level.h @@ -32,9 +32,9 @@ typedef struct { unsigned long long pmd; #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 */ --- a/arch/sparc/include/asm/pgtable_32.h~mm-rename-pud_page_vaddr-to-pud_pgtable-and-make-it-return-pmd_t +++ a/arch/sparc/include/asm/pgtable_32.h @@ -151,13 +151,13 @@ static inline unsigned long pmd_page_vad 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); } } --- a/arch/sparc/include/asm/pgtable_64.h~mm-rename-pud_page_vaddr-to-pud_pgtable-and-make-it-return-pmd_t +++ a/arch/sparc/include/asm/pgtable_64.h @@ -841,18 +841,18 @@ static inline unsigned long pmd_page_vad 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) --- a/arch/um/include/asm/pgtable-3level.h~mm-rename-pud_page_vaddr-to-pud_pgtable-and-make-it-return-pmd_t +++ a/arch/um/include/asm/pgtable-3level.h @@ -83,7 +83,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) { --- a/arch/x86/include/asm/pgtable.h~mm-rename-pud_page_vaddr-to-pud_pgtable-and-make-it-return-pmd_t +++ a/arch/x86/include/asm/pgtable.h @@ -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)); } /* --- a/arch/x86/mm/pat/set_memory.c~mm-rename-pud_page_vaddr-to-pud_pgtable-and-make-it-return-pmd_t +++ a/arch/x86/mm/pat/set_memory.c @@ -1134,7 +1134,7 @@ static void __unmap_pmd_range(pud_t *pud 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, * 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); } --- a/arch/x86/mm/pgtable.c~mm-rename-pud_page_vaddr-to-pud_pgtable-and-make-it-return-pmd_t +++ a/arch/x86/mm/pgtable.c @@ -801,7 +801,7 @@ int pud_free_pmd_page(pud_t *pud, unsign 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; --- a/include/asm-generic/pgtable-nopmd.h~mm-rename-pud_page_vaddr-to-pud_pgtable-and-make-it-return-pmd_t +++ a/include/asm-generic/pgtable-nopmd.h @@ -51,7 +51,7 @@ static inline pmd_t * pmd_offset(pud_t * #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 --- a/include/asm-generic/pgtable-nopud.h~mm-rename-pud_page_vaddr-to-pud_pgtable-and-make-it-return-pmd_t +++ a/include/asm-generic/pgtable-nopud.h @@ -49,7 +49,7 @@ static inline pud_t *pud_offset(p4d_t *p #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 --- a/include/linux/pgtable.h~mm-rename-pud_page_vaddr-to-pud_pgtable-and-make-it-return-pmd_t +++ a/include/linux/pgtable.h @@ -106,7 +106,7 @@ static inline pte_t *pte_offset_kernel(p #ifndef pmd_offset static 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