[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 5/10] linux 2.6.18: kill unneeded vector_lock



Slim down again the implementation on assign_irq_vector, as under Xen
all serialization is done in the hypervisor.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

Index: head-2007-02-27/arch/i386/kernel/io_apic-xen.c
===================================================================
--- head-2007-02-27.orig/arch/i386/kernel/io_apic-xen.c 2007-03-05 
10:00:18.000000000 +0100
+++ head-2007-02-27/arch/i386/kernel/io_apic-xen.c      2007-02-27 
16:27:37.000000000 +0100
@@ -90,7 +90,6 @@ atomic_t irq_mis_count;
 static struct { int pin, apic; } ioapic_i8259 = { -1, -1 };
 
 static DEFINE_SPINLOCK(ioapic_lock);
-static DEFINE_SPINLOCK(vector_lock);
 
 int timer_over_8254 __initdata = 1;
 
@@ -1209,33 +1208,22 @@ u8 irq_vector[NR_IRQ_VECTORS] __read_mos
 
 int assign_irq_vector(int irq)
 {
-       unsigned long flags;
-       int vector;
        struct physdev_irq irq_op;
 
        BUG_ON(irq != AUTO_ASSIGN && (unsigned)irq >= NR_IRQ_VECTORS);
 
-       spin_lock_irqsave(&vector_lock, flags);
-
-       if (irq != AUTO_ASSIGN && IO_APIC_VECTOR(irq) > 0) {
-               spin_unlock_irqrestore(&vector_lock, flags);
+       if (irq != AUTO_ASSIGN && IO_APIC_VECTOR(irq) > 0)
                return IO_APIC_VECTOR(irq);
-       }
 
        irq_op.irq = irq;
-       if (HYPERVISOR_physdev_op(PHYSDEVOP_alloc_irq_vector, &irq_op)) {
-               spin_unlock_irqrestore(&vector_lock, flags);
+       if (HYPERVISOR_physdev_op(PHYSDEVOP_alloc_irq_vector, &irq_op))
                return -ENOSPC;
-       }
 
-       vector = irq_op.vector;
-       vector_irq[vector] = irq;
+       vector_irq[irq_op.vector] = irq;
        if (irq != AUTO_ASSIGN)
-               IO_APIC_VECTOR(irq) = vector;
-
-       spin_unlock_irqrestore(&vector_lock, flags);
+               IO_APIC_VECTOR(irq) = irq_op.vector;
 
-       return vector;
+       return irq_op.vector;
 }
 
 #ifndef CONFIG_XEN
Index: head-2007-02-27/arch/x86_64/kernel/io_apic-xen.c
===================================================================
--- head-2007-02-27.orig/arch/x86_64/kernel/io_apic-xen.c       2007-03-05 
10:00:18.000000000 +0100
+++ head-2007-02-27/arch/x86_64/kernel/io_apic-xen.c    2007-02-27 
16:27:37.000000000 +0100
@@ -58,7 +58,6 @@ static struct { int pin, apic; } ioapic_
 #endif
 
 static DEFINE_SPINLOCK(ioapic_lock);
-static DEFINE_SPINLOCK(vector_lock);
 
 /*
  * # of IRQ routing registers
@@ -888,33 +887,22 @@ u8 irq_vector[NR_IRQ_VECTORS] __read_mos
 
 int assign_irq_vector(int irq)
 {
-       unsigned long flags;
-       int vector;
        struct physdev_irq irq_op;
   
        BUG_ON(irq != AUTO_ASSIGN && (unsigned)irq >= NR_IRQ_VECTORS);
 
-       spin_lock_irqsave(&vector_lock, flags);
-
-       if (irq != AUTO_ASSIGN && IO_APIC_VECTOR(irq) > 0) {
-               spin_unlock_irqrestore(&vector_lock, flags);
+       if (irq != AUTO_ASSIGN && IO_APIC_VECTOR(irq) > 0)
                return IO_APIC_VECTOR(irq);
-       }
 
        irq_op.irq = irq;
-       if (HYPERVISOR_physdev_op(PHYSDEVOP_alloc_irq_vector, &irq_op)) {
-               spin_unlock_irqrestore(&vector_lock, flags);
+       if (HYPERVISOR_physdev_op(PHYSDEVOP_alloc_irq_vector, &irq_op))
                return -ENOSPC;
-       }
 
-       vector = irq_op.vector;
-       vector_irq[vector] = irq;
+       vector_irq[irq_op.vector] = irq;
        if (irq != AUTO_ASSIGN)
-               IO_APIC_VECTOR(irq) = vector;
-
-       spin_unlock_irqrestore(&vector_lock, flags);
+               IO_APIC_VECTOR(irq) = irq_op.vector;
 
-       return vector;
+       return irq_op.vector;
 }
 
 extern void (*interrupt[NR_IRQS])(void);



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.