From: Ralf Baechle <ralf@linux-mips.org>
To: "Maciej W. Rozycki" <macro@linux-mips.org>
Cc: Petri Gynther <pgynther@google.com>,
linux-mips <linux-mips@linux-mips.org>
Subject: Re: [PATCH] MIPS: add nmi_enter() + nmi_exit() to nmi_exception_handler()
Date: Tue, 12 Jan 2016 14:50:19 +0100 [thread overview]
Message-ID: <20160112135019.GB30362@linux-mips.org> (raw)
In-Reply-To: <alpine.LFD.2.20.1601120044470.23714@eddie.linux-mips.org>
On Tue, Jan 12, 2016 at 01:03:18AM +0000, Maciej W. Rozycki wrote:
> On Mon, 9 Nov 2015, Ralf Baechle wrote:
>
> > > > diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
> > > > index fdb392b..efcedd4 100644
> > > > --- a/arch/mips/kernel/traps.c
> > > > +++ b/arch/mips/kernel/traps.c
> > > > @@ -1856,12 +1856,14 @@ void __noreturn nmi_exception_handler(struct pt_regs *regs)
> > > > {
> > > > char str[100];
> > > >
> > > > + nmi_enter();
> > > > raw_notifier_call_chain(&nmi_chain, 0, regs);
> > > > bust_spinlocks(1);
> > > > snprintf(str, 100, "CPU%d NMI taken, CP0_EPC=%lx\n",
> > > > smp_processor_id(), regs->cp0_epc);
> > > > regs->cp0_epc = read_c0_errorepc();
> > > > die(str, regs);
> > > > + nmi_exit();
> > > > }
> > > >
> > > > #define VECTORSPACING 0x100 /* for EI/VI mode */
> > > > --
> > > > 2.6.0.rc2.230.g3dd15c0
> > > >
> > >
> > > Any comments/concerns about this patch?
> >
> > Is NMI on your systems actually recoverable? I never bothered with
> > nmi_enther / nmi_exit and other fine details of the NMI implementations
> > because as defined by the MIPS architecture an NMI may be pretty destructive
> > and closer to a reset than what other architectures describer as their NMI.
> > Think what's going to happen if it hits during any phase when $k0 / $k1
> > are active.
>
> We could do better though, by having a register stash area defined
> somewhere in low memory (0x0-0x7fff) -- of course if physical memory is
> actually available there in a given system. Remember that setting
> CP0.Status.ERL makes KUSEG identity mapped, making it possible to access
> its beginning off $zero and save all GPRs in a non-destructive manner.
>
> That is however assuming we can take control at all in the first place as
> the NMI vector is hardwired and points to a ROM location in a typical
> system.
NMIs don't nest; the system is lost if it receives another NMI before the
state of the first is saved. It's currently up to the system to avoid that
probably by yes masking the non-maskable interrupt.
ErrorEPC is also used by cache errors so an NMI following a cache error
exception before state has been saved might be fatal.
These are scenarios that are taken care of by CISC architectures but on a
purebred RISC they're up to system implementors.
Ralf
next prev parent reply other threads:[~2016-01-12 13:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-19 18:49 [PATCH] MIPS: add nmi_enter() + nmi_exit() to nmi_exception_handler() Petri Gynther
2015-11-02 20:50 ` Petri Gynther
2015-11-09 8:09 ` Ralf Baechle
2016-01-12 1:03 ` Maciej W. Rozycki
2016-01-12 13:50 ` Ralf Baechle [this message]
2016-01-12 21:38 ` Maciej W. Rozycki
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=20160112135019.GB30362@linux-mips.org \
--to=ralf@linux-mips.org \
--cc=linux-mips@linux-mips.org \
--cc=macro@linux-mips.org \
--cc=pgynther@google.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