linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] powerpc: Handle MCE on POWER9 with only DSISR bit 33 set
@ 2017-09-22  3:32 Michael Neuling
  2017-09-22 11:05 ` Balbir Singh
  2017-09-26 12:04 ` [v3] " Michael Ellerman
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Neuling @ 2017-09-22  3:32 UTC (permalink / raw)
  To: mpe; +Cc: linuxppc-dev, mikey, benh, Balbir Singh, Nicholas Piggin

On POWER9 DD2.1 and below, it's possible for a paste instruction to
cause a Machine Check Exception (MCE) where only DSISR bit 33 is
set. This will result in the MCE handler seeing an unknown event,
which triggers linux to crash.

We change this by detecting unknown events caused by load/stores in
the MCE handler and marking them as handled so that we no longer
crash.

An MCE that occurs like this is spurious, so we don't need to do
anything in terms of servicing it. If there is something that needs to
be serviced, the CPU will raise the MCE again with the correct DSISR
so that it can be serviced properly.

Signed-off-by: Michael Neuling <mikey@neuling.org>
Reviewed-by: Nicholas Piggin <npiggin@gmail.com
--
v3: Simplification and SRR1 check suggestions from Nick
v2: update commit message based on Balbir's comments
---
 arch/powerpc/kernel/mce_power.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/powerpc/kernel/mce_power.c b/arch/powerpc/kernel/mce_power.c
index b76ca198e0..e423cf0e43 100644
--- a/arch/powerpc/kernel/mce_power.c
+++ b/arch/powerpc/kernel/mce_power.c
@@ -624,5 +624,15 @@ long __machine_check_early_realmode_p8(struct pt_regs *regs)
 
 long __machine_check_early_realmode_p9(struct pt_regs *regs)
 {
+	/*
+	 * On POWER9 DD2.1 and below, it's possible to get machine
+	 * check caused by a paste instruction where only DSISR bit 33
+	 * is set. This will result in the MCE handler seeing an
+	 * unknown event and us crashing.  Change this to mark as
+	 * handled.
+	 */
+	if (SRR1_MC_LOADSTORE(regs->msr) && regs->dsisr == 0x40000000)
+		return 1;
+
 	return mce_handle_error(regs, mce_p9_derror_table, mce_p9_ierror_table);
 }
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] powerpc: Handle MCE on POWER9 with only DSISR bit 33 set
  2017-09-22  3:32 [PATCH v3] powerpc: Handle MCE on POWER9 with only DSISR bit 33 set Michael Neuling
@ 2017-09-22 11:05 ` Balbir Singh
  2017-09-26 12:04 ` [v3] " Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Balbir Singh @ 2017-09-22 11:05 UTC (permalink / raw)
  To: Michael Neuling
  Cc: Michael Ellerman, open list:LINUX FOR POWERPC (32-BIT AND 64-BIT),
	Benjamin Herrenschmidt, Nicholas Piggin

On Fri, Sep 22, 2017 at 1:32 PM, Michael Neuling <mikey@neuling.org> wrote:
> On POWER9 DD2.1 and below, it's possible for a paste instruction to
> cause a Machine Check Exception (MCE) where only DSISR bit 33 is
> set. This will result in the MCE handler seeing an unknown event,
> which triggers linux to crash.
>
> We change this by detecting unknown events caused by load/stores in
> the MCE handler and marking them as handled so that we no longer
> crash.
>
> An MCE that occurs like this is spurious, so we don't need to do
> anything in terms of servicing it. If there is something that needs to
> be serviced, the CPU will raise the MCE again with the correct DSISR
> so that it can be serviced properly.
>
> Signed-off-by: Michael Neuling <mikey@neuling.org>
> Reviewed-by: Nicholas Piggin <npiggin@gmail.com
> --
> v3: Simplification and SRR1 check suggestions from Nick
> v2: update commit message based on Balbir's comments
> ---
>  arch/powerpc/kernel/mce_power.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/arch/powerpc/kernel/mce_power.c b/arch/powerpc/kernel/mce_power.c
> index b76ca198e0..e423cf0e43 100644
> --- a/arch/powerpc/kernel/mce_power.c
> +++ b/arch/powerpc/kernel/mce_power.c
> @@ -624,5 +624,15 @@ long __machine_check_early_realmode_p8(struct pt_regs *regs)
>
>  long __machine_check_early_realmode_p9(struct pt_regs *regs)
>  {
> +       /*
> +        * On POWER9 DD2.1 and below, it's possible to get machine
> +        * check caused by a paste instruction where only DSISR bit 33
> +        * is set. This will result in the MCE handler seeing an
> +        * unknown event and us crashing.  Change this to mark as
> +        * handled.
> +        */
> +       if (SRR1_MC_LOADSTORE(regs->msr) && regs->dsisr == 0x40000000)
> +               return 1;
> +

Acked-by: Balbir SIngh <bsingharora@gmail.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [v3] powerpc: Handle MCE on POWER9 with only DSISR bit 33 set
  2017-09-22  3:32 [PATCH v3] powerpc: Handle MCE on POWER9 with only DSISR bit 33 set Michael Neuling
  2017-09-22 11:05 ` Balbir Singh
@ 2017-09-26 12:04 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2017-09-26 12:04 UTC (permalink / raw)
  To: Michael Neuling; +Cc: mikey, linuxppc-dev, Nicholas Piggin

On Fri, 2017-09-22 at 03:32:21 UTC, Michael Neuling wrote:
> On POWER9 DD2.1 and below, it's possible for a paste instruction to
> cause a Machine Check Exception (MCE) where only DSISR bit 33 is
> set. This will result in the MCE handler seeing an unknown event,
> which triggers linux to crash.
> 
> We change this by detecting unknown events caused by load/stores in
> the MCE handler and marking them as handled so that we no longer
> crash.
> 
> An MCE that occurs like this is spurious, so we don't need to do
> anything in terms of servicing it. If there is something that needs to
> be serviced, the CPU will raise the MCE again with the correct DSISR
> so that it can be serviced properly.
> 
> Signed-off-by: Michael Neuling <mikey@neuling.org>
> Reviewed-by: Nicholas Piggin <npiggin@gmail.com
> Acked-by: Balbir SIngh <bsingharora@gmail.com>

Applied to powerpc fixes, thanks.

https://git.kernel.org/powerpc/c/d8bd9f3f0925d22726de159531bfe3

cheers

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-09-26 12:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-22  3:32 [PATCH v3] powerpc: Handle MCE on POWER9 with only DSISR bit 33 set Michael Neuling
2017-09-22 11:05 ` Balbir Singh
2017-09-26 12:04 ` [v3] " Michael Ellerman

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).