s390/dumpstack: fix call chain walking
authorHeiko Carstens <heiko.carstens@de.ibm.com>
Thu, 14 Mar 2013 12:44:25 +0000 (13:44 +0100)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Wed, 17 Apr 2013 12:07:28 +0000 (14:07 +0200)
commit1bca09f7144450989e409c82ff0db83dddf489ac
treeb09d99a3ae8d557b0ba50759814ee422e82788ab
parent2b55732ad23fcc9eaec05acc21fd579ef8a9f38b
s390/dumpstack: fix call chain walking

dumpstack() did not always print a sane callchain when being called.
The reason is that show_trace() accessed register 15 directly to get
the current stack pointer and passed that pointer to __show_trace()
which expects a valid stack frame pointer as argument.
However due to tail call optimization the stack frame may not exist
anymore when __show_trace() gets called and therefore an invalid
stack frame pointer gets passed.
To prevent that disable tail call optimization for call chain walking
functions.
So move all the show_* functions to a dumpstack.c file like other
architectures have it already and add a -fno-optimize-sibling-calls
compile flag to both dumpstack.c and stacktrace.c to prevent tail
call optimization.

Fixes callchains that looked e.g. like this:

[   12.868258] Call Trace:
[   12.868262] ([<0000000000008000>] 0x8000)

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/kernel/Makefile
arch/s390/kernel/dumpstack.c [new file with mode: 0644]
arch/s390/kernel/traps.c