[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] linux: panic/shutdown handling adjustments



Prevent interrupts (and hence possibly scheduler operations) from
occuring on (against) a CPU after removing it from cpu_online_map
during panic/shutdown.
(Background: I found it quite annoying to see scheduler related
badness or BUG messages after a panic, eventually even leading to
important information scrolling off the screen.)

As usual, written and tested against 2.6.23 and made apply against
2.6.18 without further testing.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

Index: head-2007-10-15/arch/i386/kernel/smp-xen.c
===================================================================
--- head-2007-10-15.orig/arch/i386/kernel/smp-xen.c     2007-10-18 
16:47:18.000000000 +0200
+++ head-2007-10-15/arch/i386/kernel/smp-xen.c  2007-10-18 16:56:49.000000000 
+0200
@@ -595,9 +595,7 @@ static void stop_this_cpu (void * dummy)
         */
        cpu_clear(smp_processor_id(), cpu_online_map);
        local_irq_disable();
-#if 0
-       disable_local_APIC();
-#endif
+       mask_evtchn_local();
        if (cpu_data[smp_processor_id()].hlt_works_ok)
                for(;;) halt();
        for (;;);
@@ -617,9 +615,7 @@ void xen_smp_send_stop(void)
        smp_call_function(stop_this_cpu, NULL, 1, 0);
 
        local_irq_disable();
-#if 0
-       disable_local_APIC();
-#endif
+       mask_evtchn_local();
        local_irq_enable();
 }
 
Index: head-2007-10-15/arch/x86_64/kernel/smp-xen.c
===================================================================
--- head-2007-10-15.orig/arch/x86_64/kernel/smp-xen.c   2007-10-18 
11:55:23.000000000 +0200
+++ head-2007-10-15/arch/x86_64/kernel/smp-xen.c        2007-10-18 
16:56:49.000000000 +0200
@@ -488,9 +488,7 @@ void smp_stop_cpu(void)
         */
        cpu_clear(smp_processor_id(), cpu_online_map);
        local_irq_save(flags);
-#ifndef CONFIG_XEN
-       disable_local_APIC();
-#endif
+       mask_evtchn_local();
        local_irq_restore(flags); 
 }
 
@@ -511,9 +509,7 @@ void smp_send_stop(void)
                spin_unlock(&call_lock);
 
        local_irq_disable();
-#ifndef CONFIG_XEN
-       disable_local_APIC();
-#endif
+       mask_evtchn_local();
        local_irq_enable();
 }
 
Index: head-2007-10-15/drivers/xen/core/evtchn.c
===================================================================
--- head-2007-10-15.orig/drivers/xen/core/evtchn.c      2007-10-18 
11:22:50.000000000 +0200
+++ head-2007-10-15/drivers/xen/core/evtchn.c   2007-10-18 16:56:49.000000000 
+0200
@@ -157,6 +157,16 @@ static inline unsigned int cpu_from_evtc
        return cpu_evtchn[evtchn];
 }
 
+void mask_evtchn_local(void)
+{
+       unsigned i, cpu = smp_processor_id();
+       shared_info_t *s = HYPERVISOR_shared_info;
+
+       for (i = 0; i < NR_EVENT_CHANNELS; ++i)
+               if (cpu_evtchn[i] == cpu)
+                       synch_set_bit(i, &s->evtchn_mask[0]);
+}
+
 #else
 
 static inline unsigned long active_evtchns(unsigned int cpu, shared_info_t *sh,
Index: head-2007-10-15/include/xen/evtchn.h
===================================================================
--- head-2007-10-15.orig/include/xen/evtchn.h   2007-10-18 11:22:48.000000000 
+0200
+++ head-2007-10-15/include/xen/evtchn.h        2007-10-18 16:58:01.000000000 
+0200
@@ -102,6 +102,7 @@ asmlinkage void evtchn_do_upcall(struct 
 void evtchn_device_upcall(int port);
 
 void mask_evtchn(int port);
+void mask_evtchn_local(void);
 void unmask_evtchn(int port);
 
 #ifdef CONFIG_SMP




_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.