Skip to contentSkip to conversation

two more fixes for c/s 19419

PATCH In review Jan Beulich 2 participants 2 messages Apr 1, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 two more fixes for c/s 19419

vector_channel[], as its name already says, is vector-, not irq-indexed.

hpet_assign_irq() sits not only in the boot path, but also in the resume one. Short of knowing why this is, simply checking whether a vector was already assigned prevents leaking previously assigned ones.

xen/arch/x86/hpet.c +4 -1
@@ -45,7 +45,7 @@ static unsigned int num_hpets_used; /* m
 
 DEFINE_PER_CPU(struct hpet_event_channel *, cpu_bc_channel);
 
-static int vector_channel[NR_IRQS] = {[0 ... NR_IRQS-1] = -1};
+static int vector_channel[NR_VECTORS] = {[0 ... NR_VECTORS-1] = -1};
 
 #define vector_to_channel(vector)   vector_channel[vector]
 
@@ -345,6 +345,9 @@ static int hpet_assign_irq(struct hpet_e
 {
     unsigned int vector;
 
+    if ( ch->vector )
+        return 0;
+
     vector = assign_irq_vector(AUTO_ASSIGN_IRQ);
     if ( (int)vector < 0 )
         return vector;
#1 lore raw

ACK.

Quoted 29 lines · Jan Beulich

vector_channel[], as its name already says, is vector-, not irq-indexed.

hpet_assign_irq() sits not only in the boot path, but also in the resume one. Short of knowing why this is, simply checking whether a vector was already assigned prevents leaking previously assigned ones.

xen/arch/x86/hpet.c +4 -1
@@ -45,7 +45,7 @@ static unsigned int num_hpets_used; /* m
 
 DEFINE_PER_CPU(struct hpet_event_channel *, cpu_bc_channel);
 
-static int vector_channel[NR_IRQS] = {[0 ... NR_IRQS-1] = -1};
+static int vector_channel[NR_VECTORS] = {[0 ... NR_VECTORS-1] = -1};
 
 #define vector_to_channel(vector)   vector_channel[vector]
 
@@ -345,6 +345,9 @@ static int hpet_assign_irq(struct hpet_e
 {
     unsigned int vector;
 
+    if ( ch->vector )
+        return 0;
+
     vector = assign_irq_vector(AUTO_ASSIGN_IRQ);
     if ( (int)vector < 0 )
         return vector;