[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lhcs-devel
Subject:    [lhcs-devel] x86 __cpu_up - returns with IRQs disabled
From:       Srivatsa Vaddagiri <vatsa () in ! ibm ! com>
Date:       2004-03-31 9:49:17
Message-ID: 20040331094939.GA22092 () in ! ibm ! com
[Download RAW message or body]

Hi Rsuty,
	I observed that __cpu_up on x86 returns with IRQs disabled. This
is because of common code in fixup_irqs, which enable interrupts for 0.02 ms
and then disables it again. Isn't this strictly reqd only during __cpu_disable?

Patch below moves the "reenable interrupts for 0.02 ms" code outside
fixup_irqs into __cpu_disable. Its tested against 2.6.5-rc3 + your i386 Hotplug
patch.



---

 linux-2.6.5-rc3-vatsa/arch/i386/kernel/irq.c     |   20 +-------------------
 linux-2.6.5-rc3-vatsa/arch/i386/kernel/smpboot.c |   19 +++++++++++++++++++
 2 files changed, 20 insertions(+), 19 deletions(-)

diff -puN arch/i386/kernel/irq.c~fixup_irq arch/i386/kernel/irq.c
--- linux-2.6.5-rc3/arch/i386/kernel/irq.c~fixup_irq	2004-03-31 14:50:53.000000000 +0530
+++ linux-2.6.5-rc3-vatsa/arch/i386/kernel/irq.c	2004-03-31 15:06:08.000000000 +0530
@@ -403,7 +403,7 @@ void enable_irq(unsigned int irq)
 	spin_unlock_irqrestore(&desc->lock, flags);
 }
 
-static int irqs_stabilizing;
+int irqs_stabilizing;
 
 /*
  * do_IRQ handles all normal device IRQ's (the special
@@ -991,24 +991,6 @@ void fixup_irqs(void)
 			printk("Cannot set affinity for irq %i\n", irq);
 	}
 
-#if 0
-	irqs_stabilizing = 1;
-	barrier();
-	/* Ingo Molnar says: "after the IO-APIC masks have been redirected
-	   [note the nop - the interrupt-enable boundary on x86 is two
-	   instructions from sti] - to flush out pending hardirqs and
-	   IPIs. After this point nothing is supposed to reach this CPU." */
-	__asm__ __volatile__("sti; nop; cli");
-	barrier();
-	irqs_stabilizing = 0;
-#else
-	/* That doesn't seem sufficient.  Give it 0.02ms. */
-	irqs_stabilizing = 1;
-	local_irq_enable();
-	udelay(20);
-	local_irq_disable();
-	irqs_stabilizing = 0;
-#endif
 }
 #endif
 
diff -puN arch/i386/kernel/smpboot.c~fixup_irq arch/i386/kernel/smpboot.c
--- linux-2.6.5-rc3/arch/i386/kernel/smpboot.c~fixup_irq	2004-03-31 14:50:53.000000000 +0530
+++ linux-2.6.5-rc3-vatsa/arch/i386/kernel/smpboot.c	2004-03-31 15:13:13.000000000 +0530
@@ -1142,6 +1142,7 @@ void __devinit smp_prepare_boot_cpu(void
 
 #ifdef CONFIG_HOTPLUG_CPU
 extern void fixup_irqs(void);
+extert int irqs_stabilizing;
 
 /* must be called with the cpucontrol mutex held */
 static int __devinit cpu_enable(unsigned int cpu)
@@ -1173,6 +1174,24 @@ int __cpu_disable(void)
 		return -EBUSY;
 
 	fixup_irqs();
+#if 0
+	irqs_stabilizing = 1;
+	barrier();
+	/* Ingo Molnar says: "after the IO-APIC masks have been redirected
+	   [note the nop - the interrupt-enable boundary on x86 is two
+	   instructions from sti] - to flush out pending hardirqs and
+	   IPIs. After this point nothing is supposed to reach this CPU." */
+	__asm__ __volatile__("sti; nop; cli");
+	barrier();
+	irqs_stabilizing = 0;
+#else
+	/* That doesn't seem sufficient.  Give it 0.02ms. */
+	irqs_stabilizing = 1;
+	local_irq_enable();
+	udelay(20);
+	local_irq_disable();
+	irqs_stabilizing = 0;
+#endif
 	return 0;
 }
 

_

-- 


Thanks and Regards,
Srivatsa Vaddagiri,
Linux Technology Center,
IBM Software Labs,
Bangalore, INDIA - 560017


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
lhcs-devel mailing list
lhcs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lhcs-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic