Fix some SMP specific issues on MIPS:

- smp_call_function() shouldn't be called with interrupts disabled, but
  kgdb_roundup_cpu() fails to actually enable them using local_irq_restore()
  as the 'flags' argument passed to it has interrupts already disabled;

- handle_exception() does not enable interrupts prior to __flush_cache_all()
  call which also ends up in IPI;

- 'mips_die_head' didn't have its 'lock' field initialized.

While at it, switch to using DEFINE_SPINLOCK() to define 'die_notifier_lock'...

Based on the original patch by Manish Lachwani <[EMAIL PROTECTED]>.

Signed-off-by: Sergei Shtylyov <[EMAIL PROTECTED]>

---
The patch is against the linux_2_6_21_uprev branch, as usual...

 arch/mips/kernel/kgdb.c  |    5 +++--
 arch/mips/kernel/traps.c |    4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

Index: linux-2.6/arch/mips/kernel/kgdb.c
===================================================================
--- linux-2.6.orig/arch/mips/kernel/kgdb.c
+++ linux-2.6/arch/mips/kernel/kgdb.c
@@ -69,9 +69,9 @@ void kgdb_call_nmi_hook(void *ignored)
 
 void kgdb_roundup_cpus(unsigned long flags)
 {
-       local_irq_restore(flags);
+       local_irq_enable();
        smp_call_function(kgdb_call_nmi_hook, 0, 0, 0);
-       local_irq_save(flags);
+       local_irq_disable();
 }
 
 static int compute_signal(int tt)
@@ -106,6 +106,7 @@ void handle_exception(struct pt_regs *re
        kgdb_handle_exception(0, compute_signal(trap), 0, regs);
 
        /* In SMP mode, __flush_cache_all does IPI */
+       local_irq_enable();
        __flush_cache_all();
 }
 
Index: linux-2.6/arch/mips/kernel/traps.c
===================================================================
--- linux-2.6.orig/arch/mips/kernel/traps.c
+++ linux-2.6/arch/mips/kernel/traps.c
@@ -126,8 +126,8 @@ static void show_backtrace(struct task_s
        printk("\n");
 }
 
-struct atomic_notifier_head mips_die_head;
-static spinlock_t die_notifier_lock = SPIN_LOCK_UNLOCKED;
+ATOMIC_NOTIFIER_HEAD(mips_die_head);
+DEFINE_SPINLOCK(die_notifier_lock);
 
 int register_die_notifier(struct notifier_block *nb)
 {


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Kgdb-bugreport mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport

Reply via email to