Skip to content

Commit

Permalink
[PATCH] x86-64: Speed up dwarf2 unwinder
Browse files Browse the repository at this point in the history
This changes the dwarf2 unwinder to do a binary search for CIEs
instead of a linear work. The linker is unfortunately not
able to build a proper lookup table at link time, instead it creates
one at runtime as soon as the bootmem allocator is usable (so you'll continue
using the linear lookup for the first [hopefully] few calls).
The code should be ready to utilize a build-time created table once
a fixed linker becomes available.

Signed-off-by: Jan Beulich <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
  • Loading branch information
Jan Beulich authored and Andi Kleen committed Oct 21, 2006
1 parent cdfce1f commit 690a973
Show file tree
Hide file tree
Showing 5 changed files with 299 additions and 39 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ endif

ifdef CONFIG_UNWIND_INFO
CFLAGS += -fasynchronous-unwind-tables
LDFLAGS_vmlinux += --eh-frame-hdr
endif

ifdef CONFIG_DEBUG_INFO
Expand Down
16 changes: 16 additions & 0 deletions include/asm-generic/vmlinux.lds.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@
*(__param) \
VMLINUX_SYMBOL(__stop___param) = .; \
} \
\
/* Unwind data binary search table */ \
EH_FRAME_HDR \
\
__end_rodata = .; \
. = ALIGN(4096);

Expand Down Expand Up @@ -157,6 +161,18 @@
*(.kprobes.text) \
VMLINUX_SYMBOL(__kprobes_text_end) = .;

#ifdef CONFIG_STACK_UNWIND
/* Unwind data binary search table */
#define EH_FRAME_HDR \
.eh_frame_hdr : AT(ADDR(.eh_frame_hdr) - LOAD_OFFSET) { \
VMLINUX_SYMBOL(__start_unwind_hdr) = .; \
*(.eh_frame_hdr) \
VMLINUX_SYMBOL(__end_unwind_hdr) = .; \
}
#else
#define EH_FRAME_HDR
#endif

/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to
the beginning of the section so we begin them at 0. */
Expand Down
2 changes: 2 additions & 0 deletions include/linux/unwind.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ struct module;
* Initialize unwind support.
*/
extern void unwind_init(void);
extern void unwind_setup(void);

#ifdef CONFIG_MODULES

Expand Down Expand Up @@ -73,6 +74,7 @@ extern int unwind_to_user(struct unwind_frame_info *);
struct unwind_frame_info {};

static inline void unwind_init(void) {}
static inline void unwind_setup(void) {}

#ifdef CONFIG_MODULES

Expand Down
1 change: 1 addition & 0 deletions init/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,7 @@ asmlinkage void __init start_kernel(void)
printk(KERN_NOTICE);
printk(linux_banner);
setup_arch(&command_line);
unwind_setup();
setup_per_cpu_areas();
smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */

Expand Down
Loading

0 comments on commit 690a973

Please sign in to comment.