WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

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

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH 5/10] linux 2.6.18: kill unneeded vector_lock
From: "Jan Beulich" <jbeulich@xxxxxxxxxx>
Date: Mon, 05 Mar 2007 11:15:58 +0000
Delivery-date: Mon, 05 Mar 2007 03:17:43 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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

<Prev in Thread] Current Thread [Next in Thread>