Skip to contentSkip to conversation

x86/IO-APIC: fix setting of destinations

PATCH In review Jan Beulich 3 participants 3 messages Nov 19, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/IO-APIC: fix setting of destinations

In commit a85da715cf ("x86/IO-APIC: adjust setting of destinations") I made a pretty blatant mistake: get_apic_id() can be used there only when running APICs in physical mode. For both flat and clustered modes the change was wrong, causing different kinds of boot problems on affected systems. Don't revert that change though, but use TARGET_CPUS (equaling cpu_online_map, and with there only being a single online CPU fulfilling the original commits intention).

xen/arch/x86/io_apic.c +1 -1
@@ -1039,7 +1039,7 @@ static void __init setup_IO_APIC_irqs(vo
                 disable_8259A_irq(irq_to_desc(irq));
 
             desc = irq_to_desc(irq);
-            SET_DEST(entry, logical, get_apic_id());
+            SET_DEST(entry, logical, cpu_mask_to_apicid(TARGET_CPUS));
             spin_lock_irqsave(&ioapic_lock, flags);
             __ioapic_write_entry(apic, pin, 0, entry);
             set_native_irq_info(irq, TARGET_CPUS);

x86/IO-APIC: fix setting of destinations

In commit a85da715cf ("x86/IO-APIC: adjust setting of destinations") I made a pretty blatant mistake: get_apic_id() can be used there only when running APICs in physical mode. For both flat and clustered modes the change was wrong, causing different kinds of boot problems on affected systems. Don't revert that change though, but use TARGET_CPUS (equaling cpu_online_map, and with there only being a single online CPU fulfilling the original commits intention).

xen/arch/x86/io_apic.c +1 -1
@@ -1039,7 +1039,7 @@ static void __init setup_IO_APIC_irqs(vo
                 disable_8259A_irq(irq_to_desc(irq));
 
             desc = irq_to_desc(irq);
-            SET_DEST(entry, logical, get_apic_id());
+            SET_DEST(entry, logical, cpu_mask_to_apicid(TARGET_CPUS));
             spin_lock_irqsave(&ioapic_lock, flags);
             __ioapic_write_entry(apic, pin, 0, entry);
             set_native_irq_info(irq, TARGET_CPUS);

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

Tested-by on v1 1/1
#1 lore raw
Quoted 13 lines · Jan Beulich

In commit a85da715cf ("x86/IO-APIC: adjust setting of destinations") I made a pretty blatant mistake: get_apic_id() can be used there only when running APICs in physical mode. For both flat and clustered modes the change was wrong, causing different kinds of boot problems on affected systems. Don't revert that change though, but use TARGET_CPUS (equaling cpu_online_map, and with there only being a single online CPU fulfilling the original commits intention).

xen/arch/x86/io_apic.c static void __init setup_IO_APIC_irqs(vo · line 1045

Quoted 8 lines
xen/arch/x86/io_apic.c +1 -1
@@ -1039,7 +1039,7 @@ static void __init setup_IO_APIC_irqs(vo
                  disable_8259A_irq(irq_to_desc(irq));
 
              desc = irq_to_desc(irq);
-            SET_DEST(entry, logical, get_apic_id());
+            SET_DEST(entry, logical, cpu_mask_to_apicid(TARGET_CPUS));
              spin_lock_irqsave(&ioapic_lock, flags);
              __ioapic_write_entry(apic, pin, 0, entry);
              set_native_irq_info(irq, TARGET_CPUS);

(One of our systems started failing and I bisected it yesterday to a85da715c but didn't get to actually debug it. Now I don't need to).

-boris

Reviewed-by on v1 1/1
#2 lore raw
In reply to Jan Beulich
Quoted 9 lines · Jan Beulich

In commit a85da715cf ("x86/IO-APIC: adjust setting of destinations") I made a pretty blatant mistake: get_apic_id() can be used there only when running APICs in physical mode. For both flat and clustered modes the change was wrong, causing different kinds of boot problems on affected systems. Don't revert that change though, but use TARGET_CPUS (equaling cpu_online_map, and with there only being a single online CPU fulfilling the original commits intention).

I also missed that while reviewing.

Quoted 15 lines
xen/arch/x86/io_apic.c +1 -1
@@ -1039,7 +1039,7 @@ static void __init setup_IO_APIC_irqs(vo
                 disable_8259A_irq(irq_to_desc(irq));
 
             desc = irq_to_desc(irq);
-            SET_DEST(entry, logical, get_apic_id());
+            SET_DEST(entry, logical, cpu_mask_to_apicid(TARGET_CPUS));
             spin_lock_irqsave(&ioapic_lock, flags);
             __ioapic_write_entry(apic, pin, 0, entry);
             set_native_irq_info(irq, TARGET_CPUS);