Re: [patch] sti() preemption fix, 2.5.22

From: Robert Love (rml@tech9.net)
Date: Mon Jun 17 2002 - 12:20:53 EST


On Mon, 2002-06-17 at 10:04, Linus Torvalds wrote:

> Ingo, please use "get_cpu()/put_cpu()" instead, which does exactly the
> preempt-disable etc, and is more readable.

Here is Ingo's patch using the get_cpu()/put_cpu() interface where
needed...

Ingo, good catch!

        Robert Love

diff -urN linux-2.5.22/arch/i386/kernel/irq.c linux/arch/i386/kernel/irq.c
--- linux-2.5.22/arch/i386/kernel/irq.c Sun Jun 16 19:31:24 2002
+++ linux/arch/i386/kernel/irq.c Mon Jun 17 10:19:18 2002
@@ -356,8 +356,9 @@
 
         __save_flags(flags);
         if (flags & (1 << EFLAGS_IF_SHIFT)) {
- int cpu = smp_processor_id();
+ int cpu;
                 __cli();
+ cpu = smp_processor_id();
                 if (!local_irq_count(cpu))
                         get_irqlock(cpu);
         }
@@ -365,11 +366,15 @@
 
 void __global_sti(void)
 {
- int cpu = smp_processor_id();
+ int cpu;
+
+ cpu = get_cpu();
 
         if (!local_irq_count(cpu))
                 release_irqlock(cpu);
         __sti();
+
+ put_cpu();
 }
 
 /*

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Jun 23 2002 - 22:00:13 EST