linux: panic/shutdown handling adjustments
PATCH 1/1 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 <[email protected]>
arch/i386/kernel/smp-xen.c +2 -6
@@ -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 (); }
arch/x86_64/kernel/smp-xen.c +2 -6
@@ -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 (); }
drivers/xen/core/evtchn.c +10 -0
@@ -157,6 +157,16 @@ static inline unsigned int cpu_from_evtcreturn 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,
include/xen/evtchn.h +1 -0
@@ -102,6 +102,7 @@ asmlinkage void evtchn_do_upcall(structvoid evtchn_device_upcall (int port);void mask_evtchn (int port); +void mask_evtchn_local (void );void unmask_evtchn (int port);#ifdef CONFIG_SMP