Re: [PATCH] qspinlock: use signed temporaries for cmpxchg

From: Arnd Bergmann
Date: Tue Oct 27 2020 - 04:33:56 EST


On Tue, Oct 27, 2020 at 8:47 AM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> On Mon, Oct 26, 2020 at 02:03:06PM -0400, Waiman Long wrote:
> > On 10/26/20 12:57 PM, Arnd Bergmann wrote:
> > Yes, it shouldn't really matter if the value is defined as int or u32.
> > However, the only caveat that I see is queued_spin_lock_slowpath() is
> > expecting a u32 argument. Maybe you should cast it back to (u32) when
> > calling it.
>
> No, we're not going to confuse the code. That stuff is hard enough as it
> is. This warning is garbage and just needs to stay off.

Ok, so the question then becomes: should we drop -Wpointer-sign from
W=2 and move it to W=3, or instead disable it locally. I could add
__diag_ignore(GCC, 4, "-Wpointer-sign") in the couple of header files
that produce this kind of warning if there is a general feeling that it
still helps to have this for drivers.

In the current state, there are a handful of header files that cause 90%
of all the W=2 warnings, making it impractical to ever build a driver
with W=2 and get anything useful out of it. I find some of the warnings
in the set useful in finding actual bugs, but much less so if they are
drowned out by noise from known false-positives.

Arnd