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

[Xen-changelog] [xen-unstable] IRQ: Fold irq_status into irq_cfg



# HG changeset patch
# User Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
# Date 1315231718 -3600
# Node ID 9fa77d26a813867ad4c1ac4a78216f27c39f952b
# Parent  fe44efb1f592c8cbbe924a5aa4858c34ab3f9963
IRQ: Fold irq_status into irq_cfg

irq_status is an int for each of nr_irqs which represents a single
boolean variable.  Fold it into the bitfield in irq_cfg, which saves
768 bytes per CPU with per-cpu IDTs in use.

Signed-off-by Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---


diff -r fe44efb1f592 -r 9fa77d26a813 xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c        Mon Sep 05 15:02:11 2011 +0100
+++ b/xen/arch/x86/irq.c        Mon Sep 05 15:08:38 2011 +0100
@@ -43,11 +43,6 @@
 u8 __read_mostly *irq_vector;
 struct irq_desc __read_mostly *irq_desc = NULL;
 
-int __read_mostly *irq_status = NULL;
-#define IRQ_UNUSED      (0)
-#define IRQ_USED        (1)
-#define IRQ_RSVD        (2)
-
 #define IRQ_VECTOR_UNASSIGNED (0)
 
 static DECLARE_BITMAP(used_vectors, NR_VECTORS);
@@ -141,7 +136,7 @@
         ASSERT(!test_bit(vector, cfg->used_vectors));
         set_bit(vector, cfg->used_vectors);
     }
-    irq_status[irq] = IRQ_USED;
+    cfg->used = IRQ_USED;
     if (IO_APIC_IRQ(irq))
         irq_vector[irq] = vector;
     return 0;
@@ -163,7 +158,7 @@
     int irq;
 
     for (irq = nr_irqs_gsi; irq < nr_irqs; irq++)
-        if (irq_status[irq] == IRQ_UNUSED)
+        if (irq_cfg[irq].used == IRQ_UNUSED)
             return irq;
     return -ENOSPC;
 }
@@ -215,8 +210,6 @@
         xfree(action);
 }
 
-static void init_one_irq_status(int irq);
-
 static void __clear_irq_vector(int irq)
 {
     int cpu, vector;
@@ -235,7 +228,7 @@
 
     cfg->vector = IRQ_VECTOR_UNASSIGNED;
     cpus_clear(cfg->cpu_mask);
-    init_one_irq_status(irq);
+    cfg->used = IRQ_UNUSED;
 
     if (likely(!cfg->move_in_progress))
         return;
@@ -307,17 +300,13 @@
     INIT_LIST_HEAD(&desc->rl_link);
 }
 
-static void init_one_irq_status(int irq)
-{
-    irq_status[irq] = IRQ_UNUSED;
-}
-
 static void __init init_one_irq_cfg(struct irq_cfg *cfg)
 {
     cfg->vector = IRQ_VECTOR_UNASSIGNED;
     cpus_clear(cfg->cpu_mask);
     cpus_clear(cfg->old_cpu_mask);
     cfg->used_vectors = NULL;
+    cfg->used = IRQ_UNUSED;
 }
 
 int __init init_irq_data(void)
@@ -331,15 +320,13 @@
 
     irq_desc = xmalloc_array(struct irq_desc, nr_irqs);
     irq_cfg = xmalloc_array(struct irq_cfg, nr_irqs);
-    irq_status = xmalloc_array(int, nr_irqs);
     irq_vector = xmalloc_array(u8, nr_irqs_gsi);
     
-    if ( !irq_desc || !irq_cfg || !irq_status ||! irq_vector )
+    if ( !irq_desc || !irq_cfg ||! irq_vector )
         return -ENOMEM;
 
     memset(irq_desc, 0,  nr_irqs * sizeof(*irq_desc));
     memset(irq_cfg, 0,  nr_irqs * sizeof(*irq_cfg));
-    memset(irq_status, 0,  nr_irqs * sizeof(*irq_status));
     memset(irq_vector, 0, nr_irqs_gsi * sizeof(*irq_vector));
     
     for (irq = 0; irq < nr_irqs; irq++) {
@@ -349,7 +336,6 @@
         desc->chip_data = cfg;
         init_one_irq_desc(desc);
         init_one_irq_cfg(cfg);
-        init_one_irq_status(irq);
     }
 
     /* Never allocate the hypercall vector or Linux/BSD fast-trap vector. */
@@ -459,7 +445,7 @@
     /* This is the only place normal IRQs are ever marked
      * as "in use".  If they're not in use yet, check to see
      * if we need to assign a global vector mask. */
-    if ( irq_status[irq] == IRQ_USED )
+    if ( cfg->used == IRQ_USED )
     {
         irq_used_vectors = cfg->used_vectors;
     }
@@ -512,7 +498,7 @@
         cfg->vector = vector;
         cpus_copy(cfg->cpu_mask, tmp_mask);
 
-        irq_status[irq] = IRQ_USED;
+        cfg->used = IRQ_USED;
         ASSERT((cfg->used_vectors == NULL)
                || (cfg->used_vectors == irq_used_vectors));
         cfg->used_vectors = irq_used_vectors;
diff -r fe44efb1f592 -r 9fa77d26a813 xen/include/asm-x86/irq.h
--- a/xen/include/asm-x86/irq.h Mon Sep 05 15:02:11 2011 +0100
+++ b/xen/include/asm-x86/irq.h Mon Sep 05 15:08:38 2011 +0100
@@ -34,8 +34,13 @@
         unsigned move_cleanup_count;
         vmask_t *used_vectors;
         u8 move_in_progress : 1;
+        u8 used: 1;
 };
 
+/* For use with irq_cfg.used */
+#define IRQ_UNUSED      (0)
+#define IRQ_USED        (1)
+
 extern struct irq_cfg *irq_cfg;
 
 typedef int vector_irq_t[NR_VECTORS];

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


 


Rackspace

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