maltalinux-cvs-patches
[Top] [All Lists]

CVS Update@linux-mips.org: malta

To: maltalinux-cvs-patches@linux-mips.org
Subject: CVS Update@linux-mips.org: malta
From: chris@linux-mips.org
Date: Thu, 28 Jul 2005 18:25:19 +0100
Reply-to: linux-mips@linux-mips.org
Sender: maltalinux-cvs-patches-bounce@linux-mips.org
CVSROOT:        /home/cvs
Module name:    malta
Changes by:     chris@ftp.linux-mips.org        05/07/28 18:25:18

Modified files:
        linux/arch/mips/kernel: Tag: MaltaRef_2_6 smp.c 

Log message:
        * arch/mips/kernel/smp.c (smp_tune_scheduling): Remove unused
        bandwidth variable.
        (smp_call_function): kgdb_wait needs special handling. Clear
        call_data before smp_call_function returns.
        (smp_call_function_interrupt): Check for call_data being
        set... catches case where unexpect IPI occurs.

diff -urN malta/linux/arch/mips/kernel/smp.c malta/linux/arch/mips/kernel/smp.c
--- malta/linux/arch/mips/kernel/smp.c  2005/06/21 13:24:03     1.66.1000.2
+++ malta/linux/arch/mips/kernel/smp.c  2005/07/28 17:25:17     1.66.1000.3
@@ -50,7 +50,6 @@
 {
        struct cache_desc *cd = &current_cpu_data.scache;
        unsigned long cachesize;       /* kB   */
-       unsigned long bandwidth = 350; /* MB/s */
        unsigned long cpu_khz;
 
        /*
@@ -145,8 +144,32 @@
        if (!cpus)
                return 0;
 
-       /* Can deadlock when called with interrupts disabled */
+#ifdef CONFIG_KGDB
+       /* GDB will call this function with interrupts disabled, so it gets 
special handling */
+       {
+               extern void kgdb_wait(void *);
+               if (func == kgdb_wait) {
+                       if (spin_is_locked(&smp_call_lock)) {
+                               /*
+                                * Some other processor is trying to make us do 
something
+                                * but we're not going to respond... give up
+                                */
+                               return -1;
+                       }
+                       /*
+                        * We will continue here, accepting the fact that
+                        * the kernel may deadlock if another CPU attempts
+                        * to call smp_call_function now...
+                        */
+               }
+               else {
+                       /* Any other callers get treated normally */
+                       WARN_ON(irqs_disabled());
+               }
+       }
+#else
        WARN_ON(irqs_disabled());
+#endif
 
        data.func = func;
        data.info = info;
@@ -172,6 +195,7 @@
        if (wait)
                while (atomic_read(&data.finished) != cpus)
                        barrier();
+       call_data = NULL;
        spin_unlock(&smp_call_lock);
 
        return 0;
@@ -179,9 +203,17 @@
 
 void smp_call_function_interrupt(void)
 {
-       void (*func) (void *info) = call_data->func;
-       void *info = call_data->info;
-       int wait = call_data->wait;
+       void (*func) (void *info);
+       void *info;
+       int wait;
+
+       if (call_data == NULL) {
+               printk ("CPU %d: smp_call_function_interrupt with no 
call_data\n", smp_processor_id());
+               return;
+       }
+       func = call_data->func;
+       info = call_data->info;
+       wait = call_data->wait;
 
        /*
         * Notify initiating CPU that I've grabbed the data and am

<Prev in Thread] Current Thread [Next in Thread>