From nobody Wed Sep 27 16:20:16 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RwhfT11V0z4vdp9; Wed, 27 Sep 2023 16:20:17 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RwhfT0PhNz3PqS; Wed, 27 Sep 2023 16:20:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1695831617; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=a3GNaoGaCjsLo6vAY4ZBjfqJ8Cngfno72OjUmZA/6Rk=; b=gJO7LDy/EYe12Wtjw0DNqWHmJrs3A/IE1bGsPu5XJAeJXfwFqfKLvcBIhgFzWoZk/HpGpy E01Hs4JjO87sDhTZbr+tkmNGij7lbfQP+bmcX8LjNdYgBeRm+mparFO2RBjaDUEeqNfPDV wgNxbnzqsDyRrtuis87zVWcM7+OBaUG5CyHxXWAfneHglmFvepUjsWS6H0d6fHaE68EV4G IK7f7zMgQ7vBHjFVRhfrVxRu0lrcFDYNnO016VKIX9TrlOHWYbsBkN53WbKeFCJScWsWza GBqJIdPZt+dYQxBD/W7CBeR4hz3q0MjZV2qXer4JS6blZ+HrVqRRXqR6ACRMsQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1695831617; a=rsa-sha256; cv=none; b=DFra4tyfxI6tnMw2vdLxRq6X5DjEKeB52oTTjPgRzvc7pp5zpm3LxOIN0Ii/0B8nGuJhDE OJWnjqS9MzCqxZM+Lvxsk99SEsxFSQbi6FJqYYYsywaQtT9yVWteOzAhxLitryfczRwaz7 WrxToj57tKXCOHo46Eta9zXcvQUxPRazzUOgdBYsEt5Y01uP3o31G+xaJrPaTy1dXxNlBN 5UilzZLJtiHIxqyA5lnTa+bvJgFJ+c9Sm+KQnqr11y2BRCdJuj0CLjbk3cEnQcmDOSTe26 SxsrCdSP9zXO55KoS0zk9+4V8hkM8Jh34m6zNCAguQFT5286QITD/w6B0e5OHw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1695831617; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=a3GNaoGaCjsLo6vAY4ZBjfqJ8Cngfno72OjUmZA/6Rk=; b=w45lw5nCsG+c5kGt/JLadDP5gsz6bfI4ogrAixvj5zoPQB6blKnX6cA7195ZRRvF74XiG3 2R5kSH5FwZ87qXuTS4NZviknIRknxzylSwx9u6HdX7pujjoYKawBm+uB16puR/q9XIvKn9 LUoIT+Wf5c2Xlqvy5iCGZugl/Jdm/Ejz9yhr3taXsw7dg8/hZzQpWh9NknlN9ndLLxtVWA xSt9lgG7IX8/v+VYY/vKZm5KO0Ir913M7AH67rh+Q0961rTy64n9WrdWHlO7aIf+ycFr3m drpPplY25Oz8ex+M7sOj4P8aEgn0GTFcEvggNtaoAE38OyUwYBmLPSmjaYiDQQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RwhfS69Whzm4Z; Wed, 27 Sep 2023 16:20:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 38RGKG07069246; Wed, 27 Sep 2023 16:20:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38RGKGoX069240; Wed, 27 Sep 2023 16:20:16 GMT (envelope-from git) Date: Wed, 27 Sep 2023 16:20:16 GMT Message-Id: <202309271620.38RGKGoX069240@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 2f0b059eeafc - main - intrng: switch from MAXCPU to mp_ncpus List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2f0b059eeafc545a4ab1835d6a5290e1e2ebb47f Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=2f0b059eeafc545a4ab1835d6a5290e1e2ebb47f commit 2f0b059eeafc545a4ab1835d6a5290e1e2ebb47f Author: Elliott Mitchell AuthorDate: 2023-09-26 17:06:04 +0000 Commit: Ed Maste CommitDate: 2023-09-27 16:19:37 +0000 intrng: switch from MAXCPU to mp_ncpus MAXCPU could be on the large side, while the hardware may not have many processors at all. As such only allocate counters for processors which actually exist, rather than always allocating for the maximum potentially allowed number. Reviewed by: markj, emaste Differential Revision: https://reviews.freebsd.org/D41462 --- sys/kern/subr_intr.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/sys/kern/subr_intr.c b/sys/kern/subr_intr.c index 6535c42f2404..49fe20cdc890 100644 --- a/sys/kern/subr_intr.c +++ b/sys/kern/subr_intr.c @@ -175,11 +175,11 @@ intr_irq_init(void *dummy __unused) /* * - 2 counters for each I/O interrupt. - * - MAXCPU counters for each IPI counters for SMP. + * - mp_maxid + 1 counters for each IPI counters for SMP. */ nintrcnt = intr_nirq * 2; #ifdef SMP - nintrcnt += INTR_IPI_COUNT * MAXCPU; + nintrcnt += INTR_IPI_COUNT * (mp_maxid + 1); #endif intrcnt = mallocarray(nintrcnt, sizeof(u_long), M_INTRNG, @@ -312,18 +312,18 @@ intr_ipi_setup_counters(const char *name) mtx_lock(&isrc_table_lock); /* - * We should never have a problem finding MAXCPU contiguous counters, - * in practice. Interrupts will be allocated sequentially during boot, - * so the array should fill from low to high index. Once reserved, the - * IPI counters will never be released. Similarly, we will not need to - * allocate more IPIs once the system is running. + * We should never have a problem finding mp_maxid + 1 contiguous + * counters, in practice. Interrupts will be allocated sequentially + * during boot, so the array should fill from low to high index. Once + * reserved, the IPI counters will never be released. Similarly, we + * will not need to allocate more IPIs once the system is running. */ - bit_ffc_area(intrcnt_bitmap, nintrcnt, MAXCPU, &index); + bit_ffc_area(intrcnt_bitmap, nintrcnt, mp_maxid + 1, &index); if (index == -1) panic("Failed to allocate %d counters. Array exhausted?", - MAXCPU); - bit_nset(intrcnt_bitmap, index, index + MAXCPU - 1); - for (i = 0; i < MAXCPU; i++) { + mp_maxid + 1); + bit_nset(intrcnt_bitmap, index, index + mp_maxid); + for (i = 0; i < mp_maxid + 1; i++) { snprintf(str, INTRNAME_LEN, "cpu%d:%s", i, name); intrcnt_setname(str, index + i); }