Re: [PATCH v2 7/9] userfaultfd: add UFFDIO_CONTINUE ioctl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Axel,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on arm64/for-next/core]
[also build test ERROR on powerpc/next s390/features tip/perf/core linus/master v5.11-rc5 next-20210122]
[cannot apply to hp-parisc/for-next hnaz-linux-mm/master ia64/next sparc-next/master sparc/master]
[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/Axel-Rasmussen/userfaultfd-add-minor-fault-handling/20210125-104035
base:   https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core
config: powerpc-randconfig-r006-20210125 (attached as .config)
compiler: powerpc-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/b8fb53c3a341b9b853aa3286286c807088311dbd
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Axel-Rasmussen/userfaultfd-add-minor-fault-handling/20210125-104035
        git checkout b8fb53c3a341b9b853aa3286286c807088311dbd
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=powerpc 

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

All error/warnings (new ones prefixed by >>):

   In file included from fs/proc/task_mmu.c:4:
>> include/linux/hugetlb.h:142:10: warning: 'enum mcopy_atomic_mode' declared inside parameter list will not be visible outside of this definition or declaration
     142 |     enum mcopy_atomic_mode mode,
         |          ^~~~~~~~~~~~~~~~~
--
   In file included from fs/proc/meminfo.c:6:
>> include/linux/hugetlb.h:142:10: warning: 'enum mcopy_atomic_mode' declared inside parameter list will not be visible outside of this definition or declaration
     142 |     enum mcopy_atomic_mode mode,
         |          ^~~~~~~~~~~~~~~~~
   fs/proc/meminfo.c:22:28: warning: no previous prototype for 'arch_report_meminfo' [-Wmissing-prototypes]
      22 | void __attribute__((weak)) arch_report_meminfo(struct seq_file *m)
         |                            ^~~~~~~~~~~~~~~~~~~
--
   In file included from kernel/events/core.c:31:
>> include/linux/hugetlb.h:142:10: warning: 'enum mcopy_atomic_mode' declared inside parameter list will not be visible outside of this definition or declaration
     142 |     enum mcopy_atomic_mode mode,
         |          ^~~~~~~~~~~~~~~~~
   kernel/events/core.c:6535:6: warning: no previous prototype for 'perf_pmu_snapshot_aux' [-Wmissing-prototypes]
    6535 | long perf_pmu_snapshot_aux(struct perf_buffer *rb,
         |      ^~~~~~~~~~~~~~~~~~~~~
--
   In file included from kernel/fork.c:51:
>> include/linux/hugetlb.h:142:10: warning: 'enum mcopy_atomic_mode' declared inside parameter list will not be visible outside of this definition or declaration
     142 |     enum mcopy_atomic_mode mode,
         |          ^~~~~~~~~~~~~~~~~
   kernel/fork.c:161:13: warning: no previous prototype for 'arch_release_task_struct' [-Wmissing-prototypes]
     161 | void __weak arch_release_task_struct(struct task_struct *tsk)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~
   kernel/fork.c:746:20: warning: no previous prototype for 'arch_task_cache_init' [-Wmissing-prototypes]
     746 | void __init __weak arch_task_cache_init(void) { }
         |                    ^~~~~~~~~~~~~~~~~~~~
--
   In file included from arch/powerpc/mm/pgtable.c:25:
>> include/linux/hugetlb.h:142:10: warning: 'enum mcopy_atomic_mode' declared inside parameter list will not be visible outside of this definition or declaration
     142 |     enum mcopy_atomic_mode mode,
         |          ^~~~~~~~~~~~~~~~~
   arch/powerpc/mm/pgtable.c:337:8: warning: no previous prototype for '__find_linux_pte' [-Wmissing-prototypes]
     337 | pte_t *__find_linux_pte(pgd_t *pgdir, unsigned long ea,
         |        ^~~~~~~~~~~~~~~~
--
   In file included from include/linux/migrate.h:8,
                    from mm/page_alloc.c:61:
>> include/linux/hugetlb.h:142:10: warning: 'enum mcopy_atomic_mode' declared inside parameter list will not be visible outside of this definition or declaration
     142 |     enum mcopy_atomic_mode mode,
         |          ^~~~~~~~~~~~~~~~~
   mm/page_alloc.c:3597:15: warning: no previous prototype for 'should_fail_alloc_page' [-Wmissing-prototypes]
    3597 | noinline bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order)
         |               ^~~~~~~~~~~~~~~~~~~~~~
   mm/page_alloc.c:6258:23: warning: no previous prototype for 'memmap_init' [-Wmissing-prototypes]
    6258 | void __meminit __weak memmap_init(unsigned long size, int nid,
         |                       ^~~~~~~~~~~
--
   In file included from mm/hugetlb.c:39:
>> include/linux/hugetlb.h:142:10: warning: 'enum mcopy_atomic_mode' declared inside parameter list will not be visible outside of this definition or declaration
     142 |     enum mcopy_atomic_mode mode,
         |          ^~~~~~~~~~~~~~~~~
>> mm/hugetlb.c:4659:13: warning: 'enum mcopy_atomic_mode' declared inside parameter list will not be visible outside of this definition or declaration
    4659 |        enum mcopy_atomic_mode mode,
         |             ^~~~~~~~~~~~~~~~~
>> mm/hugetlb.c:4659:31: error: parameter 6 ('mode') has incomplete type
    4659 |        enum mcopy_atomic_mode mode,
         |        ~~~~~~~~~~~~~~~~~~~~~~~^~~~
   mm/hugetlb.c: In function 'hugetlb_mcopy_atomic_pte':
>> mm/hugetlb.c:4675:25: error: 'MCOPY_ATOMIC_CONTINUE' undeclared (first use in this function)
    4675 |  if (!*pagep && mode != MCOPY_ATOMIC_CONTINUE) {
         |                         ^~~~~~~~~~~~~~~~~~~~~
   mm/hugetlb.c:4675:25: note: each undeclared identifier is reported only once for each function it appears in
--
   In file included from mm/util.c:16:
>> include/linux/hugetlb.h:142:10: warning: 'enum mcopy_atomic_mode' declared inside parameter list will not be visible outside of this definition or declaration
     142 |     enum mcopy_atomic_mode mode,
         |          ^~~~~~~~~~~~~~~~~
   mm/util.c: In function 'page_mapping':
   mm/util.c:700:15: warning: variable 'entry' set but not used [-Wunused-but-set-variable]
     700 |   swp_entry_t entry;
         |               ^~~~~
--
   In file included from include/linux/migrate.h:8,
                    from mm/compaction.c:13:
>> include/linux/hugetlb.h:142:10: warning: 'enum mcopy_atomic_mode' declared inside parameter list will not be visible outside of this definition or declaration
     142 |     enum mcopy_atomic_mode mode,
         |          ^~~~~~~~~~~~~~~~~
   mm/compaction.c:56:27: warning: 'HPAGE_FRAG_CHECK_INTERVAL_MSEC' defined but not used [-Wunused-const-variable=]
      56 | static const unsigned int HPAGE_FRAG_CHECK_INTERVAL_MSEC = 500;
         |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
   In file included from include/linux/migrate.h:8,
                    from kernel/sched/sched.h:53,
                    from kernel/sched/fair.c:23:
>> include/linux/hugetlb.h:142:10: warning: 'enum mcopy_atomic_mode' declared inside parameter list will not be visible outside of this definition or declaration
     142 |     enum mcopy_atomic_mode mode,
         |          ^~~~~~~~~~~~~~~~~
   kernel/sched/fair.c:5388:6: warning: no previous prototype for 'init_cfs_bandwidth' [-Wmissing-prototypes]
    5388 | void init_cfs_bandwidth(struct cfs_bandwidth *cfs_b) {}
         |      ^~~~~~~~~~~~~~~~~~
   kernel/sched/fair.c:11195:6: warning: no previous prototype for 'free_fair_sched_group' [-Wmissing-prototypes]
   11195 | void free_fair_sched_group(struct task_group *tg) { }
         |      ^~~~~~~~~~~~~~~~~~~~~
   kernel/sched/fair.c:11197:5: warning: no previous prototype for 'alloc_fair_sched_group' [-Wmissing-prototypes]
   11197 | int alloc_fair_sched_group(struct task_group *tg, struct task_group *parent)
         |     ^~~~~~~~~~~~~~~~~~~~~~
   kernel/sched/fair.c:11202:6: warning: no previous prototype for 'online_fair_sched_group' [-Wmissing-prototypes]
   11202 | void online_fair_sched_group(struct task_group *tg) { }
         |      ^~~~~~~~~~~~~~~~~~~~~~~
   kernel/sched/fair.c:11204:6: warning: no previous prototype for 'unregister_fair_sched_group' [-Wmissing-prototypes]
   11204 | void unregister_fair_sched_group(struct task_group *tg) { }
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
--
   In file included from include/linux/migrate.h:8,
                    from kernel/sched/sched.h:53,
                    from kernel/sched/rt.c:6:
>> include/linux/hugetlb.h:142:10: warning: 'enum mcopy_atomic_mode' declared inside parameter list will not be visible outside of this definition or declaration
     142 |     enum mcopy_atomic_mode mode,
         |          ^~~~~~~~~~~~~~~~~
   kernel/sched/rt.c:253:6: warning: no previous prototype for 'free_rt_sched_group' [-Wmissing-prototypes]
     253 | void free_rt_sched_group(struct task_group *tg) { }
         |      ^~~~~~~~~~~~~~~~~~~
   kernel/sched/rt.c:255:5: warning: no previous prototype for 'alloc_rt_sched_group' [-Wmissing-prototypes]
     255 | int alloc_rt_sched_group(struct task_group *tg, struct task_group *parent)
         |     ^~~~~~~~~~~~~~~~~~~~
   kernel/sched/rt.c:669:6: warning: no previous prototype for 'sched_rt_bandwidth_account' [-Wmissing-prototypes]
     669 | bool sched_rt_bandwidth_account(struct rt_rq *rt_rq)
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~~
..


vim +4659 mm/hugetlb.c

  4649	
  4650	/*
  4651	 * Used by userfaultfd UFFDIO_COPY.  Based on mcopy_atomic_pte with
  4652	 * modifications for huge pages.
  4653	 */
  4654	int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm,
  4655				    pte_t *dst_pte,
  4656				    struct vm_area_struct *dst_vma,
  4657				    unsigned long dst_addr,
  4658				    unsigned long src_addr,
> 4659				    enum mcopy_atomic_mode mode,
  4660				    struct page **pagep)
  4661	{
  4662		struct address_space *mapping;
  4663		pgoff_t idx;
  4664		unsigned long size;
  4665		int vm_shared = dst_vma->vm_flags & VM_SHARED;
  4666		struct hstate *h = hstate_vma(dst_vma);
  4667		pte_t _dst_pte;
  4668		spinlock_t *ptl;
  4669		int ret;
  4670		struct page *page;
  4671	
  4672		mapping = dst_vma->vm_file->f_mapping;
  4673		idx = vma_hugecache_offset(h, dst_vma, dst_addr);
  4674	
> 4675		if (!*pagep && mode != MCOPY_ATOMIC_CONTINUE) {
  4676			ret = -ENOMEM;
  4677			page = alloc_huge_page(dst_vma, dst_addr, 0);
  4678			if (IS_ERR(page))
  4679				goto out;
  4680	
  4681			ret = copy_huge_page_from_user(page,
  4682							(const void __user *) src_addr,
  4683							pages_per_huge_page(h), false);
  4684	
  4685			/* fallback to copy_from_user outside mmap_lock */
  4686			if (unlikely(ret)) {
  4687				ret = -ENOENT;
  4688				*pagep = page;
  4689				/* don't free the page */
  4690				goto out;
  4691			}
  4692		} else if (mode == MCOPY_ATOMIC_CONTINUE) {
  4693			ret = -EFAULT;
  4694			page = find_lock_page(mapping, idx);
  4695			*pagep = NULL;
  4696			if (!page)
  4697				goto out;
  4698		} else {
  4699			page = *pagep;
  4700			*pagep = NULL;
  4701		}
  4702	
  4703		/*
  4704		 * The memory barrier inside __SetPageUptodate makes sure that
  4705		 * preceding stores to the page contents become visible before
  4706		 * the set_pte_at() write.
  4707		 */
  4708		__SetPageUptodate(page);
  4709	
  4710		/* Add shared, newly allocated pages to the page cache. */
  4711		if (vm_shared && mode != MCOPY_ATOMIC_CONTINUE) {
  4712			size = i_size_read(mapping->host) >> huge_page_shift(h);
  4713			ret = -EFAULT;
  4714			if (idx >= size)
  4715				goto out_release_nounlock;
  4716	
  4717			/*
  4718			 * Serialization between remove_inode_hugepages() and
  4719			 * huge_add_to_page_cache() below happens through the
  4720			 * hugetlb_fault_mutex_table that here must be hold by
  4721			 * the caller.
  4722			 */
  4723			ret = huge_add_to_page_cache(page, mapping, idx);
  4724			if (ret)
  4725				goto out_release_nounlock;
  4726		}
  4727	
  4728		ptl = huge_pte_lockptr(h, dst_mm, dst_pte);
  4729		spin_lock(ptl);
  4730	
  4731		/*
  4732		 * Recheck the i_size after holding PT lock to make sure not
  4733		 * to leave any page mapped (as page_mapped()) beyond the end
  4734		 * of the i_size (remove_inode_hugepages() is strict about
  4735		 * enforcing that). If we bail out here, we'll also leave a
  4736		 * page in the radix tree in the vm_shared case beyond the end
  4737		 * of the i_size, but remove_inode_hugepages() will take care
  4738		 * of it as soon as we drop the hugetlb_fault_mutex_table.
  4739		 */
  4740		size = i_size_read(mapping->host) >> huge_page_shift(h);
  4741		ret = -EFAULT;
  4742		if (idx >= size)
  4743			goto out_release_unlock;
  4744	
  4745		ret = -EEXIST;
  4746		if (!huge_pte_none(huge_ptep_get(dst_pte)))
  4747			goto out_release_unlock;
  4748	
  4749		if (vm_shared) {
  4750			page_dup_rmap(page, true);
  4751		} else {
  4752			ClearPagePrivate(page);
  4753			hugepage_add_new_anon_rmap(page, dst_vma, dst_addr);
  4754		}
  4755	
  4756		_dst_pte = make_huge_pte(dst_vma, page, dst_vma->vm_flags & VM_WRITE);
  4757		if (dst_vma->vm_flags & VM_WRITE)
  4758			_dst_pte = huge_pte_mkdirty(_dst_pte);
  4759		_dst_pte = pte_mkyoung(_dst_pte);
  4760	
  4761		set_huge_pte_at(dst_mm, dst_addr, dst_pte, _dst_pte);
  4762	
  4763		(void)huge_ptep_set_access_flags(dst_vma, dst_addr, dst_pte, _dst_pte,
  4764						dst_vma->vm_flags & VM_WRITE);
  4765		hugetlb_count_add(pages_per_huge_page(h), dst_mm);
  4766	
  4767		/* No need to invalidate - it was non-present before */
  4768		update_mmu_cache(dst_vma, dst_addr, dst_pte);
  4769	
  4770		spin_unlock(ptl);
  4771		if (mode != MCOPY_ATOMIC_CONTINUE)
  4772			set_page_huge_active(page);
  4773		if (vm_shared)
  4774			unlock_page(page);
  4775		ret = 0;
  4776	out:
  4777		return ret;
  4778	out_release_unlock:
  4779		spin_unlock(ptl);
  4780		if (vm_shared)
  4781			unlock_page(page);
  4782	out_release_nounlock:
  4783		put_page(page);
  4784		goto out;
  4785	}
  4786	

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux