Re: [patch] "big IRQ lock" removal, 2.5.27-A5

From: Ingo Molnar (mingo@elte.hu)
Date: Sun Jul 21 2002 - 15:50:03 EST


fixed the arch/i386/kernel/mca.c hacks as well:
 
     http://redhat.com/~mingo/remove-irqlock-patches/remove-irqlock-2.5.27-A6

while there cannot be many MCA SMP boxes in existence, it should be SMP
safe as well.

         Ingo

--- linux/arch/i386/kernel/mca.c.orig Sun Jun 9 07:27:54 2002
+++ linux/arch/i386/kernel/mca.c Sun Jul 21 22:49:42 2002
@@ -102,6 +102,12 @@
 
 static struct MCA_info* mca_info = NULL;
 
+/*
+ * Motherboard register spinlock. Untested on SMP at the moment, but
+ * are there any MCA SMP boxes?
+ */
+static spinlock_t mca_lock = SPIN_LOCK_UNLOCKED;
+
 /* MCA registers */
 
 #define MCA_MOTHERBOARD_SETUP_REG 0x94
@@ -213,8 +219,11 @@
         }
         memset(mca_info, 0, sizeof(struct MCA_info));
 
- save_flags(flags);
- cli();
+ /*
+ * We do not expect many MCA interrupts during initialization,
+ * but let us be safe:
+ */
+ spin_lock_irq(&mca_lock);
 
         /* Make sure adapter setup is off */
 
@@ -300,8 +309,7 @@
         outb_p(0, MCA_ADAPTER_SETUP_REG);
 
         /* Enable interrupts and return memory start */
-
- restore_flags(flags);
+ spin_unlock_irq(&mca_lock);
 
         for (i = 0; i < MCA_STANDARD_RESOURCES; i++)
                 request_resource(&ioport_resource, mca_standard_resources + i);
@@ -514,8 +522,7 @@
         if(slot < 0 || slot >= MCA_NUMADAPTERS || mca_info == NULL) return 0;
         if(reg < 0 || reg >= 8) return 0;
 
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&mca_lock, flags);
 
         /* Make sure motherboard setup is off */
 
@@ -566,7 +573,7 @@
 
         mca_info->slot[slot].pos[reg] = byte;
 
- restore_flags(flags);
+ spin_unlock_irqrestore(&mca_lock, flags);
 
         return byte;
 } /* mca_read_pos() */
@@ -610,8 +617,7 @@
         if(mca_info == NULL)
                 return;
 
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&mca_lock, flags);
 
         /* Make sure motherboard setup is off */
 
@@ -623,7 +629,7 @@
         outb_p(byte, MCA_POS_REG(reg));
         outb_p(0, MCA_ADAPTER_SETUP_REG);
 
- restore_flags(flags);
+ spin_unlock_irqrestore(&mca_lock, flags);
 
         /* Update the global register list, while we have the byte */
 

-
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 : Tue Jul 23 2002 - 22:00:36 EST