Re: [PATCH V2 2/2] mm/mmap: Drop generic protection_map[] array

From: Anshuman Khandual
Date: Mon Jun 13 2022 - 23:06:49 EST




On 6/13/22 16:43, kernel test robot wrote:
> Hi Anshuman,
>
> Thank you for the patch! Yet something to improve:
>
> [auto build test ERROR on akpm-mm/mm-everything]
>
> url: https://github.com/intel-lab-lkp/linux/commits/Anshuman-Khandual/mm-mmap-Drop-__SXXX-__PXXX-macros-from-across-platforms/20220613-133456
> base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
> config: powerpc64-randconfig-r016-20220613 (https://download.01.org/0day-ci/archive/20220613/202206131931.ZJuanaBo-lkp@xxxxxxxxx/config)
> compiler: powerpc64le-linux-gcc (GCC) 11.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/intel-lab-lkp/linux/commit/696f81b49f7b6316f652d795da4c0008efef4487
> git remote add linux-review https://github.com/intel-lab-lkp/linux
> git fetch --no-tags linux-review Anshuman-Khandual/mm-mmap-Drop-__SXXX-__PXXX-macros-from-across-platforms/20220613-133456
> git checkout 696f81b49f7b6316f652d795da4c0008efef4487
> # save the config file
> mkdir build_dir && cp config build_dir/.config
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=powerpc SHELL=/bin/bash arch/powerpc/mm/book3s64/
>
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
>
> All errors (new ones prefixed by >>):
>
> In file included from arch/powerpc/include/asm/page.h:306,
> from arch/powerpc/include/asm/mmu.h:149,
> from arch/powerpc/include/asm/lppaca.h:46,
> from arch/powerpc/include/asm/paca.h:18,
> from arch/powerpc/include/asm/current.h:13,
> from include/linux/sched.h:12,
> from arch/powerpc/mm/book3s64/pgtable.c:6:
> arch/powerpc/mm/book3s64/pgtable.c: In function 'vm_get_page_prot':
>>> arch/powerpc/mm/book3s64/pgtable.c:557:41: error: 'protection_map' undeclared (first use in this function)
> 557 | unsigned long prot = pgprot_val(protection_map[vm_flags &
> | ^~~~~~~~~~~~~~

Adding an extern declaration fixes the problem. The problem is generic declaration
in include/linux/mm.h is not available for platforms with ARCH_HAS_VM_GET_PAGE_PROT.
protection_map[] has to be moved into arch/powerpc/mm/pgtable.c to be used by both
32 bit and 64 bit platforms.

diff --git a/arch/powerpc/mm/book3s64/pgtable.c b/arch/powerpc/mm/book3s64/pgtable.c
index 260b0cc6d3a1..99c794ab253d 100644
--- a/arch/powerpc/mm/book3s64/pgtable.c
+++ b/arch/powerpc/mm/book3s64/pgtable.c
@@ -551,6 +551,8 @@ unsigned long memremap_compat_align(void)
EXPORT_SYMBOL_GPL(memremap_compat_align);
#endif

+extern pgprot_t protection_map[16];
+
/* Note due to the way vm flags are laid out, the bits are XWR */
pgprot_t vm_get_page_prot(unsigned long vm_flags)
{