[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190818120135.GV31406@gate.crashing.org>
Date: Sun, 18 Aug 2019 07:01:35 -0500
From: Segher Boessenkool <segher@...nel.crashing.org>
To: Christophe Leroy <christophe.leroy@....fr>
Cc: Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
Michael Ellerman <mpe@...erman.id.au>,
linux-kernel@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org
Subject: Re: [PATCH] powerpc: optimise WARN_ON()
On Sat, Aug 17, 2019 at 09:04:42AM +0000, Christophe Leroy wrote:
> Unlike BUG_ON(x), WARN_ON(x) uses !!(x) as the trigger
> of the t(d/w)nei instruction instead of using directly the
> value of x.
>
> This leads to GCC adding unnecessary pair of addic/subfe.
And it has to, it is passed as an "r" to an asm, GCC has to put the "!!"
value into a register.
> By using (x) instead of !!(x) like BUG_ON() does, the additional
> instructions go away:
But is it correct? What happens if you pass an int to WARN_ON, on a
64-bit kernel?
(You might want to have 64-bit generate either tw or td. But, with
your __builtin_trap patch, all that will be automatic).
Segher
Powered by blists - more mailing lists