lkml.org 
[lkml]   [2010]   [Feb]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 26/28] kdb,debug_core: Allow the debug core to receive a panic notification
    Date
    It is highly desirable to trap into kdb on panic.  The debug core will
    attempt to register as the first in line for the panic notifier.

    CC: Ingo Molnar <mingo@elte.hu>
    CC: Andrew Morton <akpm@linux-foundation.org>
    CC: Eric W. Biederman <ebiederm@xmission.com>
    Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
    ---
    kernel/debug/debug_core.c | 19 +++++++++++++++++++
    1 files changed, 19 insertions(+), 0 deletions(-)

    diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c
    index bfdba97..ed42d9e 100644
    --- a/kernel/debug/debug_core.c
    +++ b/kernel/debug/debug_core.c
    @@ -754,11 +754,28 @@ static struct sysrq_key_op sysrq_dbg_op = {
    };
    #endif

    +static int kgdb_panic_event(struct notifier_block *self,
    + unsigned long val,
    + void *data)
    +{
    + if (dbg_kdb_mode)
    + kdb_printf("PANIC: %s\n", (char *)data);
    + kgdb_breakpoint();
    + return NOTIFY_DONE;
    +}
    +
    +static struct notifier_block kgdb_panic_event_nb = {
    + .notifier_call = kgdb_panic_event,
    + .priority = INT_MAX,
    +};
    +
    static void kgdb_register_callbacks(void)
    {
    if (!kgdb_io_module_registered) {
    kgdb_io_module_registered = 1;
    kgdb_arch_init();
    + atomic_notifier_chain_register(&panic_notifier_list,
    + &kgdb_panic_event_nb);
    #ifdef CONFIG_MAGIC_SYSRQ
    register_sysrq_key('g', &sysrq_dbg_op);
    #endif
    @@ -778,6 +795,8 @@ static void kgdb_unregister_callbacks(void)
    */
    if (kgdb_io_module_registered) {
    kgdb_io_module_registered = 0;
    + atomic_notifier_chain_unregister(&panic_notifier_list,
    + &kgdb_panic_event_nb);
    kgdb_arch_exit();
    #ifdef CONFIG_MAGIC_SYSRQ
    unregister_sysrq_key('g', &sysrq_dbg_op);
    --
    1.6.4.rc1


    \
     
     \ /
      Last update: 2010-02-25 22:27    [W:0.048 / U:30.268 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site