linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: Michael Ellerman <mpe@ellerman.id.au>,
	Nicholas Piggin <npiggin@gmail.com>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Subject: Re: Declaring unrecoverable_exception() as __noreturn ?
Date: Thu, 11 Feb 2021 07:13:37 +0100	[thread overview]
Message-ID: <251d7de1-bb72-a949-6e64-e342a3becdfd@csgroup.eu> (raw)
In-Reply-To: <87mtwbnrlf.fsf@mpe.ellerman.id.au>



Le 11/02/2021 à 05:41, Michael Ellerman a écrit :
> Nicholas Piggin <npiggin@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)

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

      reply	other threads:[~2021-02-11  6:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-10 16:44 Declaring unrecoverable_exception() as __noreturn ? Christophe Leroy
2021-02-11  0:44 ` Nicholas Piggin
2021-02-11  4:41   ` Michael Ellerman
2021-02-11  6:13     ` Christophe Leroy [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=251d7de1-bb72-a949-6e64-e342a3becdfd@csgroup.eu \
    --to=christophe.leroy@csgroup.eu \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).