diff mbox series

[v3,13/15] powerpc/64s: machine check do not trace real-mode handler

Message ID 20200407051636.648369-14-npiggin@gmail.com (mailing list archive)
State Superseded
Headers show
Series powerpc/64: machine check and system reset fixes | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch powerpc/merge (2c0ce4ff35994a7b12cc9879ced52c9e7c2e6667)
snowpatch_ozlabs/checkpatch success total: 0 errors, 0 warnings, 0 checks, 30 lines checked
snowpatch_ozlabs/needsstable success Patch has no Fixes tags

Commit Message

Nicholas Piggin April 7, 2020, 5:16 a.m. UTC
Rather than notrace annotations throughout a significant part of the
machine check code across kernel/ pseries/ and powernv/ which can
easily be broken and is infrequently tested, use paca->ftrace_enabled
to blanket-disable tracing of the real-mode non-maskable handler.

Acked-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/kernel/mce.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Christophe Leroy April 7, 2020, 5:45 a.m. UTC | #1
Le 07/04/2020 à 07:16, Nicholas Piggin a écrit :
> Rather than notrace annotations throughout a significant part of the
> machine check code across kernel/ pseries/ and powernv/ which can
> easily be broken and is infrequently tested, use paca->ftrace_enabled
> to blanket-disable tracing of the real-mode non-maskable handler.
> 
> Acked-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>

Reviewed-by: Christophe Leroy <christophe.leroy@c-s.fr>

> ---
>   arch/powerpc/kernel/mce.c | 9 ++++++++-
>   1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/kernel/mce.c b/arch/powerpc/kernel/mce.c
> index be7e3f92a7b5..fd90c0eda229 100644
> --- a/arch/powerpc/kernel/mce.c
> +++ b/arch/powerpc/kernel/mce.c
> @@ -16,6 +16,7 @@
>   #include <linux/export.h>
>   #include <linux/irq_work.h>
>   #include <linux/extable.h>
> +#include <linux/ftrace.h>
>   
>   #include <asm/machdep.h>
>   #include <asm/mce.h>
> @@ -571,10 +572,14 @@ EXPORT_SYMBOL_GPL(machine_check_print_event_info);
>    *
>    * regs->nip and regs->msr contains srr0 and ssr1.
>    */
> -long machine_check_early(struct pt_regs *regs)
> +long notrace machine_check_early(struct pt_regs *regs)
>   {
>   	long handled = 0;
>   	bool nested = in_nmi();
> +	u8 ftrace_enabled = this_cpu_get_ftrace_enabled();
> +
> +	this_cpu_set_ftrace_enabled(0);
> +
>   	if (!nested)
>   		nmi_enter();
>   
> @@ -589,6 +594,8 @@ long machine_check_early(struct pt_regs *regs)
>   	if (!nested)
>   		nmi_exit();
>   
> +	this_cpu_set_ftrace_enabled(ftrace_enabled);
> +
>   	return handled;
>   }
>   
>
diff mbox series

Patch

diff --git a/arch/powerpc/kernel/mce.c b/arch/powerpc/kernel/mce.c
index be7e3f92a7b5..fd90c0eda229 100644
--- a/arch/powerpc/kernel/mce.c
+++ b/arch/powerpc/kernel/mce.c
@@ -16,6 +16,7 @@ 
 #include <linux/export.h>
 #include <linux/irq_work.h>
 #include <linux/extable.h>
+#include <linux/ftrace.h>
 
 #include <asm/machdep.h>
 #include <asm/mce.h>
@@ -571,10 +572,14 @@  EXPORT_SYMBOL_GPL(machine_check_print_event_info);
  *
  * regs->nip and regs->msr contains srr0 and ssr1.
  */
-long machine_check_early(struct pt_regs *regs)
+long notrace machine_check_early(struct pt_regs *regs)
 {
 	long handled = 0;
 	bool nested = in_nmi();
+	u8 ftrace_enabled = this_cpu_get_ftrace_enabled();
+
+	this_cpu_set_ftrace_enabled(0);
+
 	if (!nested)
 		nmi_enter();
 
@@ -589,6 +594,8 @@  long machine_check_early(struct pt_regs *regs)
 	if (!nested)
 		nmi_exit();
 
+	this_cpu_set_ftrace_enabled(ftrace_enabled);
+
 	return handled;
 }