[PATCH] x86_64: Fix backtracing for interrupt stacks

Re-add backlink for old style unwinder to stack switching. Add proper
stack frame and CFI annotations to call_softirq

This prevents a oops when backtracing with fallback through the
interrupt stack top.

Suggested by Jan Beulich and Herbert Xu wanted it in 2.6.18.

Cc: jbeulich@novell.com
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by Andi Kleen and committed by Linus Torvalds 2699500b ae74c3b6

+11 -7
+11 -7
arch/x86_64/kernel/entry.S
··· 513 swapgs 514 1: incl %gs:pda_irqcount # RED-PEN should check preempt count 515 cmoveq %gs:pda_irqstackptr,%rsp 516 /* 517 * We entered an interrupt context - irqs are off: 518 */ ··· 1140 END(machine_check) 1141 #endif 1142 1143 ENTRY(call_softirq) 1144 CFI_STARTPROC 1145 - movq %gs:pda_irqstackptr,%rax 1146 - movq %rsp,%rdx 1147 - CFI_DEF_CFA_REGISTER rdx 1148 incl %gs:pda_irqcount 1149 - cmove %rax,%rsp 1150 - pushq %rdx 1151 - /*todo CFI_DEF_CFA_EXPRESSION ...*/ 1152 call __do_softirq 1153 - popq %rsp 1154 CFI_DEF_CFA_REGISTER rsp 1155 decl %gs:pda_irqcount 1156 ret 1157 CFI_ENDPROC
··· 513 swapgs 514 1: incl %gs:pda_irqcount # RED-PEN should check preempt count 515 cmoveq %gs:pda_irqstackptr,%rsp 516 + push %rbp # backlink for old unwinder 517 /* 518 * We entered an interrupt context - irqs are off: 519 */ ··· 1139 END(machine_check) 1140 #endif 1141 1142 + /* Call softirq on interrupt stack. Interrupts are off. */ 1143 ENTRY(call_softirq) 1144 CFI_STARTPROC 1145 + push %rbp 1146 + CFI_ADJUST_CFA_OFFSET 8 1147 + CFI_REL_OFFSET rbp,0 1148 + mov %rsp,%rbp 1149 + CFI_DEF_CFA_REGISTER rbp 1150 incl %gs:pda_irqcount 1151 + cmove %gs:pda_irqstackptr,%rsp 1152 + push %rbp # backlink for old unwinder 1153 call __do_softirq 1154 + leaveq 1155 CFI_DEF_CFA_REGISTER rsp 1156 + CFI_ADJUST_CFA_OFFSET -8 1157 decl %gs:pda_irqcount 1158 ret 1159 CFI_ENDPROC