Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Jan 2019 22:10:31 +0000 (UTC)
From:      Justin Hibbits <jhibbits@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r342976 - head/sys/powerpc/pseries
Message-ID:  <201901122210.x0CMAVDI001535@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201901122210.x0CMAVDI001535>