From: Tejun Heo <tj@kernel.org>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: David Laight <David.Laight@aculab.com>,
Naresh Kamboju <naresh.kamboju@linaro.org>,
"linux-s390@vger.kernel.org" <linux-s390@vger.kernel.org>,
clang-built-linux <llvm@lists.linux.dev>,
linux-block <linux-block@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>,
"lkft-triage@lists.linaro.org" <lkft-triage@lists.linaro.org>,
Linux Regressions <regressions@lists.linux.dev>,
Anders Roxell <anders.roxell@linaro.org>,
Arnd Bergmann <arnd@arndb.de>,
Nathan Chancellor <nathan@kernel.org>,
Jens Axboe <axboe@kernel.dk>
Subject: Re: s390: block/blk-iocost.c:1101:11: error: call to '__compiletime_assert_557' declared with 'error' attribute: clamp() low limit 1 greater than high limit active
Date: Wed, 4 Dec 2024 07:40:49 -1000 [thread overview]
Message-ID: <Z1CUIT8zAqWOnot-@slm.duckdns.org> (raw)
In-Reply-To: <c795c090-430a-45a6-88b2-94033d50dea2@stanley.mountain>
Hello,
On Wed, Dec 04, 2024 at 07:50:14PM +0300, Dan Carpenter wrote:
> Tejun probably reads everything to linux-block, but let's CC him explicitly.
Oh, I'm not. Thanks for cc'ing.
> block/blk-iocost.c
> 2222 TRACE_IOCG_PATH(iocg_idle, iocg, now,
> 2223 atomic64_read(&iocg->active_period),
> 2224 atomic64_read(&ioc->cur_period), vtime);
> 2225 __propagate_weights(iocg, 0, 0, false, now);
> ^
> Why is "active" zero? __propagate_weights() does a clamp() to 1 as minimum and
> we've added new build time asserts so this breaks the build.
>
> 2226 list_del_init(&iocg->active_list);
>
> The other way to solve this would be to something stupid like:
>
> diff --git a/block/blk-iocost.c b/block/blk-iocost.c
> index 384aa15e8260..551edd2f661f 100644
> --- a/block/blk-iocost.c
> +++ b/block/blk-iocost.c
> @@ -1094,7 +1094,7 @@ static void __propagate_weights(struct ioc_gq *iocg, u32 active, u32 inuse,
> * @active. An active internal node's inuse is solely determined by the
> * inuse to active ratio of its children regardless of @inuse.
> */
> - if (list_empty(&iocg->active_list) && iocg->child_active_sum) {
> + if ((list_empty(&iocg->active_list) && iocg->child_active_sum) || active == 0) {
> inuse = DIV64_U64_ROUND_UP(active * iocg->child_inuse_sum,
> iocg->child_active_sum);
> } else {
>
> But that seems really stupid.
This is a good catch. It's impressive that this can be caught at compile
time. The upper limit can become zero but the lower limit should win as
that's there to protect against divide by zero, so I think the right thinig
to do is replacing clamp() with max(min()). Is someone interested in writing
up the patch and sending it Jens' way?
Thanks.
--
tejun
next prev parent reply other threads:[~2024-12-04 17:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-04 10:31 s390: block/blk-iocost.c:1101:11: error: call to '__compiletime_assert_557' declared with 'error' attribute: clamp() low limit 1 greater than high limit active Naresh Kamboju
2024-12-04 14:39 ` Dan Carpenter
2024-12-04 16:11 ` David Laight
2024-12-04 16:50 ` Dan Carpenter
2024-12-04 17:40 ` Tejun Heo [this message]
2024-12-04 18:26 ` David Laight
2024-12-04 18:32 ` 'Tejun Heo'
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z1CUIT8zAqWOnot-@slm.duckdns.org \
--to=tj@kernel.org \
--cc=David.Laight@aculab.com \
--cc=anders.roxell@linaro.org \
--cc=arnd@arndb.de \
--cc=axboe@kernel.dk \
--cc=dan.carpenter@linaro.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=lkft-triage@lists.linaro.org \
--cc=llvm@lists.linux.dev \
--cc=naresh.kamboju@linaro.org \
--cc=nathan@kernel.org \
--cc=regressions@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox