diff options
author | Jason Wessel <jason.wessel@windriver.com> | 2010-05-20 22:04:29 -0400 |
---|---|---|
committer | Jason Wessel <jason.wessel@windriver.com> | 2010-05-20 22:04:29 -0400 |
commit | 0b4b3827db386ec6034a5aba1261025b039440c2 (patch) | |
tree | a3469de6930fe3e850c8e4c49c26a2a3b53612dd /kernel/debug | |
parent | 29c843912a0baa7fa63033fe28e1ca7e796686a5 (diff) |
x86, kgdb, init: Add early and late debug states
The kernel debugger can operate well before mm_init(), but the x86
hardware breakpoint code which uses the perf api requires that the
kernel allocators are initialized.
This means the kernel debug core needs to provide an optional arch
specific call back to allow the initialization functions to run after
the kernel has been further initialized.
The kdb shell already had a similar restriction with an early
initialization and late initialization. The kdb_init() was moved into
the debug core's version of the late init which is called
dbg_late_init();
CC: kgdb-bugreport@lists.sourceforge.net
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Diffstat (limited to 'kernel/debug')
-rw-r--r-- | kernel/debug/debug_core.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c index 64b5588c9638..5cb7cd1de10c 100644 --- a/kernel/debug/debug_core.c +++ b/kernel/debug/debug_core.c | |||
@@ -78,6 +78,8 @@ static DEFINE_SPINLOCK(kgdb_registration_lock); | |||
78 | static int kgdb_con_registered; | 78 | static int kgdb_con_registered; |
79 | /* determine if kgdb console output should be used */ | 79 | /* determine if kgdb console output should be used */ |
80 | static int kgdb_use_con; | 80 | static int kgdb_use_con; |
81 | /* Flag for alternate operations for early debugging */ | ||
82 | bool dbg_is_early = true; | ||
81 | /* Next cpu to become the master debug core */ | 83 | /* Next cpu to become the master debug core */ |
82 | int dbg_switch_cpu; | 84 | int dbg_switch_cpu; |
83 | 85 | ||
@@ -777,11 +779,25 @@ static struct notifier_block kgdb_panic_event_nb = { | |||
777 | .priority = INT_MAX, | 779 | .priority = INT_MAX, |
778 | }; | 780 | }; |
779 | 781 | ||
782 | void __weak kgdb_arch_late(void) | ||
783 | { | ||
784 | } | ||
785 | |||
786 | void __init dbg_late_init(void) | ||
787 | { | ||
788 | dbg_is_early = false; | ||
789 | if (kgdb_io_module_registered) | ||
790 | kgdb_arch_late(); | ||
791 | kdb_init(KDB_INIT_FULL); | ||
792 | } | ||
793 | |||
780 | static void kgdb_register_callbacks(void) | 794 | static void kgdb_register_callbacks(void) |
781 | { | 795 | { |
782 | if (!kgdb_io_module_registered) { | 796 | if (!kgdb_io_module_registered) { |
783 | kgdb_io_module_registered = 1; | 797 | kgdb_io_module_registered = 1; |
784 | kgdb_arch_init(); | 798 | kgdb_arch_init(); |
799 | if (!dbg_is_early) | ||
800 | kgdb_arch_late(); | ||
785 | atomic_notifier_chain_register(&panic_notifier_list, | 801 | atomic_notifier_chain_register(&panic_notifier_list, |
786 | &kgdb_panic_event_nb); | 802 | &kgdb_panic_event_nb); |
787 | #ifdef CONFIG_MAGIC_SYSRQ | 803 | #ifdef CONFIG_MAGIC_SYSRQ |