Re: [PATCH 1/2] mm: disable LRU pagevec during the migration temporarily

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

 



Hi Minchan,

I love your patch! Yet something to improve:

[auto build test ERROR on block/for-next]
[also build test ERROR on linux/master linus/master v5.12-rc1 next-20210303]
[cannot apply to hnaz-linux-mm/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/Minchan-Kim/mm-disable-LRU-pagevec-during-the-migration-temporarily/20210303-191809
base:   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next
config: s390-randconfig-r034-20210303 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project a7cad6680b4087eff8994f1f99ac40c661a6621f)
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/6e669beb75caae92c613a012734b1a2dc9485524
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Minchan-Kim/mm-disable-LRU-pagevec-during-the-migration-temporarily/20210303-191809
        git checkout 6e669beb75caae92c613a012734b1a2dc9485524
        # 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@xxxxxxxxx>

All errors (new ones prefixed by >>):

   #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
                                                             ^
   include/uapi/linux/swab.h:119:21: note: expanded from macro '__swab32'
           ___constant_swab32(x) :                 \
                              ^
   include/uapi/linux/swab.h:19:12: note: expanded from macro '___constant_swab32'
           (((__u32)(x) & (__u32)0x000000ffUL) << 24) |            \
                     ^
   In file included from arch/s390/kernel/uv.c:14:
   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:80:
   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:119:21: note: expanded from macro '__swab32'
           ___constant_swab32(x) :                 \
                              ^
   include/uapi/linux/swab.h:20:12: note: expanded from macro '___constant_swab32'
           (((__u32)(x) & (__u32)0x0000ff00UL) <<  8) |            \
                     ^
   In file included from arch/s390/kernel/uv.c:14:
   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:80:
   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:119:21: note: expanded from macro '__swab32'
           ___constant_swab32(x) :                 \
                              ^
   include/uapi/linux/swab.h:21:12: note: expanded from macro '___constant_swab32'
           (((__u32)(x) & (__u32)0x00ff0000UL) >>  8) |            \
                     ^
   In file included from arch/s390/kernel/uv.c:14:
   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:80:
   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:119:21: note: expanded from macro '__swab32'
           ___constant_swab32(x) :                 \
                              ^
   include/uapi/linux/swab.h:22:12: note: expanded from macro '___constant_swab32'
           (((__u32)(x) & (__u32)0xff000000UL) >> 24)))
                     ^
   In file included from arch/s390/kernel/uv.c:14:
   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:80:
   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:120:12: note: expanded from macro '__swab32'
           __fswab32(x))
                     ^
   In file included from arch/s390/kernel/uv.c:14:
   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:80:
   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);
                   ~~~~~~~~~~ ^
>> arch/s390/kernel/uv.c:272:22: error: too few arguments to function call, single argument 'force_all_cpus' was not specified
                           lru_add_drain_all();
                           ~~~~~~~~~~~~~~~~~ ^
   include/linux/swap.h:347:13: note: 'lru_add_drain_all' declared here
   extern void lru_add_drain_all(bool force_all_cpus);
               ^
   20 warnings and 1 error generated.


vim +/force_all_cpus +272 arch/s390/kernel/uv.c

214d9bbcd3a672 Claudio Imbrenda  2020-01-21  212  
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  213  /*
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  214   * Requests the Ultravisor to make a page accessible to a guest.
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  215   * If it's brought in the first time, it will be cleared. If
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  216   * it has been exported before, it will be decrypted and integrity
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  217   * checked.
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  218   */
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  219  int gmap_make_secure(struct gmap *gmap, unsigned long gaddr, void *uvcb)
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  220  {
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  221  	struct vm_area_struct *vma;
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  222  	bool local_drain = false;
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  223  	spinlock_t *ptelock;
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  224  	unsigned long uaddr;
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  225  	struct page *page;
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  226  	pte_t *ptep;
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  227  	int rc;
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  228  
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  229  again:
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  230  	rc = -EFAULT;
d8ed45c5dcd455 Michel Lespinasse 2020-06-08  231  	mmap_read_lock(gmap->mm);
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  232  
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  233  	uaddr = __gmap_translate(gmap, gaddr);
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  234  	if (IS_ERR_VALUE(uaddr))
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  235  		goto out;
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  236  	vma = find_vma(gmap->mm, uaddr);
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  237  	if (!vma)
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  238  		goto out;
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  239  	/*
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  240  	 * Secure pages cannot be huge and userspace should not combine both.
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  241  	 * In case userspace does it anyway this will result in an -EFAULT for
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  242  	 * the unpack. The guest is thus never reaching secure mode. If
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  243  	 * userspace is playing dirty tricky with mapping huge pages later
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  244  	 * on this will result in a segmentation fault.
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  245  	 */
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  246  	if (is_vm_hugetlb_page(vma))
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  247  		goto out;
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  248  
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  249  	rc = -ENXIO;
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  250  	page = follow_page(vma, uaddr, FOLL_WRITE);
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  251  	if (IS_ERR_OR_NULL(page))
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  252  		goto out;
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  253  
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  254  	lock_page(page);
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  255  	ptep = get_locked_pte(gmap->mm, uaddr, &ptelock);
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  256  	rc = make_secure_pte(ptep, uaddr, page, uvcb);
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  257  	pte_unmap_unlock(ptep, ptelock);
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  258  	unlock_page(page);
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  259  out:
d8ed45c5dcd455 Michel Lespinasse 2020-06-08  260  	mmap_read_unlock(gmap->mm);
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  261  
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  262  	if (rc == -EAGAIN) {
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  263  		wait_on_page_writeback(page);
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  264  	} else if (rc == -EBUSY) {
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  265  		/*
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  266  		 * If we have tried a local drain and the page refcount
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  267  		 * still does not match our expected safe value, try with a
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  268  		 * system wide drain. This is needed if the pagevecs holding
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  269  		 * the page are on a different CPU.
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  270  		 */
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  271  		if (local_drain) {
214d9bbcd3a672 Claudio Imbrenda  2020-01-21 @272  			lru_add_drain_all();
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  273  			/* We give up here, and let the caller try again */
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  274  			return -EAGAIN;
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  275  		}
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  276  		/*
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  277  		 * We are here if the page refcount does not match the
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  278  		 * expected safe value. The main culprits are usually
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  279  		 * pagevecs. With lru_add_drain() we drain the pagevecs
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  280  		 * on the local CPU so that hopefully the refcount will
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  281  		 * reach the expected safe value.
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  282  		 */
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  283  		lru_add_drain();
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  284  		local_drain = true;
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  285  		/* And now we try again immediately after draining */
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  286  		goto again;
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  287  	} else if (rc == -ENXIO) {
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  288  		if (gmap_fault(gmap, gaddr, FAULT_FLAG_WRITE))
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  289  			return -EFAULT;
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  290  		return -EAGAIN;
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  291  	}
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  292  	return rc;
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  293  }
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  294  EXPORT_SYMBOL_GPL(gmap_make_secure);
214d9bbcd3a672 Claudio Imbrenda  2020-01-21  295  

---
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