reliable stack trace support (x86-64 IRQ stack adjustment)
PATCH 3/6 reliable stack trace support (x86-64 IRQ stack adjustment)
Change the switching to/from the IRQ stack so that unwind annotations can be added for it without requiring CFA expressions.
Signed-off-by Jan Beulich <[email protected]>
arch/x86_64/kernel/entry.S +21 -9
@@ -483,16 +483,21 @@ ENTRY(stub_rt_sigreturn) #else SAVE_ARGS leaq -ARGOFFSET(%rsp),%rdi # arg1 for handler -#endif +#ifdef CONFIG_UNWIND_INFO + pushq %rbp + CFI_ADJUST_CFA_OFFSET 8 + CFI_REL_OFFSET rbp, 0 + movq %rsp,%rbp + CFI_DEF_CFA_REGISTER rbp +#endif +#endif testl $3,CS(%rdi) je 1f swapgs 1: incl %gs:pda_irqcount # RED-PEN should check preempt count - movq %gs:pda_irqstackptr,%rax - cmoveq %rax,%rsp /*todo This needs CFI annotation! */ + cmoveq %gs:pda_irqstackptr,%rsp +#if !defined(CONFIG_DEBUG_INFO) && !defined(CONFIG_UNWIND_INFO) pushq %rdi # save old stack -#ifndef CONFIG_DEBUG_INFO - CFI_ADJUST_CFA_OFFSET 8 #endif call \func .endm
@@ -502,17 +507,24 @@ ENTRY(common_interrupt) interrupt do_IRQ /* 0(%rsp): oldrsp-ARGOFFSET */ ret_from_intr: +#if !defined(CONFIG_DEBUG_INFO) && !defined(CONFIG_UNWIND_INFO) popq %rdi -#ifndef CONFIG_DEBUG_INFO - CFI_ADJUST_CFA_OFFSET -8 #endif cli decl %gs:pda_irqcount #ifdef CONFIG_DEBUG_INFO - movq RBP(%rdi),%rbp + movq %rbp, %rsp CFI_DEF_CFA_REGISTER rsp + movq RBP(%rsp),%rbp + addq $ARG_OFFSET, %rsp + CFI_ADJUST_CFA_OFFSET -ARG_OFFSET +#elif defined(CONFIG_UNWIND_INFO) + leaveq + CFI_DEF_CFA_REGISTER rsp + CFI_ADJUST_CFA_OFFSET -8 +#else + leaq ARGOFFSET(%rdi),%rsp #endif - leaq ARGOFFSET(%rdi),%rsp /*todo This needs CFI annotation! */ exit_intr: GET_THREAD_INFO(%rcx) testl $3,CS-ARGOFFSET(%rsp)
arch/x86_64/kernel/entry.S ENTRY(stub_rt_sigreturn) · line 494
Quoted 8 lines
1: incl %gs:pda_irqcount # RED-PEN should check preempt count
arch/x86_64/kernel/entry.S +2
-3- movq %gs:pda_irqstackptr,%rax - cmoveq %rax,%rsp /*todo This needs CFI annotation! */ + cmoveq %gs:pda_irqstackptr,%rsp +#if !defined(CONFIG_DEBUG_INFO) && !defined(CONFIG_UNWIND_INFO) pushq %rdi # save old stack -#ifndef CONFIG_DEBUG_INFO
The tests for DEBUG_INFO are obsolete here. It should only test for UNWIND_INFO. I'll fix that up.
-Andi