SCSI, SMP, and Supermicro, problems!

Richy Kim rkim at sandvine.com
Wed Oct 1 11:57:57 PDT 2003


David,
patch below basically compacts or unswizzles the pin-pin to 1:1 mapping when
the mptable is parsed, thus saving a few interrupts... 

This is more so a workaround than a solution to FreeBSD's (4.x and older)
historical interrupt limits.

-r.

Index: mp_machdep.c
===================================================================
RCS file: /cvs/src/sys/i386/i386/mp_machdep.c,v
retrieving revision 1.115.2.12
retrieving revision 1.115.2.12.1000.1
diff -u -r1.115.2.12 -r1.115.2.12.1000.1
--- mp_machdep.c        28 Apr 2002 18:18:17 -0000      1.115.2.12
+++ mp_machdep.c        14 Aug 2003 15:33:01 -0000      1.115.2.12.1000.1
@@ -27,6 +27,7 @@

 #include "opt_cpu.h"
 #include "opt_user_ldt.h"
+#include "opt_unswizzle.h"

 #ifdef SMP
 #include <machine/smptests.h>
@@ -1404,6 +1405,30 @@
 int_entry(int_entry_ptr entry, int intr)
 {
        int apic;
+#ifdef UNSWIZZLE
+       int src_pin = entry->src_bus_irq & 3;
+       int dst_pin = entry->dst_apic_int & 3;
+       int slot = (entry->src_bus_irq >> 2) & 0x1f;
+
+       if (src_pin != dst_pin) {
+               /* not 1:1 mapping, possibly a swizzled (pci) device behind
a bridge */
+
+               /* swizzle src pin based pci 1.1 spec */
+               int pin = (src_pin + slot) % 4;
+
+               if (pin == dst_pin) {
+                   /* BIOS has properly swizzled/rotated pins for this
device
+                    * However, we will un-swizzle the pin to get 1:1
mapping.
+                    * This will save us some interrupts in cases where all
+                    * slots behind the bridge use only first two pins
anyways.
+                    */
+
+                   printf("IOAPIC: unswizzle intpin %d",
entry->dst_apic_int);
+                   entry->dst_apic_int = (entry->dst_apic_int & ~3) +
src_pin;
+                   printf(" --> %d\n", entry->dst_apic_int);
+               }
+       }
+#endif

        io_apic_ints[intr].int_type = entry->int_type;
        io_apic_ints[intr].int_flags = entry->int_flags;


-----Original Message-----
From: Don Bowman 
Sent: Wednesday, October 01, 2003 2:42 PM
To: 'David Raistrick'; Richy Kim; freebsd-scsi at freebsd.org
Cc: freebsd-hardware at freebsd.org
Subject: RE: SCSI, SMP, and Supermicro, problems! 


From: David Raistrick [mailto:drais at wow.atlasta.net]
> > Since the above, I rebooted the system again...and for the 
> first time I
> > have a running SMP system.
> 
> ...which degraded into being hung right after I sent the last email:
> 
> ahd0: Timedout SCB already complete. Interrupts may not be 
> functioning.
> 
> ahd0: Timedout SCB already complete. Interrupts may not be 
> functioning.
> 

Well, another suggestion has to do with the use of the APIC
and interrupt rotation.

I can't recall the exact details of this, we ended up adding
a 'options         UNSWIZZLE' to the kernel. This was specifically
for stuff behind a bridge. The problem was that BSD only
allowed 24 interrupts, and we had run out.

--don


More information about the freebsd-hardware mailing list