Author: jhibbits Date: Sat Jan 12 22:10:31 2019 New Revision: 342976 URL: https://svnweb.freebsd.org/changeset/base/342976
Log: 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. Modified: head/sys/powerpc/pseries/xics.c Modified: head/sys/powerpc/pseries/xics.c ============================================================================== --- head/sys/powerpc/pseries/xics.c Sat Jan 12 22:05:42 2019 (r342975) +++ head/sys/powerpc/pseries/xics.c Sat Jan 12 22:10:31 2019 (r342976) @@ -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; + /* XXX: super inefficient */ + for (i = 0; i < sc->nintvecs; i++) { + if (sc->intvecs[i].irq == xirr) + break; + } + KASSERT(i < sc->nintvecs, ("Unmapped XIRR")); } - 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, voi 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, _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"