Skip to contentSkip to conversation

x86: fix off-by-one in nr_irqs_gsi calculation

PATCH In review Jan Beulich 3 participants 4 messages Jul 27, 2012 – Jul 30, 2012

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 x86: fix off-by-one in nr_irqs_gsi calculation

highest_gsi() returns the last valid GSI, not a count.

---
v2: Retain the (debatable) use of max() here.

xen/arch/x86/io_apic.c +1 -1
@@ -2531,7 +2531,7 @@ void __init init_ioapic_mappings(void)
         }
     }
 
-    nr_irqs_gsi = max(nr_irqs_gsi, highest_gsi());
+    nr_irqs_gsi = max(nr_irqs_gsi, highest_gsi() + 1);
 
     if ( max_gsi_irqs == 0 )
         max_gsi_irqs = nr_irqs ? nr_irqs / 8 : PAGE_SIZE;

x86: fix off-by-one in nr_irqs_gsi calculation

highest_gsi() returns the last valid GSI, not a count.

---
v2: Retain the (debatable) use of max() here.

xen/arch/x86/io_apic.c +1 -1
@@ -2531,7 +2531,7 @@ void __init init_ioapic_mappings(void)
         }
     }
 
-    nr_irqs_gsi = max(nr_irqs_gsi, highest_gsi());
+    nr_irqs_gsi = max(nr_irqs_gsi, highest_gsi() + 1);
 
     if ( max_gsi_irqs == 0 )
         max_gsi_irqs = nr_irqs ? nr_irqs / 8 : PAGE_SIZE;

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#1 lore raw

Acked!

Thanks Jan!

Quoted 21 lines · Jan Beulich

highest_gsi() returns the last valid GSI, not a count.

---
v2: Retain the (debatable) use of max() here.

xen/arch/x86/io_apic.c +1 -1
@@ -2531,7 +2531,7 @@ void __init init_ioapic_mappings(void)
         }
     }
 
-    nr_irqs_gsi = max(nr_irqs_gsi, highest_gsi());
+    nr_irqs_gsi = max(nr_irqs_gsi, highest_gsi() + 1);
 
     if ( max_gsi_irqs == 0 )
         max_gsi_irqs = nr_irqs ? nr_irqs / 8 : PAGE_SIZE;
Acked-by on v2 1/1
#2 lore raw
In reply to Jan Beulich
Quoted 3 lines · Jan Beulich

highest_gsi() returns the last valid GSI, not a count.

Quoted 21 lines

---
v2: Retain the (debatable) use of max() here.

xen/arch/x86/io_apic.c +1 -1
@@ -2531,7 +2531,7 @@ void __init init_ioapic_mappings(void)
         }
     }
 
-    nr_irqs_gsi = max(nr_irqs_gsi, highest_gsi());
+    nr_irqs_gsi = max(nr_irqs_gsi, highest_gsi() + 1);
 
     if ( max_gsi_irqs == 0 )
         max_gsi_irqs = nr_irqs ? nr_irqs / 8 : PAGE_SIZE;

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#3 lore raw
Quoted 8 lines
Quoted 1 line
Quoted 1 line · Keir Fraser
Quoted 3 lines · Jan Beulich

highest_gsi() returns the last valid GSI, not a count.

Could you please also put this into 4.x-testing?

Thanks, Jan

Quoted 21 lines
Quoted 21 lines

---
v2: Retain the (debatable) use of max() here.

xen/arch/x86/io_apic.c +1 -1
@@ -2531,7 +2531,7 @@ void __init init_ioapic_mappings(void)
         }
     }
 
-    nr_irqs_gsi = max(nr_irqs_gsi, highest_gsi());
+    nr_irqs_gsi = max(nr_irqs_gsi, highest_gsi() + 1);
 
     if ( max_gsi_irqs == 0 )
         max_gsi_irqs = nr_irqs ? nr_irqs / 8 : PAGE_SIZE;

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel