linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC 0/5] kernel: backtrace unwind support
@ 2012-02-10 11:25 Jiri Olsa
  2012-02-10 11:25 ` [PATCH 1/5] unwind, kconfig: Adding UNWIND* options Jiri Olsa
                   ` (5 more replies)
  0 siblings, 6 replies; 19+ messages in thread
From: Jiri Olsa @ 2012-02-10 11:25 UTC (permalink / raw)
  To: acme, a.p.zijlstra, mingo, paulus, cjashfor, fweisbec; +Cc: linux-kernel

hi,
I was recently dealing with libunwind and wanted to try out
the dwarf backtrace unwind in kernel space.

The attached patchset implements dwarf backtrace unwind
based on the exception header frames (.eh_frame_hdr and 
.eh_frame ELF sections). The code is mostly stolen from
libunwind (git://git.sv.gnu.org/libunwind.git).

I'm not sure how much of usage this can be given that we
already have quite reliable stack backtrace, and given
the complexity of the dwarf unwind. But I might be
overlooking something and this could be of use for someone
else.

Also it needs to be said, that the state of this patchset
is far from being done. It's in state 'working for me' on
x86_64 and seems to provide reliable backtrace.

attached patches:
 - 1/5 unwind, kconfig: Adding UNWIND* options
 - 2/5 unwind, x86: Generate exception frames data for UNWIND_EH_FRAME option
 - 3/5 unwind, dwarf: Add dwarf unwind support
 - 4/5 unwind, api: Add unwind interface and implementation for x86_64
 - 5/5 unwind, test: Add backtrace unwind test code

The test code could be triggered via unwind_test debugfs file
with following output:

 # echo > ./unwind_test
 Testing unwind from process context.
 unwind backtrace:
     [0xffffffff810ef759] unw_backtrace+0x29/0x80
     [0xffffffff810ef7d4] test_write+0x24/0x90
     [0xffffffff81138940] vfs_write+0xd0/0x1a0
     [0xffffffff81138b14] sys_write+0x54/0xa0
     [0xffffffff814d7352] system_call_fastpath+0x16/0x1b
 Testing a unwind from irq context.
 unwind backtrace:
     [0xffffffff810ef759] unw_backtrace+0x29/0x80
     [0xffffffff810ef84e] unwind_test_irq_callback+0xe/0x20
     [0xffffffff8103d1c3] tasklet_action+0x143/0x150
     [0xffffffff8103d9bd] __do_softirq+0xdd/0x250
     [0xffffffff8103dc18] run_ksoftirqd+0xe8/0x200
     [0xffffffff8105a1b6] kthread+0xc6/0xd0
     [0xffffffff814d8564] kernel_thread_helper+0x4/0x10


thanks for comments,
jirka
---
 arch/x86/Kconfig.debug            |    2 +
 arch/x86/Makefile                 |    8 +-
 arch/x86/include/asm/dwarf.h      |   89 +++++
 arch/x86/include/asm/unwind.h     |   14 +
 arch/x86/kernel/Makefile          |    2 +
 arch/x86/kernel/dwarf.c           |  101 ++++++
 arch/x86/kernel/unwind_init_64.S  |   31 ++
 arch/x86/kernel/vmlinux.lds.S     |    5 +
 include/asm-generic/vmlinux.lds.h |   12 +
 include/linux/dwarf.h             |  161 +++++++++
 include/linux/unwind.h            |   23 ++
 kernel/Kconfig.unwind             |   26 ++
 kernel/Makefile                   |    6 +
 kernel/dwarf-cfi.c                |  337 ++++++++++++++++++
 kernel/dwarf-expression.c         |  694 +++++++++++++++++++++++++++++++++++++
 kernel/dwarf-fde.c                |  349 +++++++++++++++++++
 kernel/dwarf-read.c               |  227 ++++++++++++
 kernel/dwarf.c                    |    7 +
 kernel/unwind.c                   |  224 ++++++++++++
 19 files changed, 2317 insertions(+), 1 deletions(-)

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2012-02-14  2:23 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-10 11:25 [RFC 0/5] kernel: backtrace unwind support Jiri Olsa
2012-02-10 11:25 ` [PATCH 1/5] unwind, kconfig: Adding UNWIND* options Jiri Olsa
2012-02-10 11:25 ` [PATCH 2/5] unwind, x86: Generate exception frames data for UNWIND_EH_FRAME option Jiri Olsa
2012-02-10 11:25 ` [PATCH 3/5] unwind, dwarf: Add dwarf unwind support Jiri Olsa
2012-02-10 11:25 ` [PATCH 4/5] unwind, api: Add unwind interface and implementation for x86_64 Jiri Olsa
2012-02-10 11:25 ` [PATCH 5/5] unwind, test: Add backtrace unwind test code Jiri Olsa
2012-02-10 17:43 ` [RFC 0/5] kernel: backtrace unwind support Peter Zijlstra
2012-02-10 18:59   ` Linus Torvalds
2012-02-10 19:27     ` Arnaldo Carvalho de Melo
2012-02-10 19:32       ` Linus Torvalds
2012-02-10 19:39         ` Arnaldo Carvalho de Melo
2012-02-10 19:42           ` Arnaldo Carvalho de Melo
2012-02-10 19:44       ` Ingo Molnar
2012-02-10 20:18         ` Jiri Olsa
2012-02-10 20:37           ` Linus Torvalds
2012-02-14  2:22             ` Benjamin Herrenschmidt
2012-02-11 14:38           ` Ingo Molnar
2012-02-11 23:36             ` Jiri Olsa
2012-02-11  3:25         ` Frederic Weisbecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).