[linux-next:master 1948/2656] block/blk-iocost.c:1101:11: error: call to __compiletime_assert_560 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:   91e71d606356e50f238d7a87aacdee4abc427f07
commit: 212fe932ee57ec4a0f41bdc42b58c64fe3062147 [1948/2656] minmax.h: simplify the variants of clamp()
config: s390-defconfig (https://download.01.org/0day-ci/archive/20241212/202412120322.3GfVe3vF-lkp@xxxxxxxxx/config)
compiler: clang version 15.0.7 (https://github.com/llvm/llvm-project 8dfdcc7b7bf66834a761bd8de445840ef68e4d1a)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241212/202412120322.3GfVe3vF-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/202412120322.3GfVe3vF-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

>> block/blk-iocost.c:1101:11: error: call to __compiletime_assert_560 declared with 'error' attribute: clamp() low limit 1 greater than high limit active
                   inuse = clamp_t(u32, inuse, 1, active);
                           ^
   include/linux/minmax.h:220:36: note: expanded from macro 'clamp_t'
   #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'
           __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'
           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'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:523:4: note: expanded from macro '__compiletime_assert'
                           prefix ## suffix();                             \
                           ^
   <scratch space>:24:1: note: expanded from here
   __compiletime_assert_560
   ^
>> block/blk-iocost.c:1101:11: error: call to __compiletime_assert_560 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'
   #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'
           __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'
           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'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:523:4: note: expanded from macro '__compiletime_assert'
                           prefix ## suffix();                             \
                           ^
   <scratch space>:24:1: note: expanded from here
   __compiletime_assert_560
   ^
   2 errors generated.


vim +/error +1101 block/blk-iocost.c

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