Re: [patch 05/13] mm/pagemap: Clenaup PREEMPT_COUNT leftovers

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

 



Hi Thomas,

I love your patch! Yet something to improve:

[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on linus/master v5.9-rc5 next-20200914]
[cannot apply to rcu/dev arm/for-next tip/sched/core linux/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/Thomas-Gleixner/preempt-Make-preempt-count-unconditional/20200915-044640
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: arm-randconfig-r002-20200914 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project b2c32c90bab09a6e2c1f370429db26017a182143)
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 arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm 

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 drivers/scsi/scsi.c:47:
   In file included from include/linux/blkdev.h:13:
>> include/linux/pagemap.h:181:2: error: called object type 'void' is not a function or function pointer
           VM_BUG_ON_PAGE(page_count(page) == 0, page);
           ^
   include/linux/mmdebug.h:46:36: note: expanded from macro 'VM_BUG_ON_PAGE'
   #define VM_BUG_ON_PAGE(cond, page) VM_BUG_ON(cond)
                                      ^
   include/linux/mmdebug.h:45:25: note: expanded from macro 'VM_BUG_ON'
   #define VM_BUG_ON(cond) BUILD_BUG_ON_INVALID(cond)
                           ^
   include/linux/build_bug.h:30:33: note: expanded from macro 'BUILD_BUG_ON_INVALID'
   #define BUILD_BUG_ON_INVALID(e) ((void)(sizeof((__force long)(e))))
                                   ^
   In file included from drivers/scsi/scsi.c:62:
   In file included from include/scsi/scsi_cmnd.h:5:
   include/linux/dma-mapping.h:632:9: warning: implicit conversion from 'unsigned long long' to 'unsigned long' changes value from 18446744073709551615 to 4294967295 [-Wconstant-conversion]
           return DMA_BIT_MASK(32);
           ~~~~~~ ^~~~~~~~~~~~~~~~
   include/linux/dma-mapping.h:139:40: note: expanded from macro 'DMA_BIT_MASK'
   #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
                                          ^~~~~
   1 warning and 1 error generated.
--
   In file included from drivers/scsi/scsicam.c:19:
   In file included from include/linux/blkdev.h:13:
>> include/linux/pagemap.h:181:2: error: called object type 'void' is not a function or function pointer
           VM_BUG_ON_PAGE(page_count(page) == 0, page);
           ^
   include/linux/mmdebug.h:46:36: note: expanded from macro 'VM_BUG_ON_PAGE'
   #define VM_BUG_ON_PAGE(cond, page) VM_BUG_ON(cond)
                                      ^
   include/linux/mmdebug.h:45:25: note: expanded from macro 'VM_BUG_ON'
   #define VM_BUG_ON(cond) BUILD_BUG_ON_INVALID(cond)
                           ^
   include/linux/build_bug.h:30:33: note: expanded from macro 'BUILD_BUG_ON_INVALID'
   #define BUILD_BUG_ON_INVALID(e) ((void)(sizeof((__force long)(e))))
                                   ^
   1 error generated.
--
   In file included from drivers/scsi/scsi_sysfs.c:13:
   In file included from include/linux/blkdev.h:13:
>> include/linux/pagemap.h:181:2: error: called object type 'void' is not a function or function pointer
           VM_BUG_ON_PAGE(page_count(page) == 0, page);
           ^
   include/linux/mmdebug.h:46:36: note: expanded from macro 'VM_BUG_ON_PAGE'
   #define VM_BUG_ON_PAGE(cond, page) VM_BUG_ON(cond)
                                      ^
   include/linux/mmdebug.h:45:25: note: expanded from macro 'VM_BUG_ON'
   #define VM_BUG_ON(cond) BUILD_BUG_ON_INVALID(cond)
                           ^
   include/linux/build_bug.h:30:33: note: expanded from macro 'BUILD_BUG_ON_INVALID'
   #define BUILD_BUG_ON_INVALID(e) ((void)(sizeof((__force long)(e))))
                                   ^
   In file included from drivers/scsi/scsi_sysfs.c:20:
   In file included from include/scsi/scsi_tcq.h:6:
   In file included from include/scsi/scsi_cmnd.h:5:
   include/linux/dma-mapping.h:632:9: warning: implicit conversion from 'unsigned long long' to 'unsigned long' changes value from 18446744073709551615 to 4294967295 [-Wconstant-conversion]
           return DMA_BIT_MASK(32);
           ~~~~~~ ^~~~~~~~~~~~~~~~
   include/linux/dma-mapping.h:139:40: note: expanded from macro 'DMA_BIT_MASK'
   #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
                                          ^~~~~
   drivers/scsi/scsi_sysfs.c:373:1: warning: format specifies type 'short' but the argument has type 'int' [-Wformat]
   shost_rd_attr(can_queue, "%hd\n");
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                             %d
   drivers/scsi/scsi_sysfs.c:176:45: note: expanded from macro 'shost_rd_attr'
   #define shost_rd_attr(field, format_string) \
                                               ^
   drivers/scsi/scsi_sysfs.c:173:2: note: expanded from macro '\
   shost_rd_attr2'
           shost_show_function(name, field, format_string)                 \
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/scsi/scsi_sysfs.c:165:43: note: expanded from macro 'shost_show_function'
           return snprintf (buf, 20, format_string, shost->field);         \
                                     ~~~~~~~~~~~~~  ^~~~~~~~~~~~
   2 warnings and 1 error generated.
--
   In file included from drivers/scsi/ufs/ufshcd.c:18:
   In file included from drivers/scsi/ufs/ufshcd.h:32:
   In file included from include/linux/regulator/consumer.h:35:
   In file included from include/linux/suspend.h:5:
   In file included from include/linux/swap.h:9:
   In file included from include/linux/memcontrol.h:22:
   In file included from include/linux/writeback.h:14:
   In file included from include/linux/blk-cgroup.h:23:
   In file included from include/linux/blkdev.h:13:
>> include/linux/pagemap.h:181:2: error: called object type 'void' is not a function or function pointer
           VM_BUG_ON_PAGE(page_count(page) == 0, page);
           ^
   include/linux/mmdebug.h:46:36: note: expanded from macro 'VM_BUG_ON_PAGE'
   #define VM_BUG_ON_PAGE(cond, page) VM_BUG_ON(cond)
                                      ^
   include/linux/mmdebug.h:45:25: note: expanded from macro 'VM_BUG_ON'
   #define VM_BUG_ON(cond) BUILD_BUG_ON_INVALID(cond)
                           ^
   include/linux/build_bug.h:30:33: note: expanded from macro 'BUILD_BUG_ON_INVALID'
   #define BUILD_BUG_ON_INVALID(e) ((void)(sizeof((__force long)(e))))
                                   ^
   In file included from drivers/scsi/ufs/ufshcd.c:18:
   In file included from drivers/scsi/ufs/ufshcd.h:41:
   In file included from include/scsi/scsi_cmnd.h:5:
   include/linux/dma-mapping.h:632:9: warning: implicit conversion from 'unsigned long long' to 'unsigned long' changes value from 18446744073709551615 to 4294967295 [-Wconstant-conversion]
           return DMA_BIT_MASK(32);
           ~~~~~~ ^~~~~~~~~~~~~~~~
   include/linux/dma-mapping.h:139:40: note: expanded from macro 'DMA_BIT_MASK'
   #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
                                          ^~~~~
>> drivers/scsi/ufs/ufshcd.c:8716:44: warning: shift count >= width of type [-Wshift-count-overflow]
                   if (!dma_set_mask_and_coherent(hba->dev, DMA_BIT_MASK(64)))
                                                            ^~~~~~~~~~~~~~~~
   include/linux/dma-mapping.h:139:54: note: expanded from macro 'DMA_BIT_MASK'
   #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
                                                        ^ ~~~
   2 warnings and 1 error generated.
--
   In file included from drivers/scsi/hisi_sas/hisi_sas_main.c:7:
   In file included from drivers/scsi/hisi_sas/hisi_sas.h:16:
   In file included from include/linux/libata.h:21:
   In file included from include/scsi/scsi_host.h:11:
   In file included from include/linux/blk-mq.h:5:
   In file included from include/linux/blkdev.h:13:
>> include/linux/pagemap.h:181:2: error: called object type 'void' is not a function or function pointer
           VM_BUG_ON_PAGE(page_count(page) == 0, page);
           ^
   include/linux/mmdebug.h:46:36: note: expanded from macro 'VM_BUG_ON_PAGE'
   #define VM_BUG_ON_PAGE(cond, page) VM_BUG_ON(cond)
                                      ^
   include/linux/mmdebug.h:45:25: note: expanded from macro 'VM_BUG_ON'
   #define VM_BUG_ON(cond) BUILD_BUG_ON_INVALID(cond)
                           ^
   include/linux/build_bug.h:30:33: note: expanded from macro 'BUILD_BUG_ON_INVALID'
   #define BUILD_BUG_ON_INVALID(e) ((void)(sizeof((__force long)(e))))
                                   ^
>> drivers/scsi/hisi_sas/hisi_sas_main.c:2579:41: warning: shift count >= width of type [-Wshift-count-overflow]
           error = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));
                                                  ^~~~~~~~~~~~~~~~
   include/linux/dma-mapping.h:139:54: note: expanded from macro 'DMA_BIT_MASK'
   #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
                                                        ^ ~~~
   1 warning and 1 error generated.
--
   In file included from drivers/scsi/scsi_sysfs.c:13:
   In file included from include/linux/blkdev.h:13:
>> include/linux/pagemap.h:181:2: error: called object type 'void' is not a function or function pointer
           VM_BUG_ON_PAGE(page_count(page) == 0, page);
           ^
   include/linux/mmdebug.h:46:36: note: expanded from macro 'VM_BUG_ON_PAGE'
   #define VM_BUG_ON_PAGE(cond, page) VM_BUG_ON(cond)
                                      ^
   include/linux/mmdebug.h:45:25: note: expanded from macro 'VM_BUG_ON'
   #define VM_BUG_ON(cond) BUILD_BUG_ON_INVALID(cond)
                           ^
   include/linux/build_bug.h:30:33: note: expanded from macro 'BUILD_BUG_ON_INVALID'
   #define BUILD_BUG_ON_INVALID(e) ((void)(sizeof((__force long)(e))))
                                   ^
   In file included from drivers/scsi/scsi_sysfs.c:20:
   In file included from include/scsi/scsi_tcq.h:6:
   In file included from include/scsi/scsi_cmnd.h:5:
   include/linux/dma-mapping.h:632:9: warning: implicit conversion from 'unsigned long long' to 'unsigned long' changes value from 18446744073709551615 to 4294967295 [-Wconstant-conversion]
           return DMA_BIT_MASK(32);
           ~~~~~~ ^~~~~~~~~~~~~~~~
   include/linux/dma-mapping.h:139:40: note: expanded from macro 'DMA_BIT_MASK'
   #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
                                          ^~~~~
   drivers/scsi/scsi_sysfs.c:373:1: warning: format specifies type 'short' but the argument has type 'int' [-Wformat]
   shost_rd_attr(can_queue, "%hd\n");
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                             %d
   drivers/scsi/scsi_sysfs.c:176:45: note: expanded from macro 'shost_rd_attr'
   #define shost_rd_attr(field, format_string) \
                                               ^
   drivers/scsi/scsi_sysfs.c:173:2: note: expanded from macro '\
   shost_rd_attr2'
           shost_show_function(name, field, format_string)                 \
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/scsi/scsi_sysfs.c:165:43: note: expanded from macro 'shost_show_function'
           return snprintf (buf, 20, format_string, shost->field);         \
                                     ~~~~~~~~~~~~~  ^~~~~~~~~~~~
   drivers/scsi/scsi_sysfs.c:1027:10: fatal error: 'scsi_devinfo_tbl.c' file not found
   #include "scsi_devinfo_tbl.c"
            ^~~~~~~~~~~~~~~~~~~~
   2 warnings and 2 errors generated.

# https://github.com/0day-ci/linux/commit/a4a0f54fdd08d95dfe20d684b405db8a47fb61d8
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Thomas-Gleixner/preempt-Make-preempt-count-unconditional/20200915-044640
git checkout a4a0f54fdd08d95dfe20d684b405db8a47fb61d8
vim +/void +181 include/linux/pagemap.h

^1da177e4c3f41 Linus Torvalds         2005-04-16  123  
e286781d5f2e9c Nick Piggin            2008-07-25  124  /*
e286781d5f2e9c Nick Piggin            2008-07-25  125   * speculatively take a reference to a page.
0139aa7b7fa12c Joonsoo Kim            2016-05-19  126   * If the page is free (_refcount == 0), then _refcount is untouched, and 0
0139aa7b7fa12c Joonsoo Kim            2016-05-19  127   * is returned. Otherwise, _refcount is incremented by 1 and 1 is returned.
e286781d5f2e9c Nick Piggin            2008-07-25  128   *
e286781d5f2e9c Nick Piggin            2008-07-25  129   * This function must be called inside the same rcu_read_lock() section as has
e286781d5f2e9c Nick Piggin            2008-07-25  130   * been used to lookup the page in the pagecache radix-tree (or page table):
0139aa7b7fa12c Joonsoo Kim            2016-05-19  131   * this allows allocators to use a synchronize_rcu() to stabilize _refcount.
e286781d5f2e9c Nick Piggin            2008-07-25  132   *
e286781d5f2e9c Nick Piggin            2008-07-25  133   * Unless an RCU grace period has passed, the count of all pages coming out
e286781d5f2e9c Nick Piggin            2008-07-25  134   * of the allocator must be considered unstable. page_count may return higher
e286781d5f2e9c Nick Piggin            2008-07-25  135   * than expected, and put_page must be able to do the right thing when the
e286781d5f2e9c Nick Piggin            2008-07-25  136   * page has been finished with, no matter what it is subsequently allocated
e286781d5f2e9c Nick Piggin            2008-07-25  137   * for (because put_page is what is used here to drop an invalid speculative
e286781d5f2e9c Nick Piggin            2008-07-25  138   * reference).
e286781d5f2e9c Nick Piggin            2008-07-25  139   *
e286781d5f2e9c Nick Piggin            2008-07-25  140   * This is the interesting part of the lockless pagecache (and lockless
e286781d5f2e9c Nick Piggin            2008-07-25  141   * get_user_pages) locking protocol, where the lookup-side (eg. find_get_page)
e286781d5f2e9c Nick Piggin            2008-07-25  142   * has the following pattern:
e286781d5f2e9c Nick Piggin            2008-07-25  143   * 1. find page in radix tree
e286781d5f2e9c Nick Piggin            2008-07-25  144   * 2. conditionally increment refcount
e286781d5f2e9c Nick Piggin            2008-07-25  145   * 3. check the page is still in pagecache (if no, goto 1)
e286781d5f2e9c Nick Piggin            2008-07-25  146   *
0139aa7b7fa12c Joonsoo Kim            2016-05-19  147   * Remove-side that cares about stability of _refcount (eg. reclaim) has the
b93b016313b3ba Matthew Wilcox         2018-04-10  148   * following (with the i_pages lock held):
e286781d5f2e9c Nick Piggin            2008-07-25  149   * A. atomically check refcount is correct and set it to 0 (atomic_cmpxchg)
e286781d5f2e9c Nick Piggin            2008-07-25  150   * B. remove page from pagecache
e286781d5f2e9c Nick Piggin            2008-07-25  151   * C. free the page
e286781d5f2e9c Nick Piggin            2008-07-25  152   *
e286781d5f2e9c Nick Piggin            2008-07-25  153   * There are 2 critical interleavings that matter:
e286781d5f2e9c Nick Piggin            2008-07-25  154   * - 2 runs before A: in this case, A sees elevated refcount and bails out
e286781d5f2e9c Nick Piggin            2008-07-25  155   * - A runs before 2: in this case, 2 sees zero refcount and retries;
e286781d5f2e9c Nick Piggin            2008-07-25  156   *   subsequently, B will complete and 1 will find no page, causing the
e286781d5f2e9c Nick Piggin            2008-07-25  157   *   lookup to return NULL.
e286781d5f2e9c Nick Piggin            2008-07-25  158   *
e286781d5f2e9c Nick Piggin            2008-07-25  159   * It is possible that between 1 and 2, the page is removed then the exact same
e286781d5f2e9c Nick Piggin            2008-07-25  160   * page is inserted into the same position in pagecache. That's OK: the
b93b016313b3ba Matthew Wilcox         2018-04-10  161   * old find_get_page using a lock could equally have run before or after
e286781d5f2e9c Nick Piggin            2008-07-25  162   * such a re-insertion, depending on order that locks are granted.
e286781d5f2e9c Nick Piggin            2008-07-25  163   *
e286781d5f2e9c Nick Piggin            2008-07-25  164   * Lookups racing against pagecache insertion isn't a big problem: either 1
e286781d5f2e9c Nick Piggin            2008-07-25  165   * will find the page or it will not. Likewise, the old find_get_page could run
e286781d5f2e9c Nick Piggin            2008-07-25  166   * either before the insertion or afterwards, depending on timing.
e286781d5f2e9c Nick Piggin            2008-07-25  167   */
494eec70f05496 john.hubbard@xxxxxxxxx 2019-03-05  168  static inline int __page_cache_add_speculative(struct page *page, int count)
e286781d5f2e9c Nick Piggin            2008-07-25  169  {
8375ad98cc1def Paul E. McKenney       2013-04-29  170  #ifdef CONFIG_TINY_RCU
a4a0f54fdd08d9 Thomas Gleixner        2020-09-14  171  	VM_BUG_ON(preemptible())
e286781d5f2e9c Nick Piggin            2008-07-25  172  	/*
e286781d5f2e9c Nick Piggin            2008-07-25  173  	 * Preempt must be disabled here - we rely on rcu_read_lock doing
e286781d5f2e9c Nick Piggin            2008-07-25  174  	 * this for us.
e286781d5f2e9c Nick Piggin            2008-07-25  175  	 *
e286781d5f2e9c Nick Piggin            2008-07-25  176  	 * Pagecache won't be truncated from interrupt context, so if we have
e286781d5f2e9c Nick Piggin            2008-07-25  177  	 * found a page in the radix tree here, we have pinned its refcount by
e286781d5f2e9c Nick Piggin            2008-07-25  178  	 * disabling preempt, and hence no need for the "speculative get" that
e286781d5f2e9c Nick Piggin            2008-07-25  179  	 * SMP requires.
e286781d5f2e9c Nick Piggin            2008-07-25  180  	 */
309381feaee564 Sasha Levin            2014-01-23 @181  	VM_BUG_ON_PAGE(page_count(page) == 0, page);
494eec70f05496 john.hubbard@xxxxxxxxx 2019-03-05  182  	page_ref_add(page, count);
e286781d5f2e9c Nick Piggin            2008-07-25  183  

---
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]     [Netdev]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux