i386: fix one case of stuck dwarf2 unwinder II
In-Reply-To: <[email protected]>
Quoted 11 lines · Andi Kleen
Quoted 7 lines
And the backtraces I saw ended up at L6:
| DWARF2 unwinder stuck at
0xc0100210System.map on i386 SMP says:
|
c0100210t L6Yes that's the problem. If you check for <= stext/_stext then the unwinder won't catch the L6 (which is above it) and report a "stuck" again
Maybe I'm being dense here, but:
c0100210 t L6c0100212 t check_x87c010023a t setup_idtc0100257 t rp_sidtc0100264 t ignore_intc0100298 T stextc0100298 T _stext
It looks like L6 is before _stext to me.
Signature · 1 line
Chuck
Quoted 13 lines
Quoted 2 lines
Yes that's the problem. If you check for <= stext/_stext then the unwinder won't catch the L6 (which is above it) and report a "stuck" again
Maybe I'm being dense here, but:
c0100210t L6c0100212tcheck_x87c010023atsetup_idtc0100257trp_sidtc0100264tignore_intc0100298T stextc0100298T_stext
Quoted 1 line
It looks like L6 is before
_stextto me.
So it would seem to me. Nevertheless, in my opinion the proper fix is to annotate the call site (in head.S) to specify a zero EIP as return address (which denotes the bottom of a frame).
Jan
Quoted 13 lines · Jan Beulich
Quoted 13 lines
Quoted 2 lines
Yes that's the problem. If you check for <= stext/_stext then the unwinder won't catch the L6 (which is above it) and report a "stuck" again
Maybe I'm being dense here, but:
c0100210t L6c0100212tcheck_x87c010023atsetup_idtc0100257trp_sidtc0100264tignore_intc0100298T stextc0100298T_stext
Quoted 4 lines
Quoted 1 line
It looks like L6 is before
_stextto me.So it would seem to me. Nevertheless, in my opinion the proper fix is to annotate the call site (in
head.S) to specify a zero EIP as return address (which denotes the bottom of a frame).
Can you please send a patch to do that?
That seems to be missing in some other places too, e.g. i386 sysenter path, x86-64 kernel_thread, more?
-Andi
Quoted 1 line
Quoted 1 line
So it would seem to me. Nevertheless, in my opinion the proper fix is
to annotate the call site
Quoted 1 line
Quoted 1 line
(in
head.S) to specify a zero EIP as return address (which denotes
the bottom of a frame).
Quoted 4 lines
Can you please send a patch to do that?
That seems to be missing in some other places too, e.g. i386 sysenter
path, x86-64 kernel_thread,
Quoted 1 line
more?
Attaching both an i386 version (boot/idle thread only, you did kernel_thread already)
and an x86-64 one (boot/idle and kernel_thread). The i386 sysenter path is a different
thing, there we have an actual caller (though outside of the kernel), which I'd like to
continue to reflect/catch through arch_unw_user_mode().
Jan
Add kernel thread stack frame termination for properly stopping stack unwinds.
One open question: Should these added pushes perhaps be made conditional upon CONFIG_STACK_UNWIND or CONFIG_UNWIND_INFO?
arch/x86_64/kernel/entry.S +3 -0
@@ -973,6 +973,8 @@ ENTRY(kernel_thread) ENDPROC(kernel_thread) child_rip: + pushq $0 # fake return address + CFI_STARTPROC /* * Here we are in the child and the registers are set as they were * at kernel_thread() invocation in the parent.
@@ -983,6 +985,7 @@ child_rip: # exit xorl %edi, %edi call do_exit + CFI_ENDPROC ENDPROC(child_rip) /*
arch/x86_64/kernel/head.S +1 -0
@@ -191,6 +191,7 @@ startup_64: * jump */ movq initial_code(%rip),%rax + pushq $0 # fake return address jmp *%rax /* SMP bootup changes these two */
Add boot/idle kernel thread stack frame termination for properly stopping stack unwinds.
One open question: Should this added push perhaps be made conditional upon CONFIG_STACK_UNWIND or CONFIG_UNWIND_INFO?
arch/i386/kernel/head.S +4 -10
@@ -317,20 +317,14 @@ is386: movl $2,%ecx # set MP movl %eax,%gs lldt %ax cld # gcc2 wants the direction flag cleared at all times + pushl %eax # fake return address #ifdef CONFIG_SMP movb ready, %cl movb $1, ready - cmpb $0,%cl - je 1f # the first CPU calls start_kernel - # all other CPUs call initialize_secondary - call initialize_secondary - jmp L6 -1: + cmpb $0,%cl # the first CPU calls start_kernel + jne initialize_secondary # all other CPUs call initialize_secondary #endif /* CONFIG_SMP */ - call start_kernel -L6: - jmp L6 # main should never return here, but - # just in case, we know what happens. + jmp start_kernel /* * We depend on ET to be correct. This checks for 287/387.
Quoted 8 lines · On Tue, 15 Aug 2006 12:33:59 +0200 "Jan Beulich" <[email protected]> wrote:
Quoted 1 line
Quoted 1 line
So it would seem to me. Nevertheless, in my opinion the proper fix is
to annotate the call site
Quoted 1 line
Quoted 1 line
(in
head.S) to specify a zero EIP as return address (which denotesthe bottom of a frame).
Quoted 4 lines
Can you please send a patch to do that?
That seems to be missing in some other places too, e.g. i386 sysenter
Quoted 8 lines
path, x86-64
kernel_thread,Quoted 1 line
more?
Attaching both an i386 version (boot/idle thread only, you did
kernel_threadalready)
and an x86-64 one (boot/idle andkernel_thread). The i386 sysenter path is a different
thing,
Ok added thanks.
Re One open question: Should this added push perhaps be made conditional upon CONFIG_STACK_UNWIND or CONFIG_UNWIND_INFO?
I don't think that's needed because they are all slow paths.
there we have an actual caller (though outside of the kernel),
Quoted 2 lines
which I'd like to
continue to reflect/catch througharch_unw_user_mode().
Ok, but does it work now? I thought it didn't.
I've also seen a stuck on the x86-64 sysenter path on x86-64.
-Andi
Quoted 5 lines
Quoted 2 lines
which I'd like to
continue to reflect/catch througharch_unw_user_mode().Ok, but does it work now? I thought it didn't.
I've also seen a stuck on the x86-64 sysenter path on x86-64.
That's the next thing for me to look into.
Jan