On Thu, Mar 09, 2006 at 02:21:48AM -0700, Eric W. Biederman wrote:
> Maneesh Soni <[EMAIL PROTECTED]> writes:
> 
> > Following was observed by David Wilder while testig kexec on panic on
> > a system with Pentium 4 with HT. Looks like the problem might have
> > occured due to  CPU0 holding the lock and then it might have
> > received the NMI and it was stopped with runq lock held. CPU1, 
> > enabled the interrupts after stopping other CPU0. Somehow it received 
> > the local apic timer interrupt and started spinning on runq lock.
> >
> > Appended is the possible fix for this race condition, which avoids
> > re-enabling irqs on panic shutdown
> 
> Grumble.  We should not be disabling apics in the first place
> Grumble.
> 
Agreed!!

> It is probably better to save and restore the irq state
> in lapic_shutdown().  Than to open code it.
> 

I hope this looks ok.

Thanks
Maneesh





o lapic_shutdown() re-enables which is un-desirable for panic case,
  so use local_irq_save() and local_irq_restore() to keep the irqs
  disabled for kexec on panic case, and close a possible race window.

Signed-off-by: Maneesh Soni <[EMAIL PROTECTED]>
---

 linux-2.6.16-rc5-git14-maneesh/arch/i386/kernel/apic.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff -puN arch/i386/kernel/apic.c~kdump-shutdown-hang-fix 
arch/i386/kernel/apic.c
--- linux-2.6.16-rc5-git14/arch/i386/kernel/apic.c~kdump-shutdown-hang-fix      
2006-03-10 17:42:48.473188808 +0530
+++ linux-2.6.16-rc5-git14-maneesh/arch/i386/kernel/apic.c      2006-03-10 
17:43:40.390296208 +0530
@@ -570,16 +570,18 @@ void __devinit setup_local_APIC(void)
  */
 void lapic_shutdown(void)
 {
+       unsigned long flags;
+
        if (!cpu_has_apic)
                return;
 
-       local_irq_disable();
+       local_irq_save(flags);
        clear_local_APIC();
 
        if (enabled_via_apicbase)
                disable_local_APIC();
 
-       local_irq_enable();
+       local_irq_restore(flags);
 }
 
 #ifdef CONFIG_PM
_
-- 
Maneesh Soni
Linux Technology Center, 
IBM India Software Labs,
Bangalore, India
email: [EMAIL PROTECTED]
Phone: 91-80-51776416
_______________________________________________
fastboot mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/fastboot

Reply via email to