public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman•id.au>
To: Nicholas Piggin <npiggin@gmail•com>, linuxppc-dev@lists•ozlabs.org
Cc: Athira Rajeev <atrajeev@linux•vnet.ibm.com>
Subject: Re: [PATCH v7 39/42] powerpc: move NMI entry/exit code into wrapper
Date: Sat, 06 Feb 2021 10:38:13 +1100	[thread overview]
Message-ID: <875z36ozkq.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <1612438069.44myr3nzfs.astroid@bobo.none>

Nicholas Piggin <npiggin@gmail•com> writes:
> Excerpts from Michael Ellerman's message of February 4, 2021 8:15 pm:
>> Nicholas Piggin <npiggin@gmail•com> writes:
>>> This moves the common NMI entry and exit code into the interrupt handler
>>> wrappers.
>>>
>>> This changes the behaviour of soft-NMI (watchdog) and HMI interrupts, and
>>> also MCE interrupts on 64e, by adding missing parts of the NMI entry to
>>> them.
>>>
>>> Signed-off-by: Nicholas Piggin <npiggin@gmail•com>
>>> ---
>>>  arch/powerpc/include/asm/interrupt.h | 28 ++++++++++++++++++++++
>>>  arch/powerpc/kernel/mce.c            | 11 ---------
>>>  arch/powerpc/kernel/traps.c          | 35 +++++-----------------------
>>>  arch/powerpc/kernel/watchdog.c       | 10 ++++----
>>>  4 files changed, 38 insertions(+), 46 deletions(-)
>> 
>> This is unhappy when injecting SLB multi-hits:
>> 
>>   root@p86-2:~# echo PPC_SLB_MULTIHIT > /sys/kernel/debug/provoke-crash/DIRECT
>>   [  312.496026][ T1344] kernel BUG at arch/powerpc/include/asm/interrupt.h:152!
>>   [  312.496037][ T1344] Oops: Exception in kernel mode, sig: 5 [#1]
>>   [  312.496045][ T1344] LE PAGE_SIZE=64K MMU=Hash SMP NR_CPUS=2048 NUMA pSeries
>
> pseries hash. Blast!

The worst kind.

>> 147 static inline void interrupt_nmi_exit_prepare(struct pt_regs *regs, struct interrupt_nmi_state *state)
>> 148 {
>> 149 	if (!IS_ENABLED(CONFIG_PPC_BOOK3S_64) ||
>> 150 			!firmware_has_feature(FW_FEATURE_LPAR) ||
>> 151 			radix_enabled() || (mfmsr() & MSR_DR))
>> 152 		nmi_exit();
>> 
>> 
>> So presumably it's:
>> 
>> #define __nmi_exit()						\
>> 	do {							\
>> 		BUG_ON(!in_nmi());				\
>
> Yes that would be it, pseries machine check enables MMU half way through 
> so only one side of this triggers.
>
> The MSR_DR check is supposed to catch the other NMIs that run with MMU 
> on (perf, watchdog, etc). Suppose it could test TRAP(regs) explicitly
> although I wonder if we should also do this to keep things balanced

Yeah I think I like that. I'll give it a test.

cheers


> diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c
> index 149cec2212e6..f57ca0c570be 100644
> --- a/arch/powerpc/platforms/pseries/ras.c
> +++ b/arch/powerpc/platforms/pseries/ras.c
> @@ -719,6 +719,7 @@ static int mce_handle_err_virtmode(struct pt_regs *regs,
>  
>  static int mce_handle_error(struct pt_regs *regs, struct rtas_error_log *errp)
>  {
> +       unsigned long msr;
>         struct pseries_errorlog *pseries_log;
>         struct pseries_mc_errorlog *mce_log = NULL;
>         int disposition = rtas_error_disposition(errp);
> @@ -747,9 +748,12 @@ static int mce_handle_error(struct pt_regs *regs, struct rtas_error_log *errp)
>          *       SLB multihit is done by now.
>          */
>  out:
> -       mtmsr(mfmsr() | MSR_IR | MSR_DR);
> +       msr = mfmsr();
> +       mtmsr(msr | MSR_IR | MSR_DR);
>         disposition = mce_handle_err_virtmode(regs, errp, mce_log,
>                                               disposition);
> +       mtmsr(msr);
> +
>         return disposition;
>  }
>  

  reply	other threads:[~2021-02-05 23:39 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-30 13:08 [PATCH v7 00/42] powerpc: interrupt wrappers Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 01/42] powerpc/64s: interrupt exit improve bounding of interrupt recursion Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 02/42] KVM: PPC: Book3S HV: Context tracking exit guest context before enabling irqs Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 03/42] powerpc/32s: move DABR match out of handle_page_fault Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 04/42] powerpc/64s: " Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 05/42] powerpc/64s: move the hash fault handling logic to C Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 06/42] powerpc: remove arguments from fault handler functions Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 07/42] powerpc/fsl_booke/32: CacheLockingException remove args Nicholas Piggin
2021-02-08 10:04   ` Gautham R Shenoy
2021-02-08 11:54     ` Michael Ellerman
2021-01-30 13:08 ` [PATCH v7 08/42] powerpc: do_break get registers from regs Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 09/42] powerpc: DebugException remove args Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 10/42] powerpc/32: transfer can avoid saving r4/r5 over trace call Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 11/42] powerpc: bad_page_fault get registers from regs Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 12/42] powerpc/64s: add do_bad_page_fault_segv handler Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 13/42] powerpc: rearrange do_page_fault error case to be inside exception_enter Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 14/42] powerpc/64s: move bad_page_fault handling to C Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 15/42] powerpc/64s: split do_hash_fault Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 16/42] powerpc/mm: Remove stale do_page_fault comment referring to SLB faults Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 17/42] powerpc/64s: slb comment update Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 18/42] powerpc/traps: add NOKPROBE_SYMBOL for sreset and mce Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 19/42] powerpc/perf: move perf irq/nmi handling details into traps.c Nicholas Piggin
2021-01-31 12:30   ` Athira Rajeev
2021-01-30 13:08 ` [PATCH v7 20/42] powerpc/time: move timer_broadcast_interrupt prototype to asm/time.h Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 21/42] powerpc: add and use unknown_async_exception Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 22/42] powerpc/cell: tidy up pervasive declarations Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 23/42] powerpc: introduce die_mce Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 24/42] powerpc/mce: ensure machine check handler always tests RI Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 25/42] powerpc: improve handling of unrecoverable system reset Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 26/42] powerpc: interrupt handler wrapper functions Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 27/42] powerpc: add interrupt wrapper entry / exit stub functions Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 28/42] powerpc: convert interrupt handlers to use wrappers Nicholas Piggin
2021-02-03  1:54   ` Nicholas Piggin
2021-02-05  8:09   ` Christophe Leroy
2021-02-06  2:43     ` Nicholas Piggin
2021-02-07 12:56     ` Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 29/42] powerpc: add interrupt_cond_local_irq_enable helper Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 30/42] powerpc/64: context tracking remove _TIF_NOHZ Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 31/42] powerpc/64s/hash: improve context tracking of hash faults Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 32/42] powerpc/64: context tracking move to interrupt wrappers Nicholas Piggin
2021-02-09  5:49   ` Christophe Leroy
2021-02-09  7:45     ` Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 33/42] powerpc/64: add context tracking to asynchronous interrupts Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 34/42] powerpc: handle irq_enter/irq_exit in interrupt handler wrappers Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 35/42] powerpc/64s: move context tracking exit to interrupt exit path Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 36/42] powerpc/64s: reconcile interrupts in C Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 37/42] powerpc/64: move account_stolen_time into its own function Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 38/42] powerpc/64: entry cpu time accounting in C Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 39/42] powerpc: move NMI entry/exit code into wrapper Nicholas Piggin
2021-02-04 10:15   ` Michael Ellerman
2021-02-04 11:31     ` Nicholas Piggin
2021-02-05 23:38       ` Michael Ellerman [this message]
2021-02-06  2:46         ` Nicholas Piggin
2021-02-07 12:54           ` Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 40/42] powerpc/64s: move NMI soft-mask handling to C Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 41/42] powerpc/64s: runlatch interrupt handling in C Nicholas Piggin
2021-01-30 13:08 ` [PATCH v7 42/42] powerpc/64s: power4 nap fixup " Nicholas Piggin
2021-02-02 10:31   ` Michael Ellerman
2021-02-03  0:35     ` Nicholas Piggin
2021-02-07 12:58     ` Nicholas Piggin
2021-02-02  5:57 ` [PATCH v7 00/42] powerpc: interrupt wrappers Christophe Leroy
2021-02-10 12:57 ` Michael Ellerman

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=875z36ozkq.fsf@mpe.ellerman.id.au \
    --to=mpe@ellerman$(echo .)id.au \
    --cc=atrajeev@linux$(echo .)vnet.ibm.com \
    --cc=linuxppc-dev@lists$(echo .)ozlabs.org \
    --cc=npiggin@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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