[linux-next:master 1998/2197] block/blk-iocost.c:1101:11: error: call to '__compiletime_assert_762' declared with 'error' attribute: clamp() low limit 1 greater than high limit active

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   ebe1b11614e079c5e366ce9bd3c8f44ca0fbcc1b
commit: c64c5a658519e4a0342e1e5c9b38d1413c7ec422 [1998/2197] minmax.h: simplify the variants of clamp()
config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20241207/202412070124.l0kv7TqZ-lkp@xxxxxxxxx/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241207/202412070124.l0kv7TqZ-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/202412070124.l0kv7TqZ-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

   In file included from block/blk-iocost.c:176:
   In file included from include/linux/module.h:19:
   In file included from include/linux/elf.h:6:
   In file included from arch/s390/include/asm/elf.h:181:
   In file included from arch/s390/include/asm/mmu_context.h:11:
   In file included from arch/s390/include/asm/pgalloc.h:18:
   In file included from include/linux/mm.h:2223:
   include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     504 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     505 |                            item];
         |                            ~~~~
   include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     511 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     512 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     518 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
   include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     524 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     525 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
>> block/blk-iocost.c:1101:11: error: call to '__compiletime_assert_762' declared with 'error' attribute: clamp() low limit 1 greater than high limit active
    1101 |                 inuse = clamp_t(u32, inuse, 1, active);
         |                         ^
   include/linux/minmax.h:220:36: note: expanded from macro 'clamp_t'
     220 | #define clamp_t(type, val, lo, hi) __careful_clamp(type, val, lo, hi)
         |                                    ^
   include/linux/minmax.h:197:2: note: expanded from macro '__careful_clamp'
     197 |         __clamp_once(type, val, lo, hi, __UNIQUE_ID(v_), __UNIQUE_ID(l_), __UNIQUE_ID(h_))
         |         ^
   include/linux/minmax.h:190:2: note: expanded from macro '__clamp_once'
     190 |         BUILD_BUG_ON_MSG(statically_true(ulo > uhi),                            \
         |         ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:530:2: note: expanded from macro '_compiletime_assert'
     530 |         __compiletime_assert(condition, msg, prefix, suffix)
         |         ^
   include/linux/compiler_types.h:523:4: note: expanded from macro '__compiletime_assert'
     523 |                         prefix ## suffix();                             \
         |                         ^
   <scratch space>:16:1: note: expanded from here
      16 | __compiletime_assert_762
         | ^
>> block/blk-iocost.c:1101:11: error: call to '__compiletime_assert_762' declared with 'error' attribute: clamp() low limit 1 greater than high limit active
   include/linux/minmax.h:220:36: note: expanded from macro 'clamp_t'
     220 | #define clamp_t(type, val, lo, hi) __careful_clamp(type, val, lo, hi)
         |                                    ^
   include/linux/minmax.h:197:2: note: expanded from macro '__careful_clamp'
     197 |         __clamp_once(type, val, lo, hi, __UNIQUE_ID(v_), __UNIQUE_ID(l_), __UNIQUE_ID(h_))
         |         ^
   include/linux/minmax.h:190:2: note: expanded from macro '__clamp_once'
     190 |         BUILD_BUG_ON_MSG(statically_true(ulo > uhi),                            \
         |         ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:530:2: note: expanded from macro '_compiletime_assert'
     530 |         __compiletime_assert(condition, msg, prefix, suffix)
         |         ^
   include/linux/compiler_types.h:523:4: note: expanded from macro '__compiletime_assert'
     523 |                         prefix ## suffix();                             \
         |                         ^
   <scratch space>:16:1: note: expanded from here
      16 | __compiletime_assert_762
         | ^
   4 warnings and 2 errors generated.


vim +1101 block/blk-iocost.c

7caa47151ab2e6 Tejun Heo   2019-08-28  1078  
7caa47151ab2e6 Tejun Heo   2019-08-28  1079  /*
7caa47151ab2e6 Tejun Heo   2019-08-28  1080   * Update @iocg's `active` and `inuse` to @active and @inuse, update level
b0853ab4a238c5 Tejun Heo   2020-09-01  1081   * weight sums and propagate upwards accordingly. If @save, the current margin
b0853ab4a238c5 Tejun Heo   2020-09-01  1082   * is saved to be used as reference for later inuse in-period adjustments.
7caa47151ab2e6 Tejun Heo   2019-08-28  1083   */
b0853ab4a238c5 Tejun Heo   2020-09-01  1084  static void __propagate_weights(struct ioc_gq *iocg, u32 active, u32 inuse,
b0853ab4a238c5 Tejun Heo   2020-09-01  1085  				bool save, struct ioc_now *now)
7caa47151ab2e6 Tejun Heo   2019-08-28  1086  {
7caa47151ab2e6 Tejun Heo   2019-08-28  1087  	struct ioc *ioc = iocg->ioc;
7caa47151ab2e6 Tejun Heo   2019-08-28  1088  	int lvl;
7caa47151ab2e6 Tejun Heo   2019-08-28  1089  
7caa47151ab2e6 Tejun Heo   2019-08-28  1090  	lockdep_assert_held(&ioc->lock);
7caa47151ab2e6 Tejun Heo   2019-08-28  1091  
e9f4eee9a0023b Tejun Heo   2021-05-11  1092  	/*
e9f4eee9a0023b Tejun Heo   2021-05-11  1093  	 * For an active leaf node, its inuse shouldn't be zero or exceed
e9f4eee9a0023b Tejun Heo   2021-05-11  1094  	 * @active. An active internal node's inuse is solely determined by the
e9f4eee9a0023b Tejun Heo   2021-05-11  1095  	 * inuse to active ratio of its children regardless of @inuse.
e9f4eee9a0023b Tejun Heo   2021-05-11  1096  	 */
e9f4eee9a0023b Tejun Heo   2021-05-11  1097  	if (list_empty(&iocg->active_list) && iocg->child_active_sum) {
e9f4eee9a0023b Tejun Heo   2021-05-11  1098  		inuse = DIV64_U64_ROUND_UP(active * iocg->child_inuse_sum,
e9f4eee9a0023b Tejun Heo   2021-05-11  1099  					   iocg->child_active_sum);
e9f4eee9a0023b Tejun Heo   2021-05-11  1100  	} else {
db84a72af6be42 Tejun Heo   2020-09-01 @1101  		inuse = clamp_t(u32, inuse, 1, active);
e9f4eee9a0023b Tejun Heo   2021-05-11  1102  	}
db84a72af6be42 Tejun Heo   2020-09-01  1103  
b0853ab4a238c5 Tejun Heo   2020-09-01  1104  	iocg->last_inuse = iocg->inuse;
b0853ab4a238c5 Tejun Heo   2020-09-01  1105  	if (save)
b0853ab4a238c5 Tejun Heo   2020-09-01  1106  		iocg->saved_margin = now->vnow - atomic64_read(&iocg->vtime);
b0853ab4a238c5 Tejun Heo   2020-09-01  1107  
db84a72af6be42 Tejun Heo   2020-09-01  1108  	if (active == iocg->active && inuse == iocg->inuse)
db84a72af6be42 Tejun Heo   2020-09-01  1109  		return;
7caa47151ab2e6 Tejun Heo   2019-08-28  1110  
7caa47151ab2e6 Tejun Heo   2019-08-28  1111  	for (lvl = iocg->level - 1; lvl >= 0; lvl--) {
7caa47151ab2e6 Tejun Heo   2019-08-28  1112  		struct ioc_gq *parent = iocg->ancestors[lvl];
7caa47151ab2e6 Tejun Heo   2019-08-28  1113  		struct ioc_gq *child = iocg->ancestors[lvl + 1];
7caa47151ab2e6 Tejun Heo   2019-08-28  1114  		u32 parent_active = 0, parent_inuse = 0;
7caa47151ab2e6 Tejun Heo   2019-08-28  1115  
7caa47151ab2e6 Tejun Heo   2019-08-28  1116  		/* update the level sums */
7caa47151ab2e6 Tejun Heo   2019-08-28  1117  		parent->child_active_sum += (s32)(active - child->active);
7caa47151ab2e6 Tejun Heo   2019-08-28  1118  		parent->child_inuse_sum += (s32)(inuse - child->inuse);
e9f4eee9a0023b Tejun Heo   2021-05-11  1119  		/* apply the updates */
7caa47151ab2e6 Tejun Heo   2019-08-28  1120  		child->active = active;
7caa47151ab2e6 Tejun Heo   2019-08-28  1121  		child->inuse = inuse;
7caa47151ab2e6 Tejun Heo   2019-08-28  1122  
7caa47151ab2e6 Tejun Heo   2019-08-28  1123  		/*
7caa47151ab2e6 Tejun Heo   2019-08-28  1124  		 * The delta between inuse and active sums indicates that
5ba1add216fe82 Baolin Wang 2020-11-26  1125  		 * much of weight is being given away.  Parent's inuse
7caa47151ab2e6 Tejun Heo   2019-08-28  1126  		 * and active should reflect the ratio.
7caa47151ab2e6 Tejun Heo   2019-08-28  1127  		 */
7caa47151ab2e6 Tejun Heo   2019-08-28  1128  		if (parent->child_active_sum) {
7caa47151ab2e6 Tejun Heo   2019-08-28  1129  			parent_active = parent->weight;
7caa47151ab2e6 Tejun Heo   2019-08-28  1130  			parent_inuse = DIV64_U64_ROUND_UP(
7caa47151ab2e6 Tejun Heo   2019-08-28  1131  				parent_active * parent->child_inuse_sum,
7caa47151ab2e6 Tejun Heo   2019-08-28  1132  				parent->child_active_sum);
7caa47151ab2e6 Tejun Heo   2019-08-28  1133  		}
7caa47151ab2e6 Tejun Heo   2019-08-28  1134  
7caa47151ab2e6 Tejun Heo   2019-08-28  1135  		/* do we need to keep walking up? */
7caa47151ab2e6 Tejun Heo   2019-08-28  1136  		if (parent_active == parent->active &&
7caa47151ab2e6 Tejun Heo   2019-08-28  1137  		    parent_inuse == parent->inuse)
7caa47151ab2e6 Tejun Heo   2019-08-28  1138  			break;
7caa47151ab2e6 Tejun Heo   2019-08-28  1139  
7caa47151ab2e6 Tejun Heo   2019-08-28  1140  		active = parent_active;
7caa47151ab2e6 Tejun Heo   2019-08-28  1141  		inuse = parent_inuse;
7caa47151ab2e6 Tejun Heo   2019-08-28  1142  	}
7caa47151ab2e6 Tejun Heo   2019-08-28  1143  
7caa47151ab2e6 Tejun Heo   2019-08-28  1144  	ioc->weights_updated = true;
7caa47151ab2e6 Tejun Heo   2019-08-28  1145  }
7caa47151ab2e6 Tejun Heo   2019-08-28  1146  

:::::: The code at line 1101 was first introduced by commit
:::::: db84a72af6be422abf2089a5896293590dda5066 blk-iocost: clamp inuse and skip noops in __propagate_weights()

:::::: TO: Tejun Heo <tj@xxxxxxxxxx>
:::::: CC: Jens Axboe <axboe@xxxxxxxxx>

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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux