powerpc/pseries: Cache the IPI vector to avoid the common static lookup

The IPI vector is static, and happens to be the most common interrupt by far
on some systems.  Rather than searching for the interrupt every time, cache
the index.

This appears to yield a small performance boost, of about 8% reduction in
buildworld times, on my POWER9 system, when paired with r342975.
This commit is contained in:
Justin Hibbits 2019-01-12 22:10:31 +00:00
parent 56505ec016
commit 431d31e0bf
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=342976

View file

@ -126,6 +126,7 @@ struct xicp_softc {
/* XXX: inefficient -- hash table? tree? */
struct xicp_intvec intvecs[256];
int nintvecs;
int ipi_vec;
bool xics_emu;
};
@ -398,15 +399,17 @@ xicp_dispatch(device_t dev, struct trapframe *tf)
else
phyp_hcall(H_IPI, (uint64_t)(PCPU_GET(hwref)),
0xff);
i = sc->ipi_vec;
} else {
/* XXX: super inefficient */
for (i = 0; i < sc->nintvecs; i++) {
if (sc->intvecs[i].irq == xirr)
break;
}
KASSERT(i < sc->nintvecs, ("Unmapped XIRR"));
}
/* XXX: super inefficient */
for (i = 0; i < sc->nintvecs; i++) {
if (sc->intvecs[i].irq == xirr)
break;
}
KASSERT(i < sc->nintvecs, ("Unmapped XIRR"));
powerpc_dispatch_intr(sc->intvecs[i].vector, tf);
}
}
@ -437,9 +440,11 @@ xicp_enable(device_t dev, u_int irq, u_int vector, void **priv)
intr->cpu = cpu;
mb();
/* IPIs are also enabled */
if (irq == MAX_XICP_IRQS)
/* IPIs are also enabled. Stash off the vector index */
if (irq == MAX_XICP_IRQS) {
sc->ipi_vec = intr - sc->intvecs;
return;
}
if (rtas_exists()) {
rtas_call_method(sc->ibm_set_xive, 3, 1, irq, cpu,