tree:   https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git 
rcu/dev
head:   74eef4bbea6ca21e2bac6fb7dc391d522076abe7
commit: 74eef4bbea6ca21e2bac6fb7dc391d522076abe7 [67/67] torture: Make 
online/offline messages appear only for verbose=2
config: x86_64-randconfig-x002-201818 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
        git checkout 74eef4bbea6ca21e2bac6fb7dc391d522076abe7
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   In file included from include/linux/kernel.h:10:0,
                    from kernel/torture.c:24:
   kernel/torture.c: In function 'torture_offline':
   kernel/torture.c:101:14: warning: comparison of constant '1' with boolean 
expression is always false [-Wbool-compare]
     if (verbose > 1)
                 ^
   include/linux/compiler.h:58:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^~~~
>> kernel/torture.c:101:2: note: in expansion of macro 'if'
     if (verbose > 1)
     ^~
   kernel/torture.c:101:14: warning: comparison of constant '1' with boolean 
expression is always false [-Wbool-compare]
     if (verbose > 1)
                 ^
   include/linux/compiler.h:58:42: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                             ^~~~
>> kernel/torture.c:101:2: note: in expansion of macro 'if'
     if (verbose > 1)
     ^~
   kernel/torture.c:101:14: warning: comparison of constant '1' with boolean 
expression is always false [-Wbool-compare]
     if (verbose > 1)
                 ^
   include/linux/compiler.h:69:16: note: in definition of macro '__trace_if'
      ______r = !!(cond);     \
                   ^~~~
>> kernel/torture.c:101:2: note: in expansion of macro 'if'
     if (verbose > 1)
     ^~
   kernel/torture.c:114:15: warning: comparison of constant '1' with boolean 
expression is always false [-Wbool-compare]
      if (verbose > 1)
                  ^
   include/linux/compiler.h:58:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^~~~
   kernel/torture.c:114:3: note: in expansion of macro 'if'
      if (verbose > 1)
      ^~
   kernel/torture.c:114:15: warning: comparison of constant '1' with boolean 
expression is always false [-Wbool-compare]
      if (verbose > 1)
                  ^
   include/linux/compiler.h:58:42: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                             ^~~~
   kernel/torture.c:114:3: note: in expansion of macro 'if'
      if (verbose > 1)
      ^~
   kernel/torture.c:114:15: warning: comparison of constant '1' with boolean 
expression is always false [-Wbool-compare]
      if (verbose > 1)
                  ^
   include/linux/compiler.h:69:16: note: in definition of macro '__trace_if'
      ______r = !!(cond);     \
                   ^~~~
   kernel/torture.c:114:3: note: in expansion of macro 'if'
      if (verbose > 1)
      ^~
   kernel/torture.c: In function 'torture_online':
   kernel/torture.c:150:14: warning: comparison of constant '1' with boolean 
expression is always false [-Wbool-compare]
     if (verbose > 1)
                 ^
   include/linux/compiler.h:58:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^~~~
   kernel/torture.c:150:2: note: in expansion of macro 'if'
     if (verbose > 1)
     ^~
   kernel/torture.c:150:14: warning: comparison of constant '1' with boolean 
expression is always false [-Wbool-compare]
     if (verbose > 1)
                 ^
   include/linux/compiler.h:58:42: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                             ^~~~
   kernel/torture.c:150:2: note: in expansion of macro 'if'
     if (verbose > 1)
     ^~
   kernel/torture.c:150:14: warning: comparison of constant '1' with boolean 
expression is always false [-Wbool-compare]
     if (verbose > 1)
                 ^
   include/linux/compiler.h:69:16: note: in definition of macro '__trace_if'
      ______r = !!(cond);     \
                   ^~~~
   kernel/torture.c:150:2: note: in expansion of macro 'if'
     if (verbose > 1)
     ^~
   kernel/torture.c:163:15: warning: comparison of constant '1' with boolean 
expression is always false [-Wbool-compare]
      if (verbose > 1)
                  ^
   include/linux/compiler.h:58:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^~~~
   kernel/torture.c:163:3: note: in expansion of macro 'if'
      if (verbose > 1)
      ^~
   kernel/torture.c:163:15: warning: comparison of constant '1' with boolean 
expression is always false [-Wbool-compare]
      if (verbose > 1)
                  ^
   include/linux/compiler.h:58:42: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                             ^~~~
   kernel/torture.c:163:3: note: in expansion of macro 'if'
      if (verbose > 1)
      ^~
   kernel/torture.c:163:15: warning: comparison of constant '1' with boolean 
expression is always false [-Wbool-compare]
      if (verbose > 1)
                  ^
   include/linux/compiler.h:69:16: note: in definition of macro '__trace_if'
      ______r = !!(cond);     \
                   ^~~~
   kernel/torture.c:163:3: note: in expansion of macro 'if'
      if (verbose > 1)
      ^~
   Cyclomatic Complexity 5 include/linux/compiler.h:__read_once_size
   Cyclomatic Complexity 5 include/linux/compiler.h:__write_once_size
   Cyclomatic Complexity 1 include/linux/kasan-checks.h:kasan_check_read
   Cyclomatic Complexity 1 include/linux/kasan-checks.h:kasan_check_write
   Cyclomatic Complexity 3 arch/x86/include/asm/bitops.h:clear_bit
   Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:variable_test_bit
   Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:fls64
   Cyclomatic Complexity 1 arch/x86/include/asm/arch_hweight.h:__arch_hweight64
   Cyclomatic Complexity 1 include/uapi/linux/swab.h:__fswahw32
   Cyclomatic Complexity 2 include/linux/bitops.h:hweight_long
   Cyclomatic Complexity 1 include/linux/log2.h:__ilog2_u64
   Cyclomatic Complexity 2 include/linux/list.h:__list_add
   Cyclomatic Complexity 1 include/linux/list.h:list_add
   Cyclomatic Complexity 1 include/linux/list.h:__list_del
   Cyclomatic Complexity 2 include/linux/list.h:__list_del_entry
   Cyclomatic Complexity 1 include/linux/list.h:list_del

vim +/if +101 kernel/torture.c

  > 24  #include <linux/kernel.h>
    25  #include <linux/init.h>
    26  #include <linux/module.h>
    27  #include <linux/kthread.h>
    28  #include <linux/err.h>
    29  #include <linux/spinlock.h>
    30  #include <linux/smp.h>
    31  #include <linux/interrupt.h>
    32  #include <linux/sched.h>
    33  #include <linux/sched/clock.h>
    34  #include <linux/atomic.h>
    35  #include <linux/bitops.h>
    36  #include <linux/completion.h>
    37  #include <linux/moduleparam.h>
    38  #include <linux/percpu.h>
    39  #include <linux/notifier.h>
    40  #include <linux/reboot.h>
    41  #include <linux/freezer.h>
    42  #include <linux/cpu.h>
    43  #include <linux/delay.h>
    44  #include <linux/stat.h>
    45  #include <linux/slab.h>
    46  #include <linux/trace_clock.h>
    47  #include <linux/ktime.h>
    48  #include <asm/byteorder.h>
    49  #include <linux/torture.h>
    50  #include "rcu/rcu.h"
    51  
    52  MODULE_LICENSE("GPL");
    53  MODULE_AUTHOR("Paul E. McKenney <[email protected]>");
    54  
    55  static char *torture_type;
    56  static bool verbose;
    57  
    58  /* Mediate rmmod and system shutdown.  Concurrent rmmod & shutdown 
illegal! */
    59  #define FULLSTOP_DONTSTOP 0     /* Normal operation. */
    60  #define FULLSTOP_SHUTDOWN 1     /* System shutdown with torture 
running. */
    61  #define FULLSTOP_RMMOD    2     /* Normal rmmod of torture. */
    62  static int fullstop = FULLSTOP_RMMOD;
    63  static DEFINE_MUTEX(fullstop_mutex);
    64  
    65  #ifdef CONFIG_HOTPLUG_CPU
    66  
    67  /*
    68   * Variables for online-offline handling.  Only present if CPU hotplug
    69   * is enabled, otherwise does nothing.
    70   */
    71  
    72  static struct task_struct *onoff_task;
    73  static long onoff_holdoff;
    74  static long onoff_interval;
    75  static long n_offline_attempts;
    76  static long n_offline_successes;
    77  static unsigned long sum_offline;
    78  static int min_offline = -1;
    79  static int max_offline;
    80  static long n_online_attempts;
    81  static long n_online_successes;
    82  static unsigned long sum_online;
    83  static int min_online = -1;
    84  static int max_online;
    85  
    86  /*
    87   * Attempt to take a CPU offline.  Return false if the CPU is already
    88   * offline or if it is not subject to CPU-hotplug operations.  The
    89   * caller can detect other failures by looking at the statistics.
    90   */
    91  bool torture_offline(int cpu, long *n_offl_attempts, long 
*n_offl_successes,
    92                       unsigned long *sum_offl, int *min_offl, int 
*max_offl)
    93  {
    94          unsigned long delta;
    95          int ret;
    96          unsigned long starttime;
    97  
    98          if (!cpu_online(cpu) || !cpu_is_hotpluggable(cpu))
    99                  return false;
   100  
 > 101          if (verbose > 1)
   102                  pr_alert("%s" TORTURE_FLAG
   103                           "torture_onoff task: offlining %d\n",
   104                           torture_type, cpu);
   105          starttime = jiffies;
   106          (*n_offl_attempts)++;
   107          ret = cpu_down(cpu);
   108          if (ret) {
   109                  if (verbose)
   110                          pr_alert("%s" TORTURE_FLAG
   111                                   "torture_onoff task: offline %d 
failed: errno %d\n",
   112                                   torture_type, cpu, ret);
   113          } else {
   114                  if (verbose > 1)
   115                          pr_alert("%s" TORTURE_FLAG
   116                                   "torture_onoff task: offlined %d\n",
   117                                   torture_type, cpu);
   118                  (*n_offl_successes)++;
   119                  delta = jiffies - starttime;
   120                  *sum_offl += delta;
   121                  if (*min_offl < 0) {
   122                          *min_offl = delta;
   123                          *max_offl = delta;
   124                  }
   125                  if (*min_offl > delta)
   126                          *min_offl = delta;
   127                  if (*max_offl < delta)
   128                          *max_offl = delta;
   129          }
   130  
   131          return true;
   132  }
   133  EXPORT_SYMBOL_GPL(torture_offline);
   134  

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip

Reply via email to