Hi Chih-En, Thank you for the patch! Yet something to improve: [auto build test ERROR on v6.1-rc7] [also build test ERROR on next-20221220] [cannot apply to akpm-mm/mm-everything tip/perf/core acme/perf/core linus/master v6.1 v6.1-rc8] [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#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Chih-En-Lin/Introduce-Copy-On-Write-to-Page-Table/20221220-153207 patch link: https://lore.kernel.org/r/20221220072743.3039060-4-shiyn.lin%40gmail.com patch subject: [PATCH v3 03/14] mm: Add break COW PTE fault and helper functions config: powerpc-allnoconfig compiler: powerpc-linux-gcc (GCC) 12.1.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/18accecf2701f7705ada53938cc2005fa15cc063 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Chih-En-Lin/Introduce-Copy-On-Write-to-Page-Table/20221220-153207 git checkout 18accecf2701f7705ada53938cc2005fa15cc063 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=powerpc olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=powerpc SHELL=/bin/bash If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot All errors (new ones prefixed by >>): mm/memory.c: In function 'free_pmd_range': >> mm/memory.c:255:53: error: implicit declaration of function 'pmd_mkwrite'; did you mean 'pmd_write'? [-Werror=implicit-function-declaration] 255 | pmd_t new = pmd_mkwrite(*pmd); | ^~~~~~~~~~~ | pmd_write >> mm/memory.c:255:53: error: invalid initializer mm/memory.c:257:41: error: implicit declaration of function 'set_pmd_at'; did you mean 'set_pte_at'? [-Werror=implicit-function-declaration] 257 | set_pmd_at(tlb->mm, addr, pmd, new); | ^~~~~~~~~~ | set_pte_at >> mm/memory.c:266:33: error: implicit declaration of function 'flush_tlb_mm_range'; did you mean 'flush_tlb_range'? [-Werror=implicit-function-declaration] 266 | flush_tlb_mm_range(tlb->mm, addr, next, | ^~~~~~~~~~~~~~~~~~ | flush_tlb_range In file included from arch/powerpc/include/asm/page.h:331, from arch/powerpc/include/asm/thread_info.h:13, from include/linux/thread_info.h:60, from arch/powerpc/include/asm/ptrace.h:328, from arch/powerpc/include/asm/hw_irq.h:12, from arch/powerpc/include/asm/irqflags.h:12, from include/linux/irqflags.h:16, from include/asm-generic/cmpxchg-local.h:6, from arch/powerpc/include/asm/cmpxchg.h:526, from arch/powerpc/include/asm/atomic.h:11, from include/linux/atomic.h:7, from include/linux/cpumask.h:13, from include/linux/smp.h:13, from include/linux/kernel_stat.h:5, from mm/memory.c:42: mm/memory.c: In function 'copy_cow_pte_range': include/asm-generic/memory_model.h:18:33: error: initialization of 'pgtable_t' {aka 'long unsigned int *'} from incompatible pointer type 'struct page *' [-Werror=incompatible-pointer-types] 18 | #define __pfn_to_page(pfn) (mem_map + ((pfn) - ARCH_PFN_OFFSET)) | ^ include/asm-generic/memory_model.h:53:21: note: in expansion of macro '__pfn_to_page' 53 | #define pfn_to_page __pfn_to_page | ^~~~~~~~~~~~~ arch/powerpc/include/asm/book3s/32/pgtable.h:363:33: note: in expansion of macro 'pfn_to_page' 363 | #define pmd_page(pmd) pfn_to_page(pmd_pfn(pmd)) | ^~~~~~~~~~~ mm/memory.c:1217:31: note: in expansion of macro 'pmd_page' 1217 | pgtable_t pte_table = pmd_page(*src_pmd); | ^~~~~~~~ mm/memory.c:1329:48: error: implicit declaration of function 'pmd_wrprotect'; did you mean 'pte_wrprotect'? [-Werror=implicit-function-declaration] 1329 | set_pmd_at(dst_mm, orig_addr, dst_pmd, pmd_wrprotect(*src_pmd)); | ^~~~~~~~~~~~~ | pte_wrprotect mm/memory.c: In function 'zap_pte_range': mm/memory.c:1722:45: error: invalid initializer 1722 | pmd_t new = pmd_mkwrite(*pmd); | ^~~~~~~~~~~ mm/memory.c: In function 'handle_cow_pte_fault': mm/memory.c:5261:29: error: invalid initializer 5261 | pmd_t new = pmd_mkwrite(*pmd); | ^~~~~~~~~~~ mm/memory.c:5313:29: error: invalid initializer 5313 | pmd_t new = pmd_mkwrite(cowed_entry); | ^~~~~~~~~~~ cc1: some warnings being treated as errors vim +255 mm/memory.c 229 230 static inline void free_pmd_range(struct mmu_gather *tlb, pud_t *pud, 231 unsigned long addr, unsigned long end, 232 unsigned long floor, unsigned long ceiling) 233 { 234 pmd_t *pmd; 235 unsigned long next; 236 unsigned long start; 237 238 start = addr; 239 pmd = pmd_offset(pud, addr); 240 do { 241 next = pmd_addr_end(addr, end); 242 /* 243 * For COW-ed PTE, the pte entries still mapping to pages. 244 * However, we should did de-accounting to all of it. So, 245 * even if the refcount is not the same as zapping, we 246 * could still fall back to normal PTE and handle it 247 * without traversing entries to do the de-accounting. 248 */ 249 if (test_bit(MMF_COW_PTE, &tlb->mm->flags)) { 250 if (!pmd_none(*pmd) && !pmd_write(*pmd)) { 251 spinlock_t *ptl = pte_lockptr(tlb->mm, pmd); 252 253 spin_lock(ptl); 254 if (!pmd_put_pte(pmd)) { > 255 pmd_t new = pmd_mkwrite(*pmd); 256 257 set_pmd_at(tlb->mm, addr, pmd, new); 258 spin_unlock(ptl); 259 free_pte_range(tlb, pmd, addr); 260 continue; 261 } 262 spin_unlock(ptl); 263 264 pmd_clear(pmd); 265 mm_dec_nr_ptes(tlb->mm); > 266 flush_tlb_mm_range(tlb->mm, addr, next, 267 PAGE_SHIFT, false); 268 } else 269 VM_WARN_ON(cow_pte_count(pmd) != 1); 270 } 271 if (pmd_none_or_clear_bad(pmd)) 272 continue; 273 free_pte_range(tlb, pmd, addr); 274 } while (pmd++, addr = next, addr != end); 275 276 start &= PUD_MASK; 277 if (start < floor) 278 return; 279 if (ceiling) { 280 ceiling &= PUD_MASK; 281 if (!ceiling) 282 return; 283 } 284 if (end - 1 > ceiling - 1) 285 return; 286 287 pmd = pmd_offset(pud, start); 288 pud_clear(pud); 289 pmd_free_tlb(tlb, pmd, start); 290 mm_dec_nr_pmds(tlb->mm); 291 } 292 -- 0-DAY CI Kernel Test Service https://01.org/lkp