[PATCH v2 1/7] powerpc/mm: Implement set_memory() routines

kbuild test robot lkp at intel.com
Mon Feb 3 14:45:49 AEDT 2020


Hi Christophe,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on powerpc/next]
[also build test ERROR on next-20200131]
[cannot apply to v5.5]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Christophe-Leroy/powerpc-mm-Implement-set_memory-routines/20200203-060234
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-ppc64_defconfig (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 7.5.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.5.0 make.cross ARCH=powerpc 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp at intel.com>

All errors (new ones prefixed by >>):

   arch/powerpc/mm/pageattr.c: In function 'change_page_attr':
>> arch/powerpc/mm/pageattr.c:32:15: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
     int action = (int)data;
                  ^
   arch/powerpc/mm/pageattr.c: In function 'change_memory_attr':
>> arch/powerpc/mm/pageattr.c:73:68: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
     return apply_to_page_range(&init_mm, start, sz, change_page_attr, (void *)action);
                                                                       ^
   cc1: all warnings being treated as errors

vim +32 arch/powerpc/mm/pageattr.c

    15	
    16	
    17	/*
    18	 * Updates the attributes of a page in three steps:
    19	 *
    20	 * 1. invalidate the page table entry
    21	 * 2. flush the TLB
    22	 * 3. install the new entry with the updated attributes
    23	 *
    24	 * This is unsafe if the caller is attempting to change the mapping of the
    25	 * page it is executing from, or if another CPU is concurrently using the
    26	 * page being altered.
    27	 *
    28	 * TODO make the implementation resistant to this.
    29	 */
    30	static int change_page_attr(pte_t *ptep, unsigned long addr, void *data)
    31	{
  > 32		int action = (int)data;
    33		pte_t pte;
    34	
    35		spin_lock(&init_mm.page_table_lock);
    36	
    37		/* invalidate the PTE so it's safe to modify */
    38		pte = ptep_get_and_clear(&init_mm, addr, ptep);
    39		flush_tlb_kernel_range(addr, addr + PAGE_SIZE);
    40	
    41		/* modify the PTE bits as desired, then apply */
    42		switch (action) {
    43		case SET_MEMORY_RO:
    44			pte = pte_wrprotect(pte);
    45			break;
    46		case SET_MEMORY_RW:
    47			pte = pte_mkwrite(pte);
    48			break;
    49		case SET_MEMORY_NX:
    50			pte = pte_exprotect(pte);
    51			break;
    52		case SET_MEMORY_X:
    53			pte = pte_mkexec(pte);
    54			break;
    55		default:
    56			break;
    57		}
    58	
    59		set_pte_at(&init_mm, addr, ptep, pte);
    60		spin_unlock(&init_mm.page_table_lock);
    61	
    62		return 0;
    63	}
    64	
    65	int change_memory_attr(unsigned long addr, int numpages, int action)
    66	{
    67		unsigned long start = ALIGN_DOWN(addr, PAGE_SIZE);
    68		unsigned long sz = numpages * PAGE_SIZE;
    69	
    70		if (!numpages)
    71			return 0;
    72	
  > 73		return apply_to_page_range(&init_mm, start, sz, change_page_attr, (void *)action);

---
0-DAY kernel test infrastructure                 Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 25677 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20200203/77a23e02/attachment-0001.gz>


More information about the Linuxppc-dev mailing list