[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YtF3YIBA0Dd4KXZ+@yury-laptop>
Date: Fri, 15 Jul 2022 07:19:12 -0700
From: Yury Norov <yury.norov@...il.com>
To: Guenter Roeck <linux@...ck-us.net>
Cc: Alexander Lobakin <alexandr.lobakin@...el.com>,
Arnd Bergmann <arnd@...db.de>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Mark Rutland <mark.rutland@....com>,
Matt Turner <mattst88@...il.com>,
Brian Cain <bcain@...cinc.com>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Yoshinori Sato <ysato@...rs.sourceforge.jp>,
Rich Felker <dalias@...c.org>,
"David S. Miller" <davem@...emloft.net>,
Kees Cook <keescook@...omium.org>,
"Peter Zijlstra (Intel)" <peterz@...radead.org>,
Marco Elver <elver@...gle.com>, Borislav Petkov <bp@...e.de>,
Tony Luck <tony.luck@...el.com>,
Maciej Fijalkowski <maciej.fijalkowski@...el.com>,
Jesse Brandeburg <jesse.brandeburg@...el.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Tom Rix <trix@...hat.com>, kernel test robot <lkp@...el.com>,
linux-alpha@...r.kernel.org, linux-hexagon@...r.kernel.org,
linux-ia64@...r.kernel.org, linux-m68k@...ts.linux-m68k.org,
linux-sh@...r.kernel.org, sparclinux@...r.kernel.org,
linux-arch@...r.kernel.org, llvm@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 6/9] bitops: let optimize out non-atomic bitops on
compile-time constants
On Fri, Jul 15, 2022 at 06:49:46AM -0700, Guenter Roeck wrote:
> On 7/15/22 06:26, Alexander Lobakin wrote:
> > From: Guenter Roeck <linux@...ck-us.net>
> > Date: Thu, 14 Jul 2022 17:04:02 -0700
> >
> > > On Fri, Jun 24, 2022 at 02:13:10PM +0200, Alexander Lobakin wrote:
> > > > Currently, many architecture-specific non-atomic bitop
> > > > implementations use inline asm or other hacks which are faster or
> >
> > [...]
> >
> > > > Cc: Mark Rutland <mark.rutland@....com>
> > > > Signed-off-by: Alexander Lobakin <alexandr.lobakin@...el.com>
> > > > Reviewed-by: Marco Elver <elver@...gle.com>
> > >
> > > Building i386:allyesconfig ... failed
> > > --------------
> > > Error log:
> > > arch/x86/platform/olpc/olpc-xo1-sci.c: In function 'send_ebook_state':
> > > arch/x86/platform/olpc/olpc-xo1-sci.c:83:63: error: logical not is only applied to the left hand side of comparison
> >
> > Looks like a trigger, not a cause... Anyway, this construct:
> >
> > unsigned char state;
> >
> > [...]
> >
> > if (!!test_bit(SW_TABLET_MODE, ebook_switch_idev->sw) == state)
> >
> > doesn't look legit enough.
> > That redundant double-negation [of boolean value], together with
> > comparing boolean to char, provokes compilers to think the author
> > made logical mistakes here, although it works as expected.
> > Could you please try (if it's not automated build which you can't
> > modify) the following:
> >
>
> Agreed, the existing code seems wrong. The change below looks correct
> and fixes the problem. Feel free to add
>
> Reviewed-and-tested-by: Guenter Roeck <linux@...ck-us.net>
>
> to the real patch.
>
> Thanks,
> Guenter
>
> > --- a/arch/x86/platform/olpc/olpc-xo1-sci.c
> > +++ b/arch/x86/platform/olpc/olpc-xo1-sci.c
> > @@ -80,7 +80,7 @@ static void send_ebook_state(void)
> > return;
> > }
> > - if (!!test_bit(SW_TABLET_MODE, ebook_switch_idev->sw) == state)
> > + if (test_bit(SW_TABLET_MODE, ebook_switch_idev->sw) == !!state)
> > return; /* Nothing new to report. */
> > input_report_switch(ebook_switch_idev, SW_TABLET_MODE, state);
> > ---
> >
> > We'd take it into the bitmap tree then. The series revealed
> > a fistful of existing code issues already :)
Would you like me to add your signed-off-by and apply, or you prefer
to send it out as a patch?
Thanks,
Yury
Powered by blists - more mailing lists