kernel/rcu/rcutorture.c:293:23: warning: variable 'completed' set but not used

From: kernel test robot
Date: Sun Dec 03 2023 - 11:52:30 EST


Hi Paul,

FYI, the error/warning still remains.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 33cc938e65a98f1d29d0a18403dbbee050dcad9a
commit: d0af39e89ec59fe7c92c4bcbc2d652ea4c0ee644 torture: Trace long read-side delays
date: 7 years ago
config: x86_64-randconfig-x001-20230722 (https://download.01.org/0day-ci/archive/20231204/202312040041.wStDvPeB-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231204/202312040041.wStDvPeB-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202312040041.wStDvPeB-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

In file included from include/linux/kobject.h:21,
from include/linux/module.h:17,
from kernel/rcu/rcutorture.c:28:
include/linux/sysfs.h: In function 'sysfs_get_dirent':
include/linux/sysfs.h:517:44: warning: pointer targets in passing argument 2 of 'kernfs_find_and_get' differ in signedness [-Wpointer-sign]
517 | return kernfs_find_and_get(parent, name);
| ^~~~
| |
| const unsigned char *
In file included from include/linux/sysfs.h:15:
include/linux/kernfs.h:452:57: note: expected 'const char *' but argument is of type 'const unsigned char *'
452 | kernfs_find_and_get(struct kernfs_node *kn, const char *name)
| ~~~~~~~~~~~~^~~~
kernel/rcu/rcutorture.c: In function 'rcu_read_delay':
kernel/rcu/rcutorture.c:296:28: warning: variable 'ts' set but not used [-Wunused-but-set-variable]
296 | unsigned long long ts;
| ^~
>> kernel/rcu/rcutorture.c:293:23: warning: variable 'completed' set but not used [-Wunused-but-set-variable]
293 | unsigned long completed;
| ^~~~~~~~~
>> kernel/rcu/rcutorture.c:292:23: warning: variable 'started' set but not used [-Wunused-but-set-variable]
292 | unsigned long started;
| ^~~~~~~
kernel/rcu/rcutorture.c: In function 'rcu_torture_timer':
kernel/rcu/rcutorture.c:1104:28: warning: variable 'ts' set but not used [-Wunused-but-set-variable]
1104 | unsigned long long ts;
| ^~
kernel/rcu/rcutorture.c: In function 'rcu_torture_reader':
kernel/rcu/rcutorture.c:1169:28: warning: variable 'ts' set but not used [-Wunused-but-set-variable]
1169 | unsigned long long ts;
| ^~
kernel/rcu/rcutorture.c: At top level:
include/linux/module.h:132:13: warning: 'init_module' specifies less restrictive attribute than its target 'rcu_torture_init': 'cold' [-Wmissing-attributes]
132 | int init_module(void) __attribute__((alias(#initfn)));
| ^~~~~~~~~~~
kernel/rcu/rcutorture.c:1912:1: note: in expansion of macro 'module_init'
1912 | module_init(rcu_torture_init);
| ^~~~~~~~~~~
kernel/rcu/rcutorture.c:1715:1: note: 'init_module' target declared here
1715 | rcu_torture_init(void)
| ^~~~~~~~~~~~~~~~


vim +/completed +293 kernel/rcu/rcutorture.c

289
290 static void rcu_read_delay(struct torture_random_state *rrsp)
291 {
> 292 unsigned long started;
> 293 unsigned long completed;
294 const unsigned long shortdelay_us = 200;
295 const unsigned long longdelay_ms = 50;
296 unsigned long long ts;
297
298 /* We want a short delay sometimes to make a reader delay the grace
299 * period, and we want a long delay occasionally to trigger
300 * force_quiescent_state. */
301
302 if (!(torture_random(rrsp) % (nrealreaders * 2000 * longdelay_ms))) {
303 started = cur_ops->completed();
304 ts = rcu_trace_clock_local();
305 mdelay(longdelay_ms);
306 completed = cur_ops->completed();
307 do_trace_rcu_torture_read(cur_ops->name, NULL, ts,
308 started, completed);
309 }
310 if (!(torture_random(rrsp) % (nrealreaders * 2 * shortdelay_us)))
311 udelay(shortdelay_us);
312 #ifdef CONFIG_PREEMPT
313 if (!preempt_count() &&
314 !(torture_random(rrsp) % (nrealreaders * 20000)))
315 preempt_schedule(); /* No QS if preempt_disable() in effect */
316 #endif
317 }
318

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