Thread (4 messages) flat view 4 messages, 3 authors, 2021-02-11

Re: Declaring unrecoverable_exception() as __noreturn ?

From: Christophe Leroy <hidden>
Date: 2021-02-11 06:15:56


Le 11/02/2021 à 05:41, Michael Ellerman a écrit :
Nicholas Piggin [off-list ref] writes:
quoted
Excerpts from Christophe Leroy's message of February 11, 2021 2:44 am:
quoted
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)
Hum ... Is that correct to define it as an interrupt handler ?

Also, I see it declared a second time in interrupt.c, this time not as an interrupt handler. Is that 
wanted ?
{
	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.
I don't think I want to declare die() as __noreturn, need to look at it more in details first.

Christophe
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help