Subject: poor mc* performance revisited
To: None <port-macppc@netbsd.org>
From: Tim Kelly <hockey@dialectronics.com>
List: port-macppc
Date: 11/29/2004 23:14:34
How many people experiencing poor mc performance have a card in a PCI slot
as well? I ask because in tracking down the MP problem, I have found that
only two of the three interrupts in mace actually get mapped and masked
when one or more cards are in slots. This is because in extintr.c there is
some function overloading and when an irq is passed in for which a valid
virtual irq already exists, that virtual irq is returned. In the case of
mace, on my 7300 it has interrupts at 14, 2, and 3. However, as virq 1 goes
to the second CPU, and virq 2 goes to the extra ethernet card I have
installed, the irq 2 from mace does not get properly mapped in
intr_establish. When intr_establish requests mapirq for (hw) irq 2, it will
get returned 2, but that virq belongs to a different device. I don't use
mace, so I can't say about its performance.

I added a quick two lines of code to mapirq to print out where irqs get
mapped to.

int
mapirq(irq)
        int irq;
{
        int v;

        if (irq < 0 || irq >= ICU_LEN)
                panic("invalid irq %d", irq);
        if (virq[irq])
                return virq[irq];

        virq_max++;
        v = virq_max;
        if (v > HWIRQ_MAX)
                panic("virq overflow");

        printf("mapping irq %x to virq %x\n", irq, v);

        intrsources[v].is_hwirq = irq;
        virq[irq] = v;

        return v;
}

cpu1 at mainbus0: 604ev (Revision 2.2), ID 1
cpu1: HID0 8090c084<EMCP,DOZE,DPM,ICE,DCE,SGE,BHT>
mapping irq 1e to virq 1
bandit0 at mainbus0 (bootpath member)
pci0 at bandit0 bus 0
pci0: i/o space, memory space enabled
pchb0 at pci0 dev 11 function 0
pchb0: Apple Computer Bandit Host-PCI Bridge (rev. 0x03)
sip0 at pci0 dev 15 function 0: NatSemi DP83815 10/100 Ethernet, rev 00
mapping irq 19 to virq 2
sip0: interrupting at irq 25
sip0: Ethernet address 00:00:94:cb:df:4c
nsphyter0 at sip0 phy 0: DP83815 10/100 media interface, rev. 1
nsphyter0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
obio0 at pci0 dev 16 function 0 (bootpath member) : addr 0xf3000000
esp0 at obio0 offset 0x10000 irq 12 mapping irq c to virq 3
: NCR53C94, 25MHz, SCSI ID 7
scsibus0 at esp0: 8 targets, 8 luns per target
mc0 at obio0 offset 0x11000: irq 14,2,3 mapping irq 3 to virq 4
mapping irq e to virq 5
: address 00:a0:40:71:3e:86

Notice that mapirq kicks out before mapping irq 2 to a virq.

In the case in which there is only a single CPU, it looks like the PCI card
would get virq 1, and esp, the external SCSI, would get virq 2. That would
conflict with mace. If there are no cards in the PCI slots, esp gets virq
1, and virqs 2 and 3 go to mace's irqs 2 and 3, respectively. Irq 14 goes
to virq 4, and all is well.

So if you have a card in a PCI slot and have bad mace performance, remove
it and see if you still have this problem.

tim