Declaring unrecoverable_exception() as __noreturn ?
Michael Ellerman
mpe at ellerman.id.au
Thu Feb 11 15:41:48 AEDT 2021
Nicholas Piggin <npiggin at gmail.com> writes:
> Excerpts from Christophe Leroy's message of February 11, 2021 2:44 am:
>> As far as I can see, almost all callers of unrecoverable_exception() expect it to never return.
>>
>> Can we mark it __noreturn ?
>
> I don't see why not, do_exit is noreturn. We could make die() noreturn
> as well.
I'm always nervous about that, because we can return if a debugger is
involved:
DEFINE_INTERRUPT_HANDLER(unrecoverable_exception)
{
pr_emerg("Unrecoverable exception %lx at %lx (msr=%lx)\n",
regs->trap, regs->nip, regs->msr);
die("Unrecoverable exception", regs, SIGABRT);
}
void die(const char *str, struct pt_regs *regs, long err)
{
unsigned long flags;
/*
* system_reset_excption handles debugger, crash dump, panic, for 0x100
*/
if (TRAP(regs) != 0x100) {
if (debugger(regs))
return;
We obviously don't want to optimise for that case, but it worries me
slightly if we're marking things noreturn when they can actually return.
cheers
More information about the Linuxppc-dev
mailing list