Commit 8d0e2101 authored by Ganesh Goudar's avatar Ganesh Goudar Committed by Michael Ellerman

powerpc/mce: Avoid nmi_enter/exit in real mode on pseries hash

Use of nmi_enter/exit in real mode handler causes the kernel to panic
and reboot on injecting SLB mutihit on pseries machine running in hash
MMU mode, because these calls try to accesses memory outside RMO
region in real mode handler where translation is disabled.

Add check to not to use these calls on pseries machine running in hash
MMU mode.

Fixes: 116ac378 ("powerpc/64s: machine check interrupt update NMI accounting")
Cc: stable@vger.kernel.org # v5.8+
Signed-off-by: default avatarGanesh Goudar <ganeshgr@linux.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20201009064005.19777-2-ganeshgr@linux.ibm.com
parent d4263b12
...@@ -591,12 +591,11 @@ EXPORT_SYMBOL_GPL(machine_check_print_event_info); ...@@ -591,12 +591,11 @@ EXPORT_SYMBOL_GPL(machine_check_print_event_info);
long notrace machine_check_early(struct pt_regs *regs) long notrace machine_check_early(struct pt_regs *regs)
{ {
long handled = 0; long handled = 0;
bool nested = in_nmi();
u8 ftrace_enabled = this_cpu_get_ftrace_enabled(); u8 ftrace_enabled = this_cpu_get_ftrace_enabled();
this_cpu_set_ftrace_enabled(0); this_cpu_set_ftrace_enabled(0);
/* Do not use nmi_enter/exit for pseries hpte guest */
if (!nested) if (radix_enabled() || !firmware_has_feature(FW_FEATURE_LPAR))
nmi_enter(); nmi_enter();
hv_nmi_check_nonrecoverable(regs); hv_nmi_check_nonrecoverable(regs);
...@@ -607,7 +606,7 @@ long notrace machine_check_early(struct pt_regs *regs) ...@@ -607,7 +606,7 @@ long notrace machine_check_early(struct pt_regs *regs)
if (ppc_md.machine_check_early) if (ppc_md.machine_check_early)
handled = ppc_md.machine_check_early(regs); handled = ppc_md.machine_check_early(regs);
if (!nested) if (radix_enabled() || !firmware_has_feature(FW_FEATURE_LPAR))
nmi_exit(); nmi_exit();
this_cpu_set_ftrace_enabled(ftrace_enabled); this_cpu_set_ftrace_enabled(ftrace_enabled);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment