[ammarfaizi2-block:palmer/linux/riscv-sv48 1/9] arch/riscv/include/asm/pgtable-64.h:69:9: error: use of undeclared identifier 'PTRS_PER_PGD'

From: kernel test robot
Date: Tue Jan 18 2022 - 20:09:17 EST


tree: https://github.com/ammarfaizi2/linux-block palmer/linux/riscv-sv48
head: d87f3297c62644624bcb8efcb519a2e28d684b45
commit: 86168d52ec671f83f5b6e7f49adfd90ee2f12f23 [1/9] riscv: Move KASAN mapping next to the kernel mapping
config: riscv-randconfig-r042-20220118 (https://download.01.org/0day-ci/archive/20220119/202201190958.fitxHfBp-lkp@xxxxxxxxx/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project c10cbb243cafc0cf42c3e922cb29183279444432)
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/ammarfaizi2/linux-block/commit/86168d52ec671f83f5b6e7f49adfd90ee2f12f23
git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
git fetch --no-tags ammarfaizi2-block palmer/linux/riscv-sv48
git checkout 86168d52ec671f83f5b6e7f49adfd90ee2f12f23
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv prepare

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

In file included from arch/riscv/kernel/asm-offsets.c:10:
In file included from include/linux/mm.h:33:
In file included from include/linux/pgtable.h:6:
In file included from arch/riscv/include/asm/pgtable.h:95:
>> arch/riscv/include/asm/pgtable-64.h:69:9: error: use of undeclared identifier 'PTRS_PER_PGD'
return pfn_to_page(pud_val(pud) >> _PAGE_PFN_SHIFT);
^
include/asm-generic/memory_model.h:53:21: note: expanded from macro 'pfn_to_page'
#define pfn_to_page __pfn_to_page
^
include/asm-generic/memory_model.h:25:29: note: expanded from macro '__pfn_to_page'
#define __pfn_to_page(pfn) (vmemmap + (pfn))
^
arch/riscv/include/asm/pgtable.h:63:34: note: expanded from macro 'vmemmap'
#define vmemmap ((struct page *)VMEMMAP_START)
^
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
arch/riscv/include/asm/pgtable.h:29:41: note: expanded from macro 'VMALLOC_START'
#define VMALLOC_START (PAGE_OFFSET - VMALLOC_SIZE)
^
arch/riscv/include/asm/pgtable.h:27:27: note: expanded from macro 'VMALLOC_SIZE'
#define VMALLOC_SIZE (KERN_VIRT_SIZE >> 1)
^
arch/riscv/include/asm/page.h:40:27: note: expanded from macro 'KERN_VIRT_SIZE'
#define KERN_VIRT_SIZE ((PTRS_PER_PGD / 2 * PGDIR_SIZE) / 2)
^
1 error generated.
make[2]: *** [scripts/Makefile.build:121: arch/riscv/kernel/asm-offsets.s] Error 1
make[2]: Target '__build' not remade because of errors.
make[1]: *** [Makefile:1197: prepare0] Error 2
make[1]: Target 'prepare' not remade because of errors.
make: *** [Makefile:219: __sub-make] Error 2
make: Target 'prepare' not remade because of errors.


vim +/PTRS_PER_PGD +69 arch/riscv/include/asm/pgtable-64.h

07037db5d479f9 Palmer Dabbelt 2017-07-10 66
8ad8b72721d0f0 Nick Hu 2020-01-06 67 static inline struct page *pud_page(pud_t pud)
8ad8b72721d0f0 Nick Hu 2020-01-06 68 {
8ad8b72721d0f0 Nick Hu 2020-01-06 @69 return pfn_to_page(pud_val(pud) >> _PAGE_PFN_SHIFT);
8ad8b72721d0f0 Nick Hu 2020-01-06 70 }
8ad8b72721d0f0 Nick Hu 2020-01-06 71

:::::: The code at line 69 was first introduced by commit
:::::: 8ad8b72721d0f07fa02dbe71f901743f9c71c8e6 riscv: Add KASAN support

:::::: TO: Nick Hu <nickhu@xxxxxxxxxxxxx>
:::::: CC: Palmer Dabbelt <palmerdabbelt@xxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx