[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <be025b385bb94e0c92cd02ab57dc984b@AcuMS.aculab.com>
Date: Wed, 4 Dec 2024 18:26:16 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Tejun Heo' <tj@...nel.org>, Dan Carpenter <dan.carpenter@...aro.org>
CC: Naresh Kamboju <naresh.kamboju@...aro.org>, "linux-s390@...r.kernel.org"
<linux-s390@...r.kernel.org>, clang-built-linux <llvm@...ts.linux.dev>,
linux-block <linux-block@...r.kernel.org>, open list
<linux-kernel@...r.kernel.org>, "lkft-triage@...ts.linaro.org"
<lkft-triage@...ts.linaro.org>, Linux Regressions
<regressions@...ts.linux.dev>, Anders Roxell <anders.roxell@...aro.org>,
"Arnd Bergmann" <arnd@...db.de>, Nathan Chancellor <nathan@...nel.org>, Jens
Axboe <axboe@...nel.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
From: Tejun Heo
> Sent: 04 December 2024 17:41
>
> 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);
> >
...
>
> 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?
Perhaps if written as:
inuse = min(inuse, active) ?: 1;
it might stop someone changing it back.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists