[PATCH v4 13/27] x86,tracing: Add comments to do_nmi()

From: Peter Zijlstra
Date: Fri Feb 21 2020 - 08:51:16 EST


Add a few comments to do_nmi() as a result of the audit.

Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Reviewed-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>
---
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