From owner-svn-src-all@freebsd.org Sat Jan 12 22:10:32 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 90A2C14A0883; Sat, 12 Jan 2019 22:10:32 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 38088722B6; Sat, 12 Jan 2019 22:10:32 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 27B9A978A; Sat, 12 Jan 2019 22:10:32 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x0CMAWu4001536; Sat, 12 Jan 2019 22:10:32 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0CMAVDI001535; Sat, 12 Jan 2019 22:10:31 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201901122210.x0CMAVDI001535@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 12 Jan 2019 22:10:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r342976 - head/sys/powerpc/pseries X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/pseries X-SVN-Commit-Revision: 342976 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 38088722B6 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Jan 2019 22:10:32 -0000 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,