All of lore.kernel.org
 help / color / mirror / Atom feed
* include/asm-generic/bitops/lock.h:28:43: sparse: sparse: context imbalance in 'zram_slot_lock' - wrong count at exit
@ 2020-12-04  4:38 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2020-12-04  4:38 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Will Deacon <will@kernel.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   34816d20f173a90389c8a7e641166d8ea9dce70a
commit: dee081bf8f824cabeb7c7495367d5dad0a444eb1 READ_ONCE: Drop pointer qualifiers when reading from scalar types
date:   8 months ago
:::::: branch date: 27 hours ago
:::::: commit date: 8 months ago
config: parisc-randconfig-s032-20201204 (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.3-179-ga00755aa-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=dee081bf8f824cabeb7c7495367d5dad0a444eb1
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout dee081bf8f824cabeb7c7495367d5dad0a444eb1
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=parisc 

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


"sparse warnings: (new ones prefixed by >>)"
   drivers/block/zram/zram_drv.c: note: in included file (through include/linux/list_bl.h, include/linux/rculist_bl.h, include/linux/dcache.h, ...):
   include/linux/bit_spinlock.h:41:19: sparse: sparse: context imbalance in 'zram_slot_trylock' - different lock contexts for basic block
   drivers/block/zram/zram_drv.c: note: in included file (through arch/parisc/include/asm/bitops.h, include/linux/bitops.h, include/linux/kernel.h, ...):
>> include/asm-generic/bitops/lock.h:28:43: sparse: sparse: context imbalance in 'zram_slot_lock' - wrong count at exit
   drivers/block/zram/zram_drv.c: note: in included file (through include/linux/list_bl.h, include/linux/rculist_bl.h, include/linux/dcache.h, ...):
   include/linux/bit_spinlock.h:63:25: sparse: sparse: context imbalance in 'zram_slot_unlock' - unexpected unlock

vim +/zram_slot_lock +28 include/asm-generic/bitops/lock.h

84c6591103dbeaf Will Deacon 2018-06-19   8  
26333576fd0d0b5 Nick Piggin 2007-10-18   9  /**
26333576fd0d0b5 Nick Piggin 2007-10-18  10   * test_and_set_bit_lock - Set a bit and return its old value, for lock
26333576fd0d0b5 Nick Piggin 2007-10-18  11   * @nr: Bit to set
26333576fd0d0b5 Nick Piggin 2007-10-18  12   * @addr: Address to count from
26333576fd0d0b5 Nick Piggin 2007-10-18  13   *
61e02392d3c7eca Will Deacon 2018-02-13  14   * This operation is atomic and provides acquire barrier semantics if
61e02392d3c7eca Will Deacon 2018-02-13  15   * the returned value is 0.
26333576fd0d0b5 Nick Piggin 2007-10-18  16   * It can be used to implement bit locks.
26333576fd0d0b5 Nick Piggin 2007-10-18  17   */
84c6591103dbeaf Will Deacon 2018-06-19  18  static inline int test_and_set_bit_lock(unsigned int nr,
84c6591103dbeaf Will Deacon 2018-06-19  19  					volatile unsigned long *p)
84c6591103dbeaf Will Deacon 2018-06-19  20  {
84c6591103dbeaf Will Deacon 2018-06-19  21  	long old;
84c6591103dbeaf Will Deacon 2018-06-19  22  	unsigned long mask = BIT_MASK(nr);
84c6591103dbeaf Will Deacon 2018-06-19  23  
84c6591103dbeaf Will Deacon 2018-06-19  24  	p += BIT_WORD(nr);
84c6591103dbeaf Will Deacon 2018-06-19  25  	if (READ_ONCE(*p) & mask)
84c6591103dbeaf Will Deacon 2018-06-19  26  		return 1;
84c6591103dbeaf Will Deacon 2018-06-19  27  
84c6591103dbeaf Will Deacon 2018-06-19 @28  	old = atomic_long_fetch_or_acquire(mask, (atomic_long_t *)p);
84c6591103dbeaf Will Deacon 2018-06-19  29  	return !!(old & mask);
84c6591103dbeaf Will Deacon 2018-06-19  30  }
84c6591103dbeaf Will Deacon 2018-06-19  31  

:::::: The code at line 28 was first introduced by commit
:::::: 84c6591103dbeaf393a092a3fc7b09510825f6b9 locking/atomics, asm-generic/bitops/lock.h: Rewrite using atomic_fetch_*()

:::::: TO: Will Deacon <will.deacon@arm.com>
:::::: CC: Ingo Molnar <mingo@kernel.org>

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

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* include/asm-generic/bitops/lock.h:28:43: sparse: sparse: context imbalance in 'zram_slot_lock' - wrong count at exit
@ 2021-02-06 19:17 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2021-02-06 19:17 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Will Deacon <will@kernel.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   61556703b610a104de324e4f061dc6cf7b218b46
commit: dee081bf8f824cabeb7c7495367d5dad0a444eb1 READ_ONCE: Drop pointer qualifiers when reading from scalar types
date:   10 months ago
:::::: branch date: 3 days ago
:::::: commit date: 10 months ago
config: microblaze-randconfig-s032-20210207 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.3-215-g0fb77bb6-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=dee081bf8f824cabeb7c7495367d5dad0a444eb1
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout dee081bf8f824cabeb7c7495367d5dad0a444eb1
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=microblaze 

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


"sparse warnings: (new ones prefixed by >>)"
   drivers/block/zram/zram_drv.c: note: in included file (through include/linux/list_bl.h, include/linux/rculist_bl.h, include/linux/dcache.h, ...):
   include/linux/bit_spinlock.h:41:19: sparse: sparse: context imbalance in 'zram_slot_trylock' - different lock contexts for basic block
   drivers/block/zram/zram_drv.c: note: in included file (through include/asm-generic/bitops.h, arch/microblaze/include/generated/asm/bitops.h, include/linux/bitops.h, ...):
>> include/asm-generic/bitops/lock.h:28:43: sparse: sparse: context imbalance in 'zram_slot_lock' - wrong count at exit
   drivers/block/zram/zram_drv.c: note: in included file (through include/linux/list_bl.h, include/linux/rculist_bl.h, include/linux/dcache.h, ...):
   include/linux/bit_spinlock.h:63:25: sparse: sparse: context imbalance in 'zram_slot_unlock' - unexpected unlock

vim +/zram_slot_lock +28 include/asm-generic/bitops/lock.h

84c6591103dbea Will Deacon 2018-06-19   8  
26333576fd0d0b Nick Piggin 2007-10-18   9  /**
26333576fd0d0b Nick Piggin 2007-10-18  10   * test_and_set_bit_lock - Set a bit and return its old value, for lock
26333576fd0d0b Nick Piggin 2007-10-18  11   * @nr: Bit to set
26333576fd0d0b Nick Piggin 2007-10-18  12   * @addr: Address to count from
26333576fd0d0b Nick Piggin 2007-10-18  13   *
61e02392d3c7ec Will Deacon 2018-02-13  14   * This operation is atomic and provides acquire barrier semantics if
61e02392d3c7ec Will Deacon 2018-02-13  15   * the returned value is 0.
26333576fd0d0b Nick Piggin 2007-10-18  16   * It can be used to implement bit locks.
26333576fd0d0b Nick Piggin 2007-10-18  17   */
84c6591103dbea Will Deacon 2018-06-19  18  static inline int test_and_set_bit_lock(unsigned int nr,
84c6591103dbea Will Deacon 2018-06-19  19  					volatile unsigned long *p)
84c6591103dbea Will Deacon 2018-06-19  20  {
84c6591103dbea Will Deacon 2018-06-19  21  	long old;
84c6591103dbea Will Deacon 2018-06-19  22  	unsigned long mask = BIT_MASK(nr);
84c6591103dbea Will Deacon 2018-06-19  23  
84c6591103dbea Will Deacon 2018-06-19  24  	p += BIT_WORD(nr);
84c6591103dbea Will Deacon 2018-06-19  25  	if (READ_ONCE(*p) & mask)
84c6591103dbea Will Deacon 2018-06-19  26  		return 1;
84c6591103dbea Will Deacon 2018-06-19  27  
84c6591103dbea Will Deacon 2018-06-19 @28  	old = atomic_long_fetch_or_acquire(mask, (atomic_long_t *)p);
84c6591103dbea Will Deacon 2018-06-19  29  	return !!(old & mask);
84c6591103dbea Will Deacon 2018-06-19  30  }
84c6591103dbea Will Deacon 2018-06-19  31  

:::::: The code at line 28 was first introduced by commit
:::::: 84c6591103dbeaf393a092a3fc7b09510825f6b9 locking/atomics, asm-generic/bitops/lock.h: Rewrite using atomic_fetch_*()

:::::: TO: Will Deacon <will.deacon@arm.com>
:::::: CC: Ingo Molnar <mingo@kernel.org>

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

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-02-06 19:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-04  4:38 include/asm-generic/bitops/lock.h:28:43: sparse: sparse: context imbalance in 'zram_slot_lock' - wrong count at exit kernel test robot
2021-02-06 19:17 kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.