llvm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [frederic-dynticks:rcu/dev 1/4] kernel/rcu/tree_nocb.h:1355:7: warning: variable '_count' is uninitialized when used here
@ 2023-03-22  3:47 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2023-03-22  3:47 UTC (permalink / raw)
  To: Frederic Weisbecker; +Cc: llvm, oe-kbuild-all, fweisbec

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks.git rcu/dev
head:   7f7c396422722db9db601852664a30597a4fc7df
commit: 9c1b4fd66a0ce529b431385e86693cd81f194e85 [1/4] rcu/nocb: Protect lazy shrinker against concurrent (de-)offloading
config: riscv-randconfig-r016-20230319 (https://download.01.org/0day-ci/archive/20230322/202303221149.HHwYkAFu-lkp@intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 67409911353323ca5edf2049ef0df54132fa1ca7)
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 riscv cross compiling tool for clang build
        # apt-get install binutils-riscv-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks.git/commit/?id=9c1b4fd66a0ce529b431385e86693cd81f194e85
        git remote add frederic-dynticks https://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks.git
        git fetch --no-tags frederic-dynticks rcu/dev
        git checkout 9c1b4fd66a0ce529b431385e86693cd81f194e85
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash kernel/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202303221149.HHwYkAFu-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from kernel/rcu/tree.c:4956:
>> kernel/rcu/tree_nocb.h:1355:7: warning: variable '_count' is uninitialized when used here [-Wuninitialized]
                   if (_count == 0)
                       ^~~~~~
   kernel/rcu/tree_nocb.h:1348:13: note: initialize the variable '_count' to silence this warning
                   int _count;
                             ^
                              = 0
   1 warning generated.


vim +/_count +1355 kernel/rcu/tree_nocb.h

c945b4da7a448a Vineeth Pillai      2022-10-16  1331  
c945b4da7a448a Vineeth Pillai      2022-10-16  1332  static unsigned long
c945b4da7a448a Vineeth Pillai      2022-10-16  1333  lazy_rcu_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
c945b4da7a448a Vineeth Pillai      2022-10-16  1334  {
c945b4da7a448a Vineeth Pillai      2022-10-16  1335  	int cpu;
c945b4da7a448a Vineeth Pillai      2022-10-16  1336  	unsigned long flags;
c945b4da7a448a Vineeth Pillai      2022-10-16  1337  	unsigned long count = 0;
c945b4da7a448a Vineeth Pillai      2022-10-16  1338  
9c1b4fd66a0ce5 Frederic Weisbecker 2023-03-17  1339  	/*
9c1b4fd66a0ce5 Frederic Weisbecker 2023-03-17  1340  	 * Protect against concurrent (de-)offloading. Otherwise nocb locking
9c1b4fd66a0ce5 Frederic Weisbecker 2023-03-17  1341  	 * may be ignored or imbalanced.
9c1b4fd66a0ce5 Frederic Weisbecker 2023-03-17  1342  	 */
9c1b4fd66a0ce5 Frederic Weisbecker 2023-03-17  1343  	mutex_lock(&rcu_state.barrier_mutex);
9c1b4fd66a0ce5 Frederic Weisbecker 2023-03-17  1344  
c945b4da7a448a Vineeth Pillai      2022-10-16  1345  	/* Snapshot count of all CPUs */
c945b4da7a448a Vineeth Pillai      2022-10-16  1346  	for_each_possible_cpu(cpu) {
c945b4da7a448a Vineeth Pillai      2022-10-16  1347  		struct rcu_data *rdp = per_cpu_ptr(&rcu_data, cpu);
9c1b4fd66a0ce5 Frederic Weisbecker 2023-03-17  1348  		int _count;
9c1b4fd66a0ce5 Frederic Weisbecker 2023-03-17  1349  
9c1b4fd66a0ce5 Frederic Weisbecker 2023-03-17  1350  		if (!rcu_rdp_is_offloaded(rdp))
9c1b4fd66a0ce5 Frederic Weisbecker 2023-03-17  1351  			continue;
9c1b4fd66a0ce5 Frederic Weisbecker 2023-03-17  1352  
9c1b4fd66a0ce5 Frederic Weisbecker 2023-03-17  1353  		count = READ_ONCE(rdp->lazy_len);
c945b4da7a448a Vineeth Pillai      2022-10-16  1354  
c945b4da7a448a Vineeth Pillai      2022-10-16 @1355  		if (_count == 0)
c945b4da7a448a Vineeth Pillai      2022-10-16  1356  			continue;
9c1b4fd66a0ce5 Frederic Weisbecker 2023-03-17  1357  
c945b4da7a448a Vineeth Pillai      2022-10-16  1358  		rcu_nocb_lock_irqsave(rdp, flags);
c945b4da7a448a Vineeth Pillai      2022-10-16  1359  		WRITE_ONCE(rdp->lazy_len, 0);
c945b4da7a448a Vineeth Pillai      2022-10-16  1360  		rcu_nocb_unlock_irqrestore(rdp, flags);
c945b4da7a448a Vineeth Pillai      2022-10-16  1361  		wake_nocb_gp(rdp, false);
c945b4da7a448a Vineeth Pillai      2022-10-16  1362  		sc->nr_to_scan -= _count;
c945b4da7a448a Vineeth Pillai      2022-10-16  1363  		count += _count;
c945b4da7a448a Vineeth Pillai      2022-10-16  1364  		if (sc->nr_to_scan <= 0)
c945b4da7a448a Vineeth Pillai      2022-10-16  1365  			break;
c945b4da7a448a Vineeth Pillai      2022-10-16  1366  	}
9c1b4fd66a0ce5 Frederic Weisbecker 2023-03-17  1367  
9c1b4fd66a0ce5 Frederic Weisbecker 2023-03-17  1368  	mutex_unlock(&rcu_state.barrier_mutex);
9c1b4fd66a0ce5 Frederic Weisbecker 2023-03-17  1369  
c945b4da7a448a Vineeth Pillai      2022-10-16  1370  	return count ? count : SHRINK_STOP;
c945b4da7a448a Vineeth Pillai      2022-10-16  1371  }
c945b4da7a448a Vineeth Pillai      2022-10-16  1372  

:::::: The code at line 1355 was first introduced by commit
:::::: c945b4da7a448a9a56becc5a8745d942b2b83d3c rcu: Shrinker for lazy rcu

:::::: TO: Vineeth Pillai <vineeth@bitbyteword.org>
:::::: CC: Paul E. McKenney <paulmck@kernel.org>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

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

* [frederic-dynticks:rcu/dev 1/4] kernel/rcu/tree_nocb.h:1355:7: warning: variable '_count' is uninitialized when used here
@ 2023-03-22  3:57 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2023-03-22  3:57 UTC (permalink / raw)
  To: Frederic Weisbecker; +Cc: llvm, oe-kbuild-all, fweisbec

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks.git rcu/dev
head:   7f7c396422722db9db601852664a30597a4fc7df
commit: 9c1b4fd66a0ce529b431385e86693cd81f194e85 [1/4] rcu/nocb: Protect lazy shrinker against concurrent (de-)offloading
config: riscv-randconfig-r001-20230320 (https://download.01.org/0day-ci/archive/20230322/202303221136.n0Fd8NZa-lkp@intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 67409911353323ca5edf2049ef0df54132fa1ca7)
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 riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks.git/commit/?id=9c1b4fd66a0ce529b431385e86693cd81f194e85
        git remote add frederic-dynticks https://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks.git
        git fetch --no-tags frederic-dynticks rcu/dev
        git checkout 9c1b4fd66a0ce529b431385e86693cd81f194e85
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash kernel/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202303221136.n0Fd8NZa-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from kernel/rcu/tree.c:4956:
>> kernel/rcu/tree_nocb.h:1355:7: warning: variable '_count' is uninitialized when used here [-Wuninitialized]
                   if (_count == 0)
                       ^~~~~~
   kernel/rcu/tree_nocb.h:1348:13: note: initialize the variable '_count' to silence this warning
                   int _count;
                             ^
                              = 0
   1 warning generated.


vim +/_count +1355 kernel/rcu/tree_nocb.h

c945b4da7a448a9 Vineeth Pillai      2022-10-16  1331  
c945b4da7a448a9 Vineeth Pillai      2022-10-16  1332  static unsigned long
c945b4da7a448a9 Vineeth Pillai      2022-10-16  1333  lazy_rcu_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
c945b4da7a448a9 Vineeth Pillai      2022-10-16  1334  {
c945b4da7a448a9 Vineeth Pillai      2022-10-16  1335  	int cpu;
c945b4da7a448a9 Vineeth Pillai      2022-10-16  1336  	unsigned long flags;
c945b4da7a448a9 Vineeth Pillai      2022-10-16  1337  	unsigned long count = 0;
c945b4da7a448a9 Vineeth Pillai      2022-10-16  1338  
9c1b4fd66a0ce52 Frederic Weisbecker 2023-03-17  1339  	/*
9c1b4fd66a0ce52 Frederic Weisbecker 2023-03-17  1340  	 * Protect against concurrent (de-)offloading. Otherwise nocb locking
9c1b4fd66a0ce52 Frederic Weisbecker 2023-03-17  1341  	 * may be ignored or imbalanced.
9c1b4fd66a0ce52 Frederic Weisbecker 2023-03-17  1342  	 */
9c1b4fd66a0ce52 Frederic Weisbecker 2023-03-17  1343  	mutex_lock(&rcu_state.barrier_mutex);
9c1b4fd66a0ce52 Frederic Weisbecker 2023-03-17  1344  
c945b4da7a448a9 Vineeth Pillai      2022-10-16  1345  	/* Snapshot count of all CPUs */
c945b4da7a448a9 Vineeth Pillai      2022-10-16  1346  	for_each_possible_cpu(cpu) {
c945b4da7a448a9 Vineeth Pillai      2022-10-16  1347  		struct rcu_data *rdp = per_cpu_ptr(&rcu_data, cpu);
9c1b4fd66a0ce52 Frederic Weisbecker 2023-03-17  1348  		int _count;
9c1b4fd66a0ce52 Frederic Weisbecker 2023-03-17  1349  
9c1b4fd66a0ce52 Frederic Weisbecker 2023-03-17  1350  		if (!rcu_rdp_is_offloaded(rdp))
9c1b4fd66a0ce52 Frederic Weisbecker 2023-03-17  1351  			continue;
9c1b4fd66a0ce52 Frederic Weisbecker 2023-03-17  1352  
9c1b4fd66a0ce52 Frederic Weisbecker 2023-03-17  1353  		count = READ_ONCE(rdp->lazy_len);
c945b4da7a448a9 Vineeth Pillai      2022-10-16  1354  
c945b4da7a448a9 Vineeth Pillai      2022-10-16 @1355  		if (_count == 0)
c945b4da7a448a9 Vineeth Pillai      2022-10-16  1356  			continue;
9c1b4fd66a0ce52 Frederic Weisbecker 2023-03-17  1357  
c945b4da7a448a9 Vineeth Pillai      2022-10-16  1358  		rcu_nocb_lock_irqsave(rdp, flags);
c945b4da7a448a9 Vineeth Pillai      2022-10-16  1359  		WRITE_ONCE(rdp->lazy_len, 0);
c945b4da7a448a9 Vineeth Pillai      2022-10-16  1360  		rcu_nocb_unlock_irqrestore(rdp, flags);
c945b4da7a448a9 Vineeth Pillai      2022-10-16  1361  		wake_nocb_gp(rdp, false);
c945b4da7a448a9 Vineeth Pillai      2022-10-16  1362  		sc->nr_to_scan -= _count;
c945b4da7a448a9 Vineeth Pillai      2022-10-16  1363  		count += _count;
c945b4da7a448a9 Vineeth Pillai      2022-10-16  1364  		if (sc->nr_to_scan <= 0)
c945b4da7a448a9 Vineeth Pillai      2022-10-16  1365  			break;
c945b4da7a448a9 Vineeth Pillai      2022-10-16  1366  	}
9c1b4fd66a0ce52 Frederic Weisbecker 2023-03-17  1367  
9c1b4fd66a0ce52 Frederic Weisbecker 2023-03-17  1368  	mutex_unlock(&rcu_state.barrier_mutex);
9c1b4fd66a0ce52 Frederic Weisbecker 2023-03-17  1369  
c945b4da7a448a9 Vineeth Pillai      2022-10-16  1370  	return count ? count : SHRINK_STOP;
c945b4da7a448a9 Vineeth Pillai      2022-10-16  1371  }
c945b4da7a448a9 Vineeth Pillai      2022-10-16  1372  

:::::: The code at line 1355 was first introduced by commit
:::::: c945b4da7a448a9a56becc5a8745d942b2b83d3c rcu: Shrinker for lazy rcu

:::::: TO: Vineeth Pillai <vineeth@bitbyteword.org>
:::::: CC: Paul E. McKenney <paulmck@kernel.org>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

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

end of thread, other threads:[~2023-03-22  3:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-22  3:47 [frederic-dynticks:rcu/dev 1/4] kernel/rcu/tree_nocb.h:1355:7: warning: variable '_count' is uninitialized when used here kernel test robot
2023-03-22  3:57 kernel test robot

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