From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Zijlstra Subject: [PATCH v2 5/9] x86,tracing: Add comments to do_nmi() Date: Wed, 12 Feb 2020 22:01:44 +0100 Message-ID: <20200212210750.084959585@infradead.org> References: <20200212210139.382424693@infradead.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from merlin.infradead.org ([205.233.59.134]:33530 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729107AbgBLVOT (ORCPT ); Wed, 12 Feb 2020 16:14:19 -0500 Sender: linux-arch-owner@vger.kernel.org List-ID: To: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, rostedt@goodmis.org Cc: peterz@infradead.org, mingo@kernel.org, joel@joelfernandes.org, gregkh@linuxfoundation.org, gustavo@embeddedor.com, tglx@linutronix.de, paulmck@kernel.org, josh@joshtriplett.org, mathieu.desnoyers@efficios.com, jiangshanlai@gmail.com Add a few comments to do_nmi() as a result of the audit. Signed-off-by: Peter Zijlstra (Intel) --- arch/x86/kernel/nmi.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) --- a/arch/x86/kernel/nmi.c +++ b/arch/x86/kernel/nmi.c @@ -529,11 +529,14 @@ do_nmi(struct pt_regs *regs, long error_ * continue to use the NMI stack. */ if (unlikely(is_debug_stack(regs->sp))) { - debug_stack_set_zero(); + debug_stack_set_zero(); /* notrace due to Makefile */ this_cpu_write(update_debug_stack, 1); } #endif + /* + * It is important that no tracing happens before nmi_enter()! + */ nmi_enter(); inc_irq_stat(__nmi_count); @@ -542,10 +545,13 @@ do_nmi(struct pt_regs *regs, long error_ default_do_nmi(regs); nmi_exit(); + /* + * No tracing after nmi_exit()! + */ #ifdef CONFIG_X86_64 if (unlikely(this_cpu_read(update_debug_stack))) { - debug_stack_reset(); + debug_stack_reset(); /* notrace due to Makefile */ this_cpu_write(update_debug_stack, 0); } #endif