Skip to content

Commit

Permalink
x86: Ignore NMIs that come in during early boot
Browse files Browse the repository at this point in the history
Don Zickus reports:

A customer generated an external NMI using their iLO to test kdump
worked.  Unfortunately, the machine hung.  Disabling the nmi_watchdog
made things work.

I speculated the external NMI fired, caused the machine to panic (as
expected) and the perf NMI from the watchdog came in and was latched.
My guess was this somehow caused the hang.

   ----

It appears that the latched NMI stays latched until the early page
table generation on 64 bits, which causes exceptions to happen which
end in IRET, which re-enable NMI.  Therefore, ignore NMIs that come in
during early execution, until we have proper exception handling.

Reported-and-tested-by: Don Zickus <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: H. Peter Anvin <[email protected]>
Cc: <[email protected]> # v3.5+, older with some backport effort
  • Loading branch information
H. Peter Anvin committed Mar 7, 2014
1 parent d4078e2 commit 5fa1019
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 6 additions & 1 deletion arch/x86/kernel/head_32.S
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,10 @@ ENDPROC(early_idt_handlers)
/* This is global to keep gas from relaxing the jumps */
ENTRY(early_idt_handler)
cld

cmpl $X86_TRAP_NMI,(%esp)
je is_nmi # Ignore NMI

cmpl $2,%ss:early_recursion_flag
je hlt_loop
incl %ss:early_recursion_flag
Expand Down Expand Up @@ -594,8 +598,9 @@ ex_entry:
pop %edx
pop %ecx
pop %eax
addl $8,%esp /* drop vector number and error code */
decl %ss:early_recursion_flag
is_nmi:
addl $8,%esp /* drop vector number and error code */
iret
ENDPROC(early_idt_handler)

Expand Down
6 changes: 5 additions & 1 deletion arch/x86/kernel/head_64.S
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,9 @@ early_idt_handlers:
ENTRY(early_idt_handler)
cld

cmpl $X86_TRAP_NMI,(%rsp)
je is_nmi # Ignore NMI

cmpl $2,early_recursion_flag(%rip)
jz 1f
incl early_recursion_flag(%rip)
Expand Down Expand Up @@ -405,8 +408,9 @@ ENTRY(early_idt_handler)
popq %rdx
popq %rcx
popq %rax
addq $16,%rsp # drop vector number and error code
decl early_recursion_flag(%rip)
is_nmi:
addq $16,%rsp # drop vector number and error code
INTERRUPT_RETURN
ENDPROC(early_idt_handler)

Expand Down

0 comments on commit 5fa1019

Please sign in to comment.