2003-08-26 00:48:55

by john stultz

[permalink] [raw]
Subject: linux-2.4.22_ioapic-affinity-fix_A0

Marcelo, All,

In set_ioapic_affinity() we take a cpu mask which we normally pass into
the apic. However, on xapics in clustered physical mode (ie: x440s) we
need to convert this mask into a physical apicid before sending it to
the apic. If clustered_apic_mode is XAPIC, this patch selects the lowest
cpu in the mask and routes the interrupts there. This avoids
timedoubling and other interrupt misdirection seen on x440s after
playing with /proc/irq/x/smp_affinity.

Please apply.

thanks
-john


diff -Nru a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c
--- a/arch/i386/kernel/io_apic.c Fri Aug 22 19:05:33 2003
+++ b/arch/i386/kernel/io_apic.c Fri Aug 22 19:05:33 2003
@@ -1365,6 +1365,13 @@
static void set_ioapic_affinity (unsigned int irq, unsigned long mask)
{
unsigned long flags;
+
+ /* pick a single cpu for clustered xapics */
+ if(clustered_apic_mode == CLUSTERED_APIC_XAPIC){
+ int cpu = ffs(mask)-1;
+ mask = cpu_to_physical_apicid(cpu);
+ }
+
/*
* Only the first 8 bits are valid.
*/