* [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
@ 2024-12-11 19:35 kernel test robot
2024-12-12 9:39 ` David Laight
0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2024-12-11 19:35 UTC (permalink / raw)
To: David Laight
Cc: llvm, oe-kbuild-all, Andrew Morton, Linux Memory Management List
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@intel.com/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@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202412120322.3GfVe3vF-lkp@intel.com/
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@kernel.org>
:::::: CC: Jens Axboe <axboe@kernel.dk>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 2+ messages in thread
* RE: [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
2024-12-11 19:35 [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 kernel test robot
@ 2024-12-12 9:39 ` David Laight
0 siblings, 0 replies; 2+ messages in thread
From: David Laight @ 2024-12-12 9:39 UTC (permalink / raw)
To: 'kernel test robot'
Cc: llvm, oe-kbuild-all, Andrew Morton, Linux Memory Management List
From: kernel test robot
> Sent: 11 December 2024 19:35
>
> 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@intel.com/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@intel.com/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@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202412120322.3GfVe3vF-lkp@intel.com/
>
...
> 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);
...
Duplicate - there is an inlined call that passes 'active = 0'.
IIRC the clamp() is there to avoid a divide by zero later.
The code is buggy and I think there is a fix pending.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-12-12 9:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-11 19:35 [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 kernel test robot
2024-12-12 9:39 ` David Laight
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox