linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Peter Xu <peterx@redhat.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Cc: clang-built-linux@googlegroups.com, kbuild-all@lists.01.org,
	Axel Rasmussen <axelrasmussen@google.com>,
	Nadav Amit <nadav.amit@gmail.com>,
	Jerome Glisse <jglisse@redhat.com>,
	"Kirill A . Shutemov" <kirill@shutemov.name>,
	Jason Gunthorpe <jgg@ziepe.ca>,
	Alistair Popple <apopple@nvidia.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [PATCH v5 19/26] hugetlb/userfaultfd: Handle UFFDIO_WRITEPROTECT
Date: Wed, 21 Jul 2021 16:24:49 +0800	[thread overview]
Message-ID: <202107211659.FK2HCJwj-lkp@intel.com> (raw)
In-Reply-To: <20210715201630.211865-1-peterx@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 12573 bytes --]

Hi Peter,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on kselftest/next]
[also build test ERROR on linus/master v5.14-rc2 next-20210720]
[cannot apply to hnaz-linux-mm/master asm-generic/master arm64/for-next/core linux/master tip/x86/core]
[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/Peter-Xu/userfaultfd-wp-Support-shmem-and-hugetlbfs/20210716-041947
base:   https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git next
config: s390-randconfig-r023-20210716 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 5d5b08761f944d5b9822d582378333cc4b36a0a7)
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 s390 cross compiling tool for clang build
        # apt-get install binutils-s390x-linux-gnu
        # https://github.com/0day-ci/linux/commit/23779145f29982887db86a44763fa794325c479f
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Peter-Xu/userfaultfd-wp-Support-shmem-and-hugetlbfs/20210716-041947
        git checkout 23779145f29982887db86a44763fa794325c479f
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=s390 

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

All errors (new ones prefixed by >>):

   In file included from mm/hugetlb.c:19:
   In file included from include/linux/memblock.h:14:
   In file included from arch/s390/include/asm/dma.h:5:
   In file included from arch/s390/include/asm/io.h:75:
   include/asm-generic/io.h:464:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __raw_readb(PCI_IOBASE + addr);
                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:477:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:36:59: note: expanded from macro '__le16_to_cpu'
   #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
                                                             ^
   include/uapi/linux/swab.h:102:54: note: expanded from macro '__swab16'
   #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
                                                        ^
   In file included from mm/hugetlb.c:19:
   In file included from include/linux/memblock.h:14:
   In file included from arch/s390/include/asm/dma.h:5:
   In file included from arch/s390/include/asm/io.h:75:
   include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
                                                             ^
   include/uapi/linux/swab.h:115:54: note: expanded from macro '__swab32'
   #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
                                                        ^
   In file included from mm/hugetlb.c:19:
   In file included from include/linux/memblock.h:14:
   In file included from arch/s390/include/asm/dma.h:5:
   In file included from arch/s390/include/asm/io.h:75:
   include/asm-generic/io.h:501:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writeb(value, PCI_IOBASE + addr);
                               ~~~~~~~~~~ ^
   include/asm-generic/io.h:511:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:521:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:609:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsb(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:617:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsw(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:625:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsl(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:634:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesb(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   include/asm-generic/io.h:643:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesw(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   include/asm-generic/io.h:652:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesl(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   mm/hugetlb.c:5063:29: error: implicit declaration of function 'huge_pte_uffd_wp' [-Werror,-Wimplicit-function-declaration]
           if (userfaultfd_wp(vma) && huge_pte_uffd_wp(huge_ptep_get(ptep)) &&
                                      ^
   mm/hugetlb.c:5301:14: error: implicit declaration of function 'huge_pte_mkuffd_wp' [-Werror,-Wimplicit-function-declaration]
                   _dst_pte = huge_pte_mkuffd_wp(_dst_pte);
                              ^
   mm/hugetlb.c:5301:14: note: did you mean 'pte_mkuffd_wp'?
   include/asm-generic/pgtable_uffd.h:18:30: note: 'pte_mkuffd_wp' declared here
   static __always_inline pte_t pte_mkuffd_wp(pte_t pte)
                                ^
   mm/hugetlb.c:5301:12: error: assigning to 'pte_t' from incompatible type 'int'
                   _dst_pte = huge_pte_mkuffd_wp(_dst_pte);
                            ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   mm/hugetlb.c:5595:11: error: implicit declaration of function 'huge_pte_mkuffd_wp' [-Werror,-Wimplicit-function-declaration]
                                   pte = huge_pte_mkuffd_wp(huge_pte_wrprotect(pte));
                                         ^
   mm/hugetlb.c:5595:9: error: assigning to 'pte_t' from incompatible type 'int'
                                   pte = huge_pte_mkuffd_wp(huge_pte_wrprotect(pte));
                                       ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> mm/hugetlb.c:5597:11: error: implicit declaration of function 'huge_pte_clear_uffd_wp' [-Werror,-Wimplicit-function-declaration]
                                   pte = huge_pte_clear_uffd_wp(pte);
                                         ^
   mm/hugetlb.c:5597:11: note: did you mean 'pte_clear_uffd_wp'?
   include/asm-generic/pgtable_uffd.h:28:30: note: 'pte_clear_uffd_wp' declared here
   static __always_inline pte_t pte_clear_uffd_wp(pte_t pte)
                                ^
   mm/hugetlb.c:5597:9: error: assigning to 'pte_t' from incompatible type 'int'
                                   pte = huge_pte_clear_uffd_wp(pte);
                                       ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
   12 warnings and 7 errors generated.


vim +/huge_pte_clear_uffd_wp +5597 mm/hugetlb.c

  5520	
  5521	unsigned long hugetlb_change_protection(struct vm_area_struct *vma,
  5522			unsigned long address, unsigned long end,
  5523			pgprot_t newprot, unsigned long cp_flags)
  5524	{
  5525		struct mm_struct *mm = vma->vm_mm;
  5526		unsigned long start = address;
  5527		pte_t *ptep;
  5528		pte_t pte;
  5529		struct hstate *h = hstate_vma(vma);
  5530		unsigned long pages = 0;
  5531		bool shared_pmd = false;
  5532		struct mmu_notifier_range range;
  5533		bool uffd_wp = cp_flags & MM_CP_UFFD_WP;
  5534		bool uffd_wp_resolve = cp_flags & MM_CP_UFFD_WP_RESOLVE;
  5535	
  5536		/*
  5537		 * In the case of shared PMDs, the area to flush could be beyond
  5538		 * start/end.  Set range.start/range.end to cover the maximum possible
  5539		 * range if PMD sharing is possible.
  5540		 */
  5541		mmu_notifier_range_init(&range, MMU_NOTIFY_PROTECTION_VMA,
  5542					0, vma, mm, start, end);
  5543		adjust_range_if_pmd_sharing_possible(vma, &range.start, &range.end);
  5544	
  5545		BUG_ON(address >= end);
  5546		flush_cache_range(vma, range.start, range.end);
  5547	
  5548		mmu_notifier_invalidate_range_start(&range);
  5549		i_mmap_lock_write(vma->vm_file->f_mapping);
  5550		for (; address < end; address += huge_page_size(h)) {
  5551			spinlock_t *ptl;
  5552			ptep = huge_pte_offset(mm, address, huge_page_size(h));
  5553			if (!ptep)
  5554				continue;
  5555			ptl = huge_pte_lock(h, mm, ptep);
  5556			if (huge_pmd_unshare(mm, vma, &address, ptep)) {
  5557				pages++;
  5558				spin_unlock(ptl);
  5559				shared_pmd = true;
  5560				continue;
  5561			}
  5562			pte = huge_ptep_get(ptep);
  5563			if (unlikely(is_hugetlb_entry_hwpoisoned(pte))) {
  5564				spin_unlock(ptl);
  5565				continue;
  5566			}
  5567			if (unlikely(is_hugetlb_entry_migration(pte))) {
  5568				swp_entry_t entry = pte_to_swp_entry(pte);
  5569	
  5570				if (is_writable_migration_entry(entry)) {
  5571					pte_t newpte;
  5572	
  5573					entry = make_readable_migration_entry(
  5574								swp_offset(entry));
  5575					newpte = swp_entry_to_pte(entry);
  5576					if (uffd_wp)
  5577						newpte = pte_swp_mkuffd_wp(newpte);
  5578					else if (uffd_wp_resolve)
  5579						newpte = pte_swp_clear_uffd_wp(newpte);
  5580					set_huge_swap_pte_at(mm, address, ptep,
  5581							     newpte, huge_page_size(h));
  5582					pages++;
  5583				}
  5584				spin_unlock(ptl);
  5585				continue;
  5586			}
  5587			if (!huge_pte_none(pte)) {
  5588				pte_t old_pte;
  5589				unsigned int shift = huge_page_shift(hstate_vma(vma));
  5590	
  5591				old_pte = huge_ptep_modify_prot_start(vma, address, ptep);
  5592				pte = pte_mkhuge(huge_pte_modify(old_pte, newprot));
  5593				pte = arch_make_huge_pte(pte, shift, vma->vm_flags);
  5594				if (uffd_wp)
  5595					pte = huge_pte_mkuffd_wp(huge_pte_wrprotect(pte));
  5596				else if (uffd_wp_resolve)
> 5597					pte = huge_pte_clear_uffd_wp(pte);
  5598				huge_ptep_modify_prot_commit(vma, address, ptep, old_pte, pte);
  5599				pages++;
  5600			}
  5601			spin_unlock(ptl);
  5602		}
  5603		/*
  5604		 * Must flush TLB before releasing i_mmap_rwsem: x86's huge_pmd_unshare
  5605		 * may have cleared our pud entry and done put_page on the page table:
  5606		 * once we release i_mmap_rwsem, another task can do the final put_page
  5607		 * and that page table be reused and filled with junk.  If we actually
  5608		 * did unshare a page of pmds, flush the range corresponding to the pud.
  5609		 */
  5610		if (shared_pmd)
  5611			flush_hugetlb_tlb_range(vma, range.start, range.end);
  5612		else
  5613			flush_hugetlb_tlb_range(vma, start, end);
  5614		/*
  5615		 * No need to call mmu_notifier_invalidate_range() we are downgrading
  5616		 * page table protection not changing it to point to a new page.
  5617		 *
  5618		 * See Documentation/vm/mmu_notifier.rst
  5619		 */
  5620		i_mmap_unlock_write(vma->vm_file->f_mapping);
  5621		mmu_notifier_invalidate_range_end(&range);
  5622	
  5623		return pages << h->order;
  5624	}
  5625	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 28300 bytes --]

  reply	other threads:[~2021-07-21  8:35 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-15 20:13 [PATCH v5 00/26] userfaultfd-wp: Support shmem and hugetlbfs Peter Xu
2021-07-15 20:13 ` [PATCH v5 01/26] mm/shmem: Unconditionally set pte dirty in mfill_atomic_install_pte Peter Xu
2021-07-15 20:13 ` [PATCH v5 02/26] shmem/userfaultfd: Take care of UFFDIO_COPY_MODE_WP Peter Xu
2021-07-15 20:13 ` [PATCH v5 03/26] mm: Clear vmf->pte after pte_unmap_same() returns Peter Xu
2021-07-15 20:14 ` [PATCH v5 04/26] mm/userfaultfd: Introduce special pte for unmapped file-backed mem Peter Xu
2021-07-15 20:14 ` [PATCH v5 05/26] mm/swap: Introduce the idea of special swap ptes Peter Xu
2021-07-16  5:50   ` Alistair Popple
2021-07-16 19:11     ` Peter Xu
2021-07-21 11:28       ` Alistair Popple
2021-07-21 21:35         ` Peter Xu
2021-07-22  1:08           ` Alistair Popple
2021-07-22 15:21             ` Peter Xu
2021-07-15 20:14 ` [PATCH v5 06/26] shmem/userfaultfd: Handle uffd-wp special pte in page fault handler Peter Xu
2021-07-15 20:14 ` [PATCH v5 07/26] mm: Drop first_index/last_index in zap_details Peter Xu
2021-07-15 20:14 ` [PATCH v5 08/26] mm: Introduce zap_details.zap_flags Peter Xu
2021-07-15 20:14 ` [PATCH v5 09/26] mm: Introduce ZAP_FLAG_SKIP_SWAP Peter Xu
2021-07-15 20:14 ` [PATCH v5 10/26] shmem/userfaultfd: Persist uffd-wp bit across zapping for file-backed Peter Xu
2021-07-15 20:15 ` [PATCH v5 11/26] shmem/userfaultfd: Allow wr-protect none pte for file-backed mem Peter Xu
2021-07-15 20:16 ` [PATCH v5 12/26] shmem/userfaultfd: Allows file-back mem to be uffd wr-protected on thps Peter Xu
2021-07-15 20:16 ` [PATCH v5 13/26] shmem/userfaultfd: Handle the left-overed special swap ptes Peter Xu
2021-07-15 20:16 ` [PATCH v5 14/26] shmem/userfaultfd: Pass over uffd-wp special swap pte when fork() Peter Xu
2021-07-15 20:16 ` [PATCH v5 15/26] mm/hugetlb: Drop __unmap_hugepage_range definition from hugetlb.h Peter Xu
2021-07-15 20:16 ` [PATCH v5 16/26] mm/hugetlb: Introduce huge pte version of uffd-wp helpers Peter Xu
2021-07-15 20:16 ` [PATCH v5 17/26] hugetlb/userfaultfd: Hook page faults for uffd write protection Peter Xu
2021-07-20 15:37   ` kernel test robot
2021-07-21 21:50     ` Peter Xu
2021-07-15 20:16 ` [PATCH v5 18/26] hugetlb/userfaultfd: Take care of UFFDIO_COPY_MODE_WP Peter Xu
2021-07-20 23:59   ` kernel test robot
2021-07-15 20:16 ` [PATCH v5 19/26] hugetlb/userfaultfd: Handle UFFDIO_WRITEPROTECT Peter Xu
2021-07-21  8:24   ` kernel test robot [this message]
2021-07-15 20:16 ` [PATCH v5 20/26] mm/hugetlb: Introduce huge version of special swap pte helpers Peter Xu
2021-07-15 20:16 ` [PATCH v5 21/26] hugetlb/userfaultfd: Handle uffd-wp special pte in hugetlb pf handler Peter Xu
2021-07-15 20:16 ` [PATCH v5 22/26] hugetlb/userfaultfd: Allow wr-protect none ptes Peter Xu
2021-07-15 20:16 ` [PATCH v5 23/26] hugetlb/userfaultfd: Only drop uffd-wp special pte if required Peter Xu
2021-07-15 20:16 ` [PATCH v5 24/26] mm/pagemap: Recognize uffd-wp bit for shmem/hugetlbfs Peter Xu
2021-07-19  9:53   ` Tiberiu Georgescu
2021-07-19 16:03     ` Peter Xu
2021-07-19 17:23       ` Tiberiu Georgescu
2021-07-19 17:56         ` Peter Xu
2021-07-21 14:38           ` Ivan Teterevkov
2021-07-21 16:19             ` David Hildenbrand
2021-07-21 19:54               ` Ivan Teterevkov
2021-07-21 22:28                 ` Peter Xu
2021-07-21 22:57                   ` Peter Xu
2021-07-22  6:27                     ` David Hildenbrand
2021-07-22 16:08                       ` Peter Xu
2021-07-15 20:16 ` [PATCH v5 25/26] mm/userfaultfd: Enable write protection for shmem & hugetlbfs Peter Xu
2021-07-15 20:16 ` [PATCH v5 26/26] userfaultfd/selftests: Enable uffd-wp for shmem/hugetlbfs Peter Xu
2021-07-19 19:21 ` [PATCH v5 00/26] userfaultfd-wp: Support shmem and hugetlbfs David Hildenbrand
2021-07-19 20:12   ` Peter Xu
2021-07-22 18:30 ` Peter Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202107211659.FK2HCJwj-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=apopple@nvidia.com \
    --cc=axelrasmussen@google.com \
    --cc=clang-built-linux@googlegroups.com \
    --cc=jgg@ziepe.ca \
    --cc=jglisse@redhat.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kirill@shutemov.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nadav.amit@gmail.com \
    --cc=peterx@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).