tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/urgent
head:   ce28d2e53cda890771360d32259495dd6a9c4253
commit: f1212844e9dc3a31d41f99713c5522acf92ff291 [1/5] sched/cpufreq: Fix 
32-bit math overflow
config: i386-randconfig-s2-201910 (attached as .config)
compiler: gcc-6 (Debian 6.5.0-2) 6.5.0 20181026
reproduce:
        git checkout f1212844e9dc3a31d41f99713c5522acf92ff291
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from arch/x86/include/asm/percpu.h:45:0,
                    from arch/x86/include/asm/current.h:6,
                    from include/linux/sched.h:12,
                    from kernel/sched/sched.h:5,
                    from kernel/sched/cpufreq_schedutil.c:11:
   kernel/sched/cpufreq_schedutil.c: In function 'sugov_iowait_boost':
   include/linux/kernel.h:846:29: warning: comparison of distinct pointer types 
lacks a cast
      (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
                                ^
   include/linux/kernel.h:860:4: note: in expansion of macro '__typecheck'
      (__typecheck(x, y) && __no_side_effects(x, y))
       ^~~~~~~~~~~
   include/linux/kernel.h:870:24: note: in expansion of macro '__safe_cmp'
     __builtin_choose_expr(__safe_cmp(x, y), \
                           ^~~~~~~~~~
   include/linux/kernel.h:879:19: note: in expansion of macro '__careful_cmp'
    #define min(x, y) __careful_cmp(x, y, <)
                      ^~~~~~~~~~~~~
>> kernel/sched/cpufreq_schedutil.c:346:26: note: in expansion of macro 'min'
      sg_cpu->iowait_boost = min(sg_cpu->iowait_boost << 1, 
SCHED_CAPACITY_SCALE);
                             ^~~

vim +/min +346 kernel/sched/cpufreq_schedutil.c

   311  
   312  /**
   313   * sugov_iowait_boost() - Updates the IO boost status of a CPU.
   314   * @sg_cpu: the sugov data for the CPU to boost
   315   * @time: the update time from the caller
   316   * @flags: SCHED_CPUFREQ_IOWAIT if the task is waking up after an IO 
wait
   317   *
   318   * Each time a task wakes up after an IO operation, the CPU utilization 
can be
   319   * boosted to a certain utilization which doubles at each "frequent and
   320   * successive" wakeup from IO, ranging from the utilization of the 
minimum
   321   * OPP to the utilization of the maximum OPP.
   322   * To keep doubling, an IO boost has to be requested at least once per 
tick,
   323   * otherwise we restart from the utilization of the minimum OPP.
   324   */
   325  static void sugov_iowait_boost(struct sugov_cpu *sg_cpu, u64 time,
   326                                 unsigned int flags)
   327  {
   328          bool set_iowait_boost = flags & SCHED_CPUFREQ_IOWAIT;
   329  
   330          /* Reset boost if the CPU appears to have been idle enough */
   331          if (sg_cpu->iowait_boost &&
   332              sugov_iowait_reset(sg_cpu, time, set_iowait_boost))
   333                  return;
   334  
   335          /* Boost only tasks waking up after IO */
   336          if (!set_iowait_boost)
   337                  return;
   338  
   339          /* Ensure boost doubles only one time at each request */
   340          if (sg_cpu->iowait_boost_pending)
   341                  return;
   342          sg_cpu->iowait_boost_pending = true;
   343  
   344          /* Double the boost at each request */
   345          if (sg_cpu->iowait_boost) {
 > 346                  sg_cpu->iowait_boost = min(sg_cpu->iowait_boost << 1, 
 > SCHED_CAPACITY_SCALE);
   347                  return;
   348          }
   349  
   350          /* First wakeup after IO: start with minimum boost */
   351          sg_cpu->iowait_boost = sg_cpu->min;
   352  }
   353  

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