From: Nicholas Piggin <npiggin@gmail.com> Date: 2017-07-05 04:04:37
These are some improvements to recoverability and debugability
of machine check handling. Patch 2 depends on patch 1, but they
are otherwise independent.
Thanks,
Nick
Nicholas Piggin (4):
powerpc/powernv: handle the platform error reboot in ppc_md.restart
powerpc/powernv: machine check use kernel crash path
powernv/pseries: machine check use kernel crash path
powerpc: machine check interrupt is a non-maskable interrupt
arch/powerpc/include/asm/opal.h | 2 +-
arch/powerpc/kernel/traps.c | 9 +++--
arch/powerpc/platforms/powernv/opal-hmi.c | 20 ++---------
arch/powerpc/platforms/powernv/opal.c | 57 ++++++++-----------------------
arch/powerpc/platforms/powernv/powernv.h | 2 ++
arch/powerpc/platforms/powernv/setup.c | 31 +++++++++++++++++
arch/powerpc/platforms/pseries/ras.c | 22 ++++++------
7 files changed, 69 insertions(+), 74 deletions(-)
--
2.11.0
From: Nicholas Piggin <npiggin@gmail.com> Date: 2017-07-05 04:04:19
Unrecovered MCE and HMI errors are sent through a special restart
OPAL call to log the platform error. The downside is that they don't
go through normal crash paths, so they don't give much information
to the Linux console.
Change this by allowing them to set an error which then causes the
normal restart handler to use the platform error call. Have MCE and HMI
handlers set this and then use the normal panic path for unrecoverable
cases.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
arch/powerpc/include/asm/opal.h | 2 +-
arch/powerpc/platforms/powernv/opal-hmi.c | 20 +++-------------
arch/powerpc/platforms/powernv/opal.c | 39 ++-----------------------------
arch/powerpc/platforms/powernv/powernv.h | 2 ++
arch/powerpc/platforms/powernv/setup.c | 31 ++++++++++++++++++++++++
5 files changed, 39 insertions(+), 55 deletions(-)
@@ -267,8 +269,6 @@ static void hmi_event_handler(struct work_struct *work)spin_unlock_irqrestore(&opal_hmi_evt_lock,flags);if(unrecoverable){-intret;-/* Pull all HMI events from OPAL before we panic. */while(opal_get_msg(__pa(&msg),sizeof(msg))==OPAL_SUCCESS){u32type;
@@ -284,22 +284,8 @@ static void hmi_event_handler(struct work_struct *work)print_hmi_event_info(hmi_evt);}-/*-*UnrecoverableHMIexception.WeneedtoinformBMC/OCC-*aboutthiserrorsothatitcancollectrelevantdata-*forerroranalysisbeforerebooting.-*/-ret=opal_cec_reboot2(OPAL_REBOOT_PLATFORM_ERROR,-"Unrecoverable HMI exception");-if(ret==OPAL_UNSUPPORTED){-pr_emerg("Reboot type %d not supported\n",-OPAL_REBOOT_PLATFORM_ERROR);-}+pnv_platform_error="Unrecoverable HMI exception";-/*-*Fallthroughandpanicifopal_cec_reboot2()returns-*OPAL_UNSUPPORTED.-*/panic("Unrecoverable HMI exception");}}
@@ -424,7 +424,6 @@ static int opal_recover_mce(struct pt_regs *regs,intopal_machine_check(structpt_regs*regs){structmachine_check_eventevt;-intret;if(!get_mce_event(&evt,MCE_EVENT_RELEASE))return0;
@@ -440,43 +439,9 @@ int opal_machine_check(struct pt_regs *regs)if(opal_recover_mce(regs,&evt))return1;-/*-*Unrecoveredmachinecheck,weareheadingtopanicpath.-*-*WemayhavehitthisMCEinveryearlystageofkernel-*initializationevenbeforeopal-prdhasstartedrunning.If-*thisisthecasethenthisMCEerrormaygoun-noticedor-*un-analyzedifwegodownpanicpath.Weneedtoinform-*BMC/OCCaboutthiserrorsothattheycancollectrelevant-*dataforerroranalysisbeforerebooting.-*Useopal_cec_reboot2(OPAL_REBOOT_PLATFORM_ERROR)todoso.-*ThisfunctionmaynotreturnonBMCbasedsystem.-*/-ret=opal_cec_reboot2(OPAL_REBOOT_PLATFORM_ERROR,-"Unrecoverable Machine Check exception");-if(ret==OPAL_UNSUPPORTED){-pr_emerg("Reboot type %d not supported\n",-OPAL_REBOOT_PLATFORM_ERROR);-}+pnv_platform_error="Unrecoverable Machine Check exception";-/*-*Wereachedhere.Therecanbethreepossibilities:-*1.Wearerunningonafirmwarelevelthatdonotsupport-*opal_cec_reboot2()-*2.Wearerunningonafirmwarelevelthatdonotsupport-*OPAL_REBOOT_PLATFORM_ERRORreboottype.-*3.WearerunningonFSPbasedsystemthatdoesnotneedopal-*totriggercheckstopexplicitlyforerroranalysis.TheFSP-*PRDcomponentwouldhavealreadygotnotifiedaboutthis-*errorthroughotherchannels.-*-*IfhardwaremarkedthisasanunrecoverableMCE,weare-*goingtopanicanyway.Evenifitdidn't,it'snotsafeto-*continueatthispoint,soweshouldexplicitlypanic.-*/--panic("PowerNV Unrecovered Machine Check");-return0;+panic("Unrecoverable Machine Check exception");}/* Early hmi handler called in real mode. */
From: Nicholas Piggin <npiggin@gmail.com> Date: 2017-07-05 04:04:45
Use the kernel crash path in cases of recovered machine checks that
occur in kernel mode, because it gives much better Linux crash
information, and can allow the offending process to be killed without
completely taking down the system.
As a test, when triggering an i-side 0111b error (ifetch from foreign
address) in kernel mode process context on POWER9, the kernel currently
dies quickly like this:
Severe Machine check interrupt [Not recovered]
NIP [ffff000000000000]: 0xffff000000000000
Initiator: CPU
Error type: Real address [Instruction fetch (foreign)]
[ 127.426651616,0] OPAL: Reboot requested due to Platform error.
Effective[ 127.426693712,3] OPAL: Reboot requested due to Platform error. address: ffff000000000000
opal: Reboot type 1 not supported
Kernel panic - not syncing: PowerNV Unrecovered Machine Check
CPU: 56 PID: 4425 Comm: syscall Tainted: G M 4.12.0-rc1-13857-ga4700a261072-dirty #35
Call Trace:
[ 128.017988928,4] IPMI: BUG: Dropping ESEL on the floor due to buggy/mising code in OPAL for this BMCRebooting in 10 seconds..
Trying to free IRQ 496 from IRQ context!
After this patch, the process is killed and the kernel continues with
this message, which gives enough information to identify the offending
branch (e.g., CFAR):
Severe Machine check interrupt [Not recovered]
NIP [ffff000000000000]: 0xffff000000000000
Initiator: CPU
Error type: Real address [Instruction fetch (foreign)]
Effective address: ffff000000000000
Oops: Machine check, sig: 7 [#1]
SMP NR_CPUS=2048
NUMA
PowerNV
Modules linked in: iptable_mangle ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_nat_ipv4 nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack nf_conntrack ipt_REJECT nf_reject_ipv4 xt_tcpudp tun bridge stp llc kvm_hv kvm iptable_filter binfmt_misc vmx_crypto ip_tables x_tables autofs4 crc32c_vpmsum
CPU: 22 PID: 4436 Comm: syscall Tainted: G M 4.12.0-rc1-13857-ga4700a261072-dirty #36
task: c000000932300000 task.stack: c000000932380000
NIP: ffff000000000000 LR: 00000000217706a4 CTR: ffff000000000000
REGS: c00000000fc8fd80 TRAP: 0200 Tainted: G M (4.12.0-rc1-13857-ga4700a261072-dirty)
MSR: 90000000001c1003 <SF,HV,ME,RI,LE>
CR: 24000484 XER: 20000000
CFAR: c000000000004c80 DAR: 0000000021770a90 DSISR: 0a000000 SOFTE: 1
GPR00: 0000000000001ebe 00007fffce4818b0 0000000021797f00 0000000000000000
GPR04: 00007fff8007ac24 0000000044000484 0000000000004000 00007fff801405e8
GPR08: 900000000280f033 0000000024000484 0000000000000000 0000000000000030
GPR12: 9000000000001003 00007fff801bc370 0000000000000000 0000000000000000
GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
GPR20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
GPR24: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
GPR28: 00007fff801b0000 0000000000000000 00000000217707a0 00007fffce481918
NIP [ffff000000000000] 0xffff000000000000
LR [00000000217706a4] 0x217706a4
Call Trace:
Instruction dump:
XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
---[ end trace 32ae1dabb4f8dae6 ]---
---
arch/powerpc/platforms/powernv/opal.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
From: Nicholas Piggin <npiggin@gmail.com> Date: 2017-07-05 04:04:48
Similarly to the powernv patch, pseries can recover from and/or
print more error details from a recovered machine check if it
goes via the kernel crash path rather than panic()ing in the case
of MCE in kernel mode.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
arch/powerpc/platforms/pseries/ras.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
From: Nicholas Piggin <npiggin@gmail.com> Date: 2017-07-05 04:04:51
Use nmi_enter similarly to system reset interrupts. This uses NMI
printk NMI buffers and turns off various debugging facilities that
helps avoid tripping on ourselves or other CPUs.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
arch/powerpc/kernel/traps.c | 9 ++++++---
arch/powerpc/platforms/powernv/opal.c | 2 +-
2 files changed, 7 insertions(+), 4 deletions(-)
@@ -767,8 +767,10 @@ int machine_check_generic(struct pt_regs *regs)voidmachine_check_exception(structpt_regs*regs){-enumctx_stateprev_state=exception_enter();intrecover=0;+boolnested=in_nmi();+if(!nested)+nmi_enter();__this_cpu_inc(irq_stat.mce_exceptions);
@@ -798,10 +800,11 @@ void machine_check_exception(struct pt_regs *regs)/* Must die if the interrupt is not recoverable */if(!(regs->msr&MSR_RI))-panic("Unrecoverable Machine check");+nmi_panic("Unrecoverable Machine check");bail:-exception_exit(prev_state);+if(!nested)+nmi_exit();}voidSMIException(structpt_regs*regs)
@@ -449,7 +449,7 @@ int opal_machine_check(struct pt_regs *regs)pnv_platform_error="Unrecoverable Machine Check exception";-panic("Unrecoverable Machine Check exception");+nmi_panic("Unrecoverable Machine Check exception");}/* Early hmi handler called in real mode. */
From: Nicholas Piggin <npiggin@gmail.com> Date: 2017-07-05 04:23:57
On Wed, 5 Jul 2017 14:04:19 +1000
Nicholas Piggin [off-list ref] wrote:
Unrecovered MCE and HMI errors are sent through a special restart
OPAL call to log the platform error. The downside is that they don't
go through normal crash paths, so they don't give much information
to the Linux console.
Change this by allowing them to set an error which then causes the
normal restart handler to use the platform error call. Have MCE and HMI
handlers set this and then use the normal panic path for unrecoverable
cases.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
This patch is a bit clunky, setting this global variable. But it's
difficult to get this through the normal crash/panic paths by any
other way that I've found.
A concern is that we would like to add the opal log as early as
possible, but also print some information to the Linux console. This
goes against a competing concern that the more we do before logging
and xstop, the larger window something might go wrong.
So I would like to be able to cause opal to log a platform error
ASAP in the machine check handler, but then do some Linux crash
dumping before xstopping. That would require a new opal logging API
or convention though. So maybe this is an improvement (which also
allows patch 2 to be implemented more easily).
Anyway, discussion and criticism welcome.
Thanks,
Nick
From: Nicholas Piggin <npiggin@gmail.com> Date: 2017-07-06 17:56:11
On Wed, 5 Jul 2017 14:04:19 +1000
Nicholas Piggin [off-list ref] wrote:
Unrecovered MCE and HMI errors are sent through a special restart
OPAL call to log the platform error. The downside is that they don't
go through normal crash paths, so they don't give much information
to the Linux console.
Change this by allowing them to set an error which then causes the
normal restart handler to use the platform error call. Have MCE and HMI
handlers set this and then use the normal panic path for unrecoverable
cases.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Mahesh brought up a couple of good points about this offline.
Firstly that some HMI erorrs will stop the TB, second that if
crash dumps are registered then we will not get to the platform
reboot code from panic.
So it was a nice idea, but it seems to be just a bit too hard to
do exactly what we want in the panic path. So the other option is
put some of the printk and console flushing into the opal platform
error handler.
It's not really ideal to duplicate this code here... but it's better
than not printing anything.
Patch 2 won't be able to just call die() for kernel context now, but
it will have to check in_interrupt(), panic_on_oops, etc. to make
sure die() doesn't panic. But that should be okay.
This is what I have. If there are no great objections I'll repost
a v2 series with this.
---
@@ -267,8 +269,6 @@ static void hmi_event_handler(struct work_struct *work)spin_unlock_irqrestore(&opal_hmi_evt_lock,flags);if(unrecoverable){-intret;-/* Pull all HMI events from OPAL before we panic. */while(opal_get_msg(__pa(&msg),sizeof(msg))==OPAL_SUCCESS){u32type;
@@ -284,23 +284,7 @@ static void hmi_event_handler(struct work_struct *work)print_hmi_event_info(hmi_evt);}-/*-*UnrecoverableHMIexception.WeneedtoinformBMC/OCC-*aboutthiserrorsothatitcancollectrelevantdata-*forerroranalysisbeforerebooting.-*/-ret=opal_cec_reboot2(OPAL_REBOOT_PLATFORM_ERROR,-"Unrecoverable HMI exception");-if(ret==OPAL_UNSUPPORTED){-pr_emerg("Reboot type %d not supported\n",-OPAL_REBOOT_PLATFORM_ERROR);-}--/*-*Fallthroughandpanicifopal_cec_reboot2()returns-*OPAL_UNSUPPORTED.-*/-panic("Unrecoverable HMI exception");+pnv_platform_error_reboot(NULL,"Unrecoverable HMI exception");}}
@@ -421,10 +425,57 @@ static int opal_recover_mce(struct pt_regs *regs,returnrecovered;}+voidpnv_platform_error_reboot(structpt_regs*regs,constchar*msg)+{+/*+*Thisismostlytakenfromkernel/panic.c,buttriestodo+*relativelyminimalwork.Don'tusedelayfunctions(TBmay+*bebroken),don'tcrashdump(needtosetafirmwarelog),+*don'trunnotifiers.Wedowanttogetsomeinformationto+*Linuxconsole.+*/+smp_send_stop();++console_verbose();+bust_spinlocks(1);+pr_emerg("Hardware platform error: %s\n",msg);+if(regs)+show_regs(regs);+printk_safe_flush_on_panic();+kmsg_dump(KMSG_DUMP_PANIC);+bust_spinlocks(0);+debug_locks_off();+console_flush_on_panic();++/*+*Don'tbothertoshutthingsdownbecausethiswill+*xstopthesystem.+*/+if(opal_cec_reboot2(OPAL_REBOOT_PLATFORM_ERROR,msg)+==OPAL_UNSUPPORTED){+pr_emerg("Reboot type %d not supported for %s\n",+OPAL_REBOOT_PLATFORM_ERROR,msg);+}++/*+*Wereachedhere.Therecanbethreepossibilities:+*1.Wearerunningonafirmwarelevelthatdonotsupport+*opal_cec_reboot2()+*2.Wearerunningonafirmwarelevelthatdonotsupport+*OPAL_REBOOT_PLATFORM_ERRORreboottype.+*3.WearerunningonFSPbasedsystemthatdoesnotneed+*opaltotriggercheckstopexplicitlyforerroranalysis.+*TheFSPPRDcomponentwouldhavealreadygotnotified+*aboutthiserrorthroughotherchannels.+*/++for(;;)+;+}+intopal_machine_check(structpt_regs*regs){structmachine_check_eventevt;-intret;if(!get_mce_event(&evt,MCE_EVENT_RELEASE))return0;
@@ -440,43 +491,7 @@ int opal_machine_check(struct pt_regs *regs)if(opal_recover_mce(regs,&evt))return1;-/*-*Unrecoveredmachinecheck,weareheadingtopanicpath.-*-*WemayhavehitthisMCEinveryearlystageofkernel-*initializationevenbeforeopal-prdhasstartedrunning.If-*thisisthecasethenthisMCEerrormaygoun-noticedor-*un-analyzedifwegodownpanicpath.Weneedtoinform-*BMC/OCCaboutthiserrorsothattheycancollectrelevant-*dataforerroranalysisbeforerebooting.-*Useopal_cec_reboot2(OPAL_REBOOT_PLATFORM_ERROR)todoso.-*ThisfunctionmaynotreturnonBMCbasedsystem.-*/-ret=opal_cec_reboot2(OPAL_REBOOT_PLATFORM_ERROR,-"Unrecoverable Machine Check exception");-if(ret==OPAL_UNSUPPORTED){-pr_emerg("Reboot type %d not supported\n",-OPAL_REBOOT_PLATFORM_ERROR);-}--/*-*Wereachedhere.Therecanbethreepossibilities:-*1.Wearerunningonafirmwarelevelthatdonotsupport-*opal_cec_reboot2()-*2.Wearerunningonafirmwarelevelthatdonotsupport-*OPAL_REBOOT_PLATFORM_ERRORreboottype.-*3.WearerunningonFSPbasedsystemthatdoesnotneedopal-*totriggercheckstopexplicitlyforerroranalysis.TheFSP-*PRDcomponentwouldhavealreadygotnotifiedaboutthis-*errorthroughotherchannels.-*-*IfhardwaremarkedthisasanunrecoverableMCE,weare-*goingtopanicanyway.Evenifitdidn't,it'snotsafeto-*continueatthispoint,soweshouldexplicitlypanic.-*/--panic("PowerNV Unrecovered Machine Check");-return0;+pnv_platform_error_reboot(regs,"Unrecoverable Machine Check exception");}/* Early hmi handler called in real mode. */
arch/powerpc/kernel/traps.c:788:13: error: passing argument 1 of 'nmi_panic' from incompatible pointer type [-Werror=incompatible-pointer-types]
nmi_panic("Unrecoverable Machine check");
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from include/asm-generic/bug.h:15:0,
from arch/powerpc/include/asm/bug.h:127,
from include/linux/bug.h:4,
from arch/powerpc/include/asm/mmu.h:125,
from arch/powerpc/include/asm/lppaca.h:36,
from arch/powerpc/include/asm/paca.h:21,
from arch/powerpc/include/asm/current.h:16,
from include/linux/sched.h:11,
from arch/powerpc/kernel/traps.c:19:
include/linux/kernel.h:271:6: note: expected 'struct pt_regs *' but argument is of type 'char *'
void nmi_panic(struct pt_regs *regs, const char *msg);
^~~~~~~~~
quoted
arch/powerpc/kernel/traps.c:788:3: error: too few arguments to function 'nmi_panic'
nmi_panic("Unrecoverable Machine check");
^~~~~~~~~
In file included from include/asm-generic/bug.h:15:0,
from arch/powerpc/include/asm/bug.h:127,
from include/linux/bug.h:4,
from arch/powerpc/include/asm/mmu.h:125,
from arch/powerpc/include/asm/lppaca.h:36,
from arch/powerpc/include/asm/paca.h:21,
from arch/powerpc/include/asm/current.h:16,
from include/linux/sched.h:11,
from arch/powerpc/kernel/traps.c:19:
include/linux/kernel.h:271:6: note: declared here
void nmi_panic(struct pt_regs *regs, const char *msg);
^~~~~~~~~
cc1: all warnings being treated as errors
--
arch/powerpc/platforms/powernv/opal.c: In function 'opal_machine_check':
quoted
arch/powerpc/platforms/powernv/opal.c:452:12: error: passing argument 1 of 'nmi_panic' from incompatible pointer type [-Werror=incompatible-pointer-types]
nmi_panic("Unrecoverable Machine Check exception");
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from include/linux/list.h:8:0,
from include/linux/kobject.h:20,
from include/linux/of.h:21,
from arch/powerpc/platforms/powernv/opal.c:16:
include/linux/kernel.h:271:6: note: expected 'struct pt_regs *' but argument is of type 'char *'
void nmi_panic(struct pt_regs *regs, const char *msg);
^~~~~~~~~
quoted
arch/powerpc/platforms/powernv/opal.c:452:2: error: too few arguments to function 'nmi_panic'
nmi_panic("Unrecoverable Machine Check exception");
^~~~~~~~~
In file included from include/linux/list.h:8:0,
from include/linux/kobject.h:20,
from include/linux/of.h:21,
from arch/powerpc/platforms/powernv/opal.c:16:
include/linux/kernel.h:271:6: note: declared here
void nmi_panic(struct pt_regs *regs, const char *msg);
^~~~~~~~~
arch/powerpc/platforms/powernv/opal.c:453:1: error: control reaches end of non-void function [-Werror=return-type]
}
^
cc1: all warnings being treated as errors
vim +/nmi_panic +788 arch/powerpc/kernel/traps.c
782 goto bail;
783
784 die("Machine check", regs, SIGBUS);
785
786 /* Must die if the interrupt is not recoverable */
787 if (!(regs->msr & MSR_RI))
> 788 nmi_panic("Unrecoverable Machine check");
789
790 bail:
791 if (!nested)
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
On Wed, 5 Jul 2017 14:04:19 +1000
Nicholas Piggin [off-list ref] wrote:
quoted
Unrecovered MCE and HMI errors are sent through a special restart
OPAL call to log the platform error. The downside is that they don't
go through normal crash paths, so they don't give much information
to the Linux console.
Change this by allowing them to set an error which then causes the
normal restart handler to use the platform error call. Have MCE and HMI
handlers set this and then use the normal panic path for unrecoverable
cases.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Mahesh brought up a couple of good points about this offline.
Firstly that some HMI erorrs will stop the TB, second that if
crash dumps are registered then we will not get to the platform
reboot code from panic.
So it was a nice idea, but it seems to be just a bit too hard to
do exactly what we want in the panic path. So the other option is
put some of the printk and console flushing into the opal platform
error handler.
It's not really ideal to duplicate this code here... but it's better
than not printing anything.
Patch 2 won't be able to just call die() for kernel context now, but
it will have to check in_interrupt(), panic_on_oops, etc. to make
sure die() doesn't panic. But that should be okay.
This is what I have. If there are no great objections I'll repost
a v2 series with this.
Looks good to me. Just one minor suggestion/comment below.
@@ -267,8 +269,6 @@ static void hmi_event_handler(struct work_struct *work)spin_unlock_irqrestore(&opal_hmi_evt_lock,flags);if(unrecoverable){-intret;-/* Pull all HMI events from OPAL before we panic. */while(opal_get_msg(__pa(&msg),sizeof(msg))==OPAL_SUCCESS){u32type;
@@ -284,23 +284,7 @@ static void hmi_event_handler(struct work_struct *work)print_hmi_event_info(hmi_evt);}-/*-*UnrecoverableHMIexception.WeneedtoinformBMC/OCC-*aboutthiserrorsothatitcancollectrelevantdata-*forerroranalysisbeforerebooting.-*/-ret=opal_cec_reboot2(OPAL_REBOOT_PLATFORM_ERROR,-"Unrecoverable HMI exception");-if(ret==OPAL_UNSUPPORTED){-pr_emerg("Reboot type %d not supported\n",-OPAL_REBOOT_PLATFORM_ERROR);-}--/*-*Fallthroughandpanicifopal_cec_reboot2()returns-*OPAL_UNSUPPORTED.-*/-panic("Unrecoverable HMI exception");+pnv_platform_error_reboot(NULL,"Unrecoverable HMI exception");}}
@@ -421,10 +425,57 @@ static int opal_recover_mce(struct pt_regs *regs,returnrecovered;}+voidpnv_platform_error_reboot(structpt_regs*regs,constchar*msg)+{+/*+*Thisismostlytakenfromkernel/panic.c,buttriestodo+*relativelyminimalwork.Don'tusedelayfunctions(TBmay+*bebroken),don'tcrashdump(needtosetafirmwarelog),+*don'trunnotifiers.Wedowanttogetsomeinformationto+*Linuxconsole.+*/+smp_send_stop();++console_verbose();+bust_spinlocks(1);+pr_emerg("Hardware platform error: %s\n",msg);+if(regs)+show_regs(regs);+printk_safe_flush_on_panic();+kmsg_dump(KMSG_DUMP_PANIC);+bust_spinlocks(0);+debug_locks_off();+console_flush_on_panic();++/*+*Don'tbothertoshutthingsdownbecausethiswill+*xstopthesystem.+*/+if(opal_cec_reboot2(OPAL_REBOOT_PLATFORM_ERROR,msg)+==OPAL_UNSUPPORTED){+pr_emerg("Reboot type %d not supported for %s\n",+OPAL_REBOOT_PLATFORM_ERROR,msg);+}++/*+*Wereachedhere.Therecanbethreepossibilities:+*1.Wearerunningonafirmwarelevelthatdonotsupport+*opal_cec_reboot2()+*2.Wearerunningonafirmwarelevelthatdonotsupport+*OPAL_REBOOT_PLATFORM_ERRORreboottype.+*3.WearerunningonFSPbasedsystemthatdoesnotneed+*opaltotriggercheckstopexplicitlyforerroranalysis.+*TheFSPPRDcomponentwouldhavealreadygotnotified+*aboutthiserrorthroughotherchannels.+*/+
Not sure if looping forever unconditionally here is better idea. How
about we check panic_timeout and decide whether to reboot or fall
through for loop ?
if (panic_timeout != 0)
emergency_restart();
On Wed, 5 Jul 2017 14:04:19 +1000
Nicholas Piggin [off-list ref] wrote:
quoted
+ /*
+ * We reached here. There can be three possibilities:
+ * 1. We are running on a firmware level that do not support
+ * opal_cec_reboot2()
+ * 2. We are running on a firmware level that do not support
+ * OPAL_REBOOT_PLATFORM_ERROR reboot type.
+ * 3. We are running on FSP based system that does not need
+ * opal to trigger checkstop explicitly for error analysis.
+ * The FSP PRD component would have already got notified
+ * about this error through other channels.
+ */
+
Not sure if looping forever unconditionally here is better idea. How
about we check panic_timeout and decide whether to reboot or fall
through for loop ?
if (panic_timeout != 0)
emergency_restart();
quoted
+ for (;;)
+ ;> +}
Yes that's a good point. What I've done is just to call ppc_md.restart().
To match BMC behaviour, particularly for point #3, I think we expect a
restart here. MCE is not quite the same thing as panic, so I think that's
okay to ignore the panic timeout.
The important thing is the MCE messages will have been sent to Linux
console.
Thanks,
Nick