i386: annotate the rest of entry.s::nmi
PATCH 1/1 i386: annotate the rest of entry.s::nmi
Part of the NMI handler is missing annotations. Just moving the RING0_INT_FRAME macro fixes it. And additional comments should warn anyone changing this to recheck the annotations.
arch/i386/kernel/entry.S +8 -2
@@ -750,6 +750,7 @@ ENTRY(nmi) cmpl $sysenter_entry,12(%esp) je nmi_debug_stack_check nmi_stack_correct: + /* We have a RING0_INT_FRAME here */ pushl %eax CFI_ADJUST_CFA_OFFSET 4 SAVE_ALL
@@ -760,9 +761,12 @@ nmi_stack_correct: CFI_ENDPROC nmi_stack_fixup: + RING0_INT_FRAME FIX_STACK(12,nmi_stack_correct, 1) jmp nmi_stack_correct + nmi_debug_stack_check: + /* We have a RING0_INT_FRAME here */ cmpw $__KERNEL_CS,16(%esp) jne nmi_stack_correct cmpl $debug,(%esp)
@@ -773,8 +777,10 @@ nmi_debug_stack_check: jmp nmi_stack_correct nmi_16bit_stack: - RING0_INT_FRAME - /* create the pointer to lss back */ + /* We have a RING0_INT_FRAME here. + * + * create the pointer to lss back + */ pushl %ss CFI_ADJUST_CFA_OFFSET 4 pushl %esp
Signature · 1 line
Chuck
Quoted 3 lines · Chuck Ebbert
Part of the NMI handler is missing annotations. Just moving the
RING0_INT_FRAMEmacro fixes it. And additional comments should warn anyone changing this to recheck the annotations.
Added thanks.
-Andi
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Chuck Ebbert <[email protected]> 10.08.06 06:59 >>>
Part of the NMI handler is missing annotations. Just moving the
RING0_INT_FRAMEmacro fixes it. And additional comments should warn anyone changing this to recheck the annotations.
I have to admit that I can't see the value of this movement; the code sequence in question was left un-annotated intentionally. The point is that the push-es in FIX_STACK() aren't annotated, so things won't be correct at those points anyway. Furthermore, getting interrupted in any way while in this code path is going to kill the system (and is just impossible AFAICT), so annotations there also seem worthless. (I am actually surprised that I annotated the code after nmi_16bit_stack, as that's similarly constrained; even more, as I'm now looking at it, this code seems outright wrong in using iret since that unmasks NMIs - Stas, is your pending adjustment to the 16-bit stack handling going to overcome this?)
The added comments certainly might be helpful, though there are more places where frame state gets "inherited" across labels.
Jan
Quoted 6 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Chuck Ebbert <[email protected]> 10.08.06 06:59 >>>
Part of the NMI handler is missing annotations. Just moving the
RING0_INT_FRAMEmacro fixes it. And additional comments should warn anyone changing this to recheck the annotations.I have to admit that I can't see the value of this movement;
Should I drop it again?
-Andi
Quoted 10 lines
Quoted 1 line
Quoted 1 line
Andi Kleen <[email protected]> 10.08.06 10:26 >>>
Quoted 6 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Chuck Ebbert <[email protected]> 10.08.06 06:59 >>>
Part of the NMI handler is missing annotations. Just moving the
RING0_INT_FRAMEmacro fixes it. And additional comments should warn anyone changing this to recheck the annotations.I have to admit that I can't see the value of this movement;
Should I drop it again?
I would suggest so, but would also want to wait for Chuck to perhaps provide some background on why he felt these annotations were useful.
Jan
Hello.
Quoted 4 lines · Jan Beulich
even more, as I'm now looking at it, this code seems outright wrong in using iret since that unmasks NMIs - Stas, is your pending adjustment to the 16-bit stack handling going to overcome this?)
No, it leaves the NMI path almost untouched. But what exactly problem do you see with this iret? If it unmasks NMI, then it does so for reason, which is a return from an NMI handler. What exactly is wrong with it?
Quoted 9 lines
Quoted 4 lines
even more, as I'm now looking at it, this code seems outright wrong in using iret since that unmasks NMIs - Stas, is your pending adjustment to the 16-bit stack handling going to overcome this?)
No, it leaves the NMI path almost untouched. But what exactly problem do you see with this iret? If it unmasks NMI, then it does so for reason, which is a return from an NMI handler. What exactly is wrong with it?
Oh, yes, you're right, I didn't pay attention to the second do_nmi call in that path.
Sorry, Jan