Re: [PATCH v2 03/24] arm/cpu: Make sure arch_cpu_idle_dead() doesn't return

From
Russell King (Oracle) <linux@armlinux.org.uk>
Date
2023-02-14 22:02:40
Also in
linux-alpha, linux-arm-kernel, linux-mips, linux-sh, lkml, loongarch, sparclinux
Reply to
Josh Poimboeuf, 2023-02-14
On Tue, Feb 14, 2023 at 10:39:26AM -0800, Josh Poimboeuf wrote:
On Tue, Feb 14, 2023 at 11:15:23AM +0000, Russell King (Oracle) wrote:
quoted
On Mon, Feb 13, 2023 at 11:05:37PM -0800, Josh Poimboeuf wrote:
quoted
arch_cpu_idle_dead() doesn't return.  Make that more explicit with a
BUG().

BUG() is preferable to unreachable() because BUG() is a more explicit
failure mode and avoids undefined behavior like falling off the edge of
the function into whatever code happens to be next.
This is silly. Just mark the function __noreturn and be done with it.
If the CPU ever executes code past the "b" instruction, it's already
really broken that the extra instructions that BUG() gives will be
meaningless.

This patch does nothing except add yet more bloat the kernel.

Sorry, but NAK.
Problem is, the compiler can't read inline asm.  So you'd get a 
"'noreturn' function does return" warning.

We can do an unreachable() instead of a BUG() here if you prefer
undefined behavior.
That's fine.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Thread (58 messages) 58 messages, 8 authors, last reply 2023-03-02
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help