[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <94e15b07-bc0c-4c14-8dc7-d488491b42c9@roeck-us.net>
Date: Mon, 20 Jan 2025 21:58:24 -0800
From: Guenter Roeck <linux@...ck-us.net>
To: Linus Torvalds <torvalds@...ux-foundation.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: David Laight <david.laight.linux@...il.com>,
Jani Nikula <jani.nikula@...ux.intel.com>,
David Laight <David.Laight@...lab.com>, Arnd Bergmann <arnd@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Jens Axboe <axboe@...nel.dk>, Matthew Wilcox <willy@...radead.org>,
Christoph Hellwig <hch@...radead.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Dan Carpenter <dan.carpenter@...aro.org>,
"Jason A . Donenfeld" <Jason@...c4.com>,
"pedro.falcato@...il.com" <pedro.falcato@...il.com>,
Mateusz Guzik <mjguzik@...il.com>, "linux-mm@...ck.org"
<linux-mm@...ck.org>, Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
intel-xe@...ts.freedesktop.org, intel-gfx@...ts.freedesktop.org,
David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>,
Rodrigo Vivi <rodrigo.vivi@...el.com>
Subject: Re: Buiild error in i915/xe
On 1/20/25 11:14, Linus Torvalds wrote:
> On Mon, 20 Jan 2025 at 10:55, Andy Shevchenko
> <andriy.shevchenko@...ux.intel.com> wrote:
>>
>> Excuse me if I am missing something, but clamp() has a warning inside it, correct?
>> Why do we need an additional warning on top of that?
>
> Note: the warning in clamp() only finds compile-time obvious wrong uses.
>
> It's really meant to notice the trivial case where you clam with
> constants and just got the order wrong, so you do something silly like
>
> res = clamp(in, 15, 1);
>
> but it does also end up catching slightly more complex things where
> the compiler can figure out the range of the clamping.
>
> The build problem then comes from the compiler doing various *other*
> code movem,ent and optimization too, and - like in this case - finds
> an error path where the clamping is done "wrong".
>
> I think the real issue in the i915 driver is that it does that
> WARN_ON(), but then it just happily continues anyway.
>
> So if the i915 driver instead did
>
> if (WARN_ON(..)) return invalid value;
>
> none of this would ever have happened.
>
I'll take a stab and send a patch combining your and David's suggestions.
Guenter
Powered by blists - more mailing lists