CC: kbuild-...@lists.01.org
CC: linux-ker...@vger.kernel.org
TO: "Paul, E., McKenney," <paul...@kernel.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git 
dev.2020.05.26b
head:   795279db1396bf66621fa3f343fa990fe543b89e
commit: 7e2a6278a303f510883b32c1ac2d5ea7351b7e1d [59/70] refperf: Dynamically 
allocate experiment-summary output buffer
:::::: branch date: 6 days ago
:::::: commit date: 6 days ago
config: x86_64-randconfig-m001-20200602 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <l...@intel.com>
Reported-by: Dan Carpenter <dan.carpen...@oracle.com>

smatch warnings:
kernel/rcu/refperf.c:391 main_func() error: we previously assumed 'buf' could 
be null (see line 348)

# 
https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git/commit/?id=7e2a6278a303f510883b32c1ac2d5ea7351b7e1d
git remote add rcu 
https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git
git remote update rcu
git checkout 7e2a6278a303f510883b32c1ac2d5ea7351b7e1d
vim +/buf +391 kernel/rcu/refperf.c

786a2549774369 Joel Fernandes (Google  2020-05-25  325) 
786a2549774369 Joel Fernandes (Google  2020-05-25  326) // The main_func is the 
main orchestrator, it performs a bunch of
786a2549774369 Joel Fernandes (Google  2020-05-25  327) // experiments.  For 
every experiment, it orders all the readers
786a2549774369 Joel Fernandes (Google  2020-05-25  328) // involved to start 
and waits for them to finish the experiment. It
786a2549774369 Joel Fernandes (Google  2020-05-25  329) // then reads their 
timestamps and starts the next experiment. Each
786a2549774369 Joel Fernandes (Google  2020-05-25  330) // experiment 
progresses from 1 concurrent reader to N of them at which
786a2549774369 Joel Fernandes (Google  2020-05-25  331) // point all the 
timestamps are printed.
786a2549774369 Joel Fernandes (Google  2020-05-25  332) static int 
main_func(void *arg)
786a2549774369 Joel Fernandes (Google  2020-05-25  333) {
7e2a6278a303f5 Paul E. McKenney        2020-05-25  334          bool errexit = 
false;
786a2549774369 Joel Fernandes (Google  2020-05-25  335)         int exp, r;
786a2549774369 Joel Fernandes (Google  2020-05-25  336)         char buf1[64];
7e2a6278a303f5 Paul E. McKenney        2020-05-25  337          char *buf;
e4c9f422a8f55a Paul E. McKenney        2020-05-25  338          u64 *result_avg;
786a2549774369 Joel Fernandes (Google  2020-05-25  339) 
786a2549774369 Joel Fernandes (Google  2020-05-25  340)         
set_cpus_allowed_ptr(current, cpumask_of(nreaders % nr_cpu_ids));
786a2549774369 Joel Fernandes (Google  2020-05-25  341)         
set_user_nice(current, MAX_NICE);
786a2549774369 Joel Fernandes (Google  2020-05-25  342) 
0df40fd6b88e49 Paul E. McKenney        2020-05-25  343          if (holdoff)
0df40fd6b88e49 Paul E. McKenney        2020-05-25  344                  
schedule_timeout_interruptible(holdoff * HZ);
786a2549774369 Joel Fernandes (Google  2020-05-25  345)         
VERBOSE_PERFOUT("main_func task started");
e4c9f422a8f55a Paul E. McKenney        2020-05-25  346          result_avg = 
kzalloc(nruns * sizeof(*result_avg), GFP_KERNEL);
7e2a6278a303f5 Paul E. McKenney        2020-05-25  347          buf = 
kzalloc(64 + nruns * 32, GFP_KERNEL);
7e2a6278a303f5 Paul E. McKenney        2020-05-25 @348          if (!result_avg 
|| !buf) {
e4c9f422a8f55a Paul E. McKenney        2020-05-25  349                  
VERBOSE_PERFOUT_ERRSTRING("out of memory");
7e2a6278a303f5 Paul E. McKenney        2020-05-25  350                  errexit 
= true;
7e2a6278a303f5 Paul E. McKenney        2020-05-25  351          }
786a2549774369 Joel Fernandes (Google  2020-05-25  352)         
atomic_inc(&n_init);
786a2549774369 Joel Fernandes (Google  2020-05-25  353) 
786a2549774369 Joel Fernandes (Google  2020-05-25  354)         // Wait for all 
threads to start.
786a2549774369 Joel Fernandes (Google  2020-05-25  355)         
wait_event(main_wq, atomic_read(&n_init) == (nreaders + 1));
786a2549774369 Joel Fernandes (Google  2020-05-25  356) 
786a2549774369 Joel Fernandes (Google  2020-05-25  357)         // Start exp 
readers up per experiment
e4c9f422a8f55a Paul E. McKenney        2020-05-25  358          for (exp = 0; 
exp < nruns && !torture_must_stop(); exp++) {
7e2a6278a303f5 Paul E. McKenney        2020-05-25  359                  if 
(errexit)
e4c9f422a8f55a Paul E. McKenney        2020-05-25  360                          
break;
786a2549774369 Joel Fernandes (Google  2020-05-25  361)                 if 
(torture_must_stop())
786a2549774369 Joel Fernandes (Google  2020-05-25  362)                         
goto end;
786a2549774369 Joel Fernandes (Google  2020-05-25  363) 
e4c9f422a8f55a Paul E. McKenney        2020-05-25  364                  
reset_readers();
e4c9f422a8f55a Paul E. McKenney        2020-05-25  365                  
atomic_set(&nreaders_exp, nreaders);
786a2549774369 Joel Fernandes (Google  2020-05-25  366) 
786a2549774369 Joel Fernandes (Google  2020-05-25  367)                 exp_idx 
= exp;
786a2549774369 Joel Fernandes (Google  2020-05-25  368) 
e4c9f422a8f55a Paul E. McKenney        2020-05-25  369                  for (r 
= 0; r < nreaders; r++) {
786a2549774369 Joel Fernandes (Google  2020-05-25  370)                         
atomic_set(&reader_tasks[r].start, 1);
786a2549774369 Joel Fernandes (Google  2020-05-25  371)                         
wake_up(&reader_tasks[r].wq);
786a2549774369 Joel Fernandes (Google  2020-05-25  372)                 }
786a2549774369 Joel Fernandes (Google  2020-05-25  373) 
786a2549774369 Joel Fernandes (Google  2020-05-25  374)                 
VERBOSE_PERFOUT("main_func: experiment started, waiting for %d readers",
e4c9f422a8f55a Paul E. McKenney        2020-05-25  375                          
        nreaders);
786a2549774369 Joel Fernandes (Google  2020-05-25  376) 
786a2549774369 Joel Fernandes (Google  2020-05-25  377)                 
wait_event(main_wq,
786a2549774369 Joel Fernandes (Google  2020-05-25  378)                         
   !atomic_read(&nreaders_exp) || torture_must_stop());
786a2549774369 Joel Fernandes (Google  2020-05-25  379) 
786a2549774369 Joel Fernandes (Google  2020-05-25  380)                 
VERBOSE_PERFOUT("main_func: experiment ended");
786a2549774369 Joel Fernandes (Google  2020-05-25  381) 
786a2549774369 Joel Fernandes (Google  2020-05-25  382)                 if 
(torture_must_stop())
786a2549774369 Joel Fernandes (Google  2020-05-25  383)                         
goto end;
786a2549774369 Joel Fernandes (Google  2020-05-25  384) 
e4c9f422a8f55a Paul E. McKenney        2020-05-25  385                  
result_avg[exp] = 1000 * process_durations(nreaders) / (nreaders * loops);
786a2549774369 Joel Fernandes (Google  2020-05-25  386)         }
786a2549774369 Joel Fernandes (Google  2020-05-25  387) 
786a2549774369 Joel Fernandes (Google  2020-05-25  388)         // Print the 
average of all experiments
786a2549774369 Joel Fernandes (Google  2020-05-25  389)         PERFOUT("END OF 
TEST. Calculating average duration per loop (nanoseconds)...\n");
786a2549774369 Joel Fernandes (Google  2020-05-25  390) 
786a2549774369 Joel Fernandes (Google  2020-05-25 @391)         buf[0] = 0;
786a2549774369 Joel Fernandes (Google  2020-05-25  392)         strcat(buf, 
"\n");
786a2549774369 Joel Fernandes (Google  2020-05-25  393)         strcat(buf, 
"Threads\tTime(ns)\n");
786a2549774369 Joel Fernandes (Google  2020-05-25  394) 
e4c9f422a8f55a Paul E. McKenney        2020-05-25  395          for (exp = 0; 
exp < nruns; exp++) {
7e2a6278a303f5 Paul E. McKenney        2020-05-25  396                  if 
(errexit)
e4c9f422a8f55a Paul E. McKenney        2020-05-25  397                          
break;
e4c9f422a8f55a Paul E. McKenney        2020-05-25  398                  
sprintf(buf1, "%d\t%llu.%03d\n", exp + 1, result_avg[exp] / 1000, 
(int)(result_avg[exp] % 1000));
786a2549774369 Joel Fernandes (Google  2020-05-25  399)                 
strcat(buf, buf1);
786a2549774369 Joel Fernandes (Google  2020-05-25  400)         }
786a2549774369 Joel Fernandes (Google  2020-05-25  401) 
7e2a6278a303f5 Paul E. McKenney        2020-05-25  402          if (!errexit)
786a2549774369 Joel Fernandes (Google  2020-05-25  403)                 
PERFOUT("%s", buf);
786a2549774369 Joel Fernandes (Google  2020-05-25  404) 
786a2549774369 Joel Fernandes (Google  2020-05-25  405)         // This will 
shutdown everything including us.
786a2549774369 Joel Fernandes (Google  2020-05-25  406)         if (shutdown) {
786a2549774369 Joel Fernandes (Google  2020-05-25  407)                 
shutdown_start = 1;
786a2549774369 Joel Fernandes (Google  2020-05-25  408)                 
wake_up(&shutdown_wq);
786a2549774369 Joel Fernandes (Google  2020-05-25  409)         }
786a2549774369 Joel Fernandes (Google  2020-05-25  410) 
786a2549774369 Joel Fernandes (Google  2020-05-25  411)         // Wait for 
torture to stop us
786a2549774369 Joel Fernandes (Google  2020-05-25  412)         while 
(!torture_must_stop())
786a2549774369 Joel Fernandes (Google  2020-05-25  413)                 
schedule_timeout_uninterruptible(1);
786a2549774369 Joel Fernandes (Google  2020-05-25  414) 
786a2549774369 Joel Fernandes (Google  2020-05-25  415) end:
786a2549774369 Joel Fernandes (Google  2020-05-25  416)         
torture_kthread_stopping("main_func");
7e2a6278a303f5 Paul E. McKenney        2020-05-25  417          
kfree(result_avg);
7e2a6278a303f5 Paul E. McKenney        2020-05-25  418          kfree(buf);
786a2549774369 Joel Fernandes (Google  2020-05-25  419)         return 0;
786a2549774369 Joel Fernandes (Google  2020-05-25  420) }
786a2549774369 Joel Fernandes (Google  2020-05-25  421) 

:::::: The code at line 391 was first introduced by commit
:::::: 786a25497743696d79592b864cafbfe48787e6e1 refperf: Add a test to measure 
performance of read-side synchronization

:::::: TO: Joel Fernandes (Google) <j...@joelfernandes.org>
:::::: CC: Paul E. McKenney <paul...@kernel.org>

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

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org

Reply via email to