[ammarfaizi2-block:paulmck/linux-rcu/dev 77/78] kernel/rcu/tasks.h:1231:12: warning: variable 'realnew' set but not used

From: kernel test robot
Date: Wed Jun 01 2022 - 05:00:41 EST


tree: https://github.com/ammarfaizi2/linux-block paulmck/linux-rcu/dev
head: 19abca3f9f9095e58c46e2f169543705bd92cf35
commit: 4b3564b0807387c66b80b24095019479584039c9 [77/78] rcu-tasks: Manual revert of 4b2a6af8fe31e85fb2754b8da5072041a4dea471
config: m68k-defconfig (https://download.01.org/0day-ci/archive/20220601/202206011656.3Ab9OjRb-lkp@xxxxxxxxx/config)
compiler: m68k-linux-gcc (GCC) 11.3.0
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
# https://github.com/ammarfaizi2/linux-block/commit/4b3564b0807387c66b80b24095019479584039c9
git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
git fetch --no-tags ammarfaizi2-block paulmck/linux-rcu/dev
git checkout 4b3564b0807387c66b80b24095019479584039c9
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash kernel/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

In file included from kernel/rcu/update.c:606:
kernel/rcu/tasks.h: In function 'rcu_trc_cmpxchg_need_qs':
kernel/rcu/tasks.h:1239:9: error: aggregate value used where an integer was expected
1239 | ret = cmpxchg(&t->trc_reader_special, trs_old, trs_new);
| ^~~
kernel/rcu/tasks.h:1239:9: error: aggregate value used where an integer was expected
In file included from arch/m68k/include/asm/cmpxchg.h:131,
from arch/m68k/include/asm/atomic.h:7,
from include/linux/atomic.h:7,
from include/linux/cpumask.h:13,
from include/linux/smp.h:13,
from include/linux/lockdep.h:14,
from include/linux/spinlock.h:62,
from kernel/rcu/update.c:23:
include/asm-generic/cmpxchg.h:92:10: error: cast to union type from type not present in union
92 | ((__typeof__(*(ptr)))__generic_cmpxchg_local((ptr), (unsigned long)(o), \
| ^
include/asm-generic/cmpxchg.h:105:33: note: in expansion of macro 'generic_cmpxchg_local'
105 | #define arch_cmpxchg_local generic_cmpxchg_local
| ^~~~~~~~~~~~~~~~~~~~~
include/asm-generic/cmpxchg.h:112:33: note: in expansion of macro 'arch_cmpxchg_local'
112 | #define arch_cmpxchg arch_cmpxchg_local
| ^~~~~~~~~~~~~~~~~~
include/linux/atomic/atomic-instrumented.h:1916:9: note: in expansion of macro 'arch_cmpxchg'
1916 | arch_cmpxchg(__ai_ptr, __VA_ARGS__); \
| ^~~~~~~~~~~~
kernel/rcu/tasks.h:1239:15: note: in expansion of macro 'cmpxchg'
1239 | ret = cmpxchg(&t->trc_reader_special, trs_old, trs_new);
| ^~~~~~~
In file included from kernel/rcu/update.c:606:
>> kernel/rcu/tasks.h:1231:12: warning: variable 'realnew' set but not used [-Wunused-but-set-variable]
1231 | u8 realnew;
| ^~~~~~~


vim +/realnew +1231 kernel/rcu/tasks.h

122db3cac94c0b Paul E. McKenney 2022-05-23 1223
0f7cb0c989a98c Paul E. McKenney 2022-05-24 1224 /*
0f7cb0c989a98c Paul E. McKenney 2022-05-24 1225 * Do a cmpxchg() on ->trc_reader_special.b.need_qs, allowing for
0f7cb0c989a98c Paul E. McKenney 2022-05-24 1226 * the four-byte operand-size restriction of some platforms.
0f7cb0c989a98c Paul E. McKenney 2022-05-24 1227 * Returns the old value, which is often ignored.
0f7cb0c989a98c Paul E. McKenney 2022-05-24 1228 */
0f7cb0c989a98c Paul E. McKenney 2022-05-24 1229 u8 rcu_trc_cmpxchg_need_qs(struct task_struct *t, u8 old, u8 new)
0f7cb0c989a98c Paul E. McKenney 2022-05-24 1230 {
2b23adb3446ac4 Paul E. McKenney 2022-05-25 @1231 u8 realnew;
2b23adb3446ac4 Paul E. McKenney 2022-05-25 1232 union rcu_special ret;
0f7cb0c989a98c Paul E. McKenney 2022-05-24 1233 union rcu_special trs_old = READ_ONCE(t->trc_reader_special);
0f7cb0c989a98c Paul E. McKenney 2022-05-24 1234 union rcu_special trs_new = trs_old;
0f7cb0c989a98c Paul E. McKenney 2022-05-24 1235
0f7cb0c989a98c Paul E. McKenney 2022-05-24 1236 if (trs_old.b.need_qs != old)
0f7cb0c989a98c Paul E. McKenney 2022-05-24 1237 return trs_old.b.need_qs;
0f7cb0c989a98c Paul E. McKenney 2022-05-24 1238 trs_new.b.need_qs = new;
2b23adb3446ac4 Paul E. McKenney 2022-05-25 1239 ret = cmpxchg(&t->trc_reader_special, trs_old, trs_new);
2b23adb3446ac4 Paul E. McKenney 2022-05-25 1240 realnew = READ_ONCE(t->trc_reader_special.b.need_qs);
2b23adb3446ac4 Paul E. McKenney 2022-05-25 1241 return ret.b.need_qs;
0f7cb0c989a98c Paul E. McKenney 2022-05-24 1242 }
0f7cb0c989a98c Paul E. McKenney 2022-05-24 1243

:::::: The code at line 1231 was first introduced by commit
:::::: 2b23adb3446ac4098c17dee98414df6fca07f6c9 squash! rcu-tasks: Atomically update .b.need_qs to obviate count

:::::: TO: Paul E. McKenney <paulmck@xxxxxxxxxx>
:::::: CC: Paul E. McKenney <paulmck@xxxxxxxxxx>

--
0-DAY CI Kernel Test Service
https://01.org/lkp