From nobody Thu May 16 01:56:41 2024 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 4VftW45sFtz5KGMp; Thu, 16 May 2024 01:56:48 +0000 (UTC) (envelope-from zlei@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VftW45JgLz4ZXk; Thu, 16 May 2024 01:56:48 +0000 (UTC) (envelope-from zlei@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715824608; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=dXmqhrT2DFKIOMAA3s9jmoVdE3tlFlfZhLw/OOF/FNc=; b=UdAo5xcyA2ZU73vRLtyfI+Lu7lB4tEPz1IlX9/zbM43tfd6mgZHRyWa6Vru2T8C7cmEnuh oJcaCKkpRXqBJlVxASwkoMmR9rvp8x4SoZshdizD7eteU5Nv5YQB9oh4hH8rCiLJhnWRPQ nMmF4HqXXuxEqWEwzPjrfnfCkSH2C4dQaygBj1HZIJe00DkfBGcbpBtk/ETletJ5eCA8Qy Me0t6c3GVo0cRNl3076efxTpyolNVZEoVnZIOcHVhpdDK2/B/+naVwu4nUP6V2dxqPZABe mNEgkxzIuoLlnyqj7cxF/YncdXTESPxod3xcHhkOxKJcsrmN1/KJ/OcOvP7dcQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715824608; a=rsa-sha256; cv=none; b=DrZSfIzxFOFj/4TSjr2WVFLTTMaImrXhRaXZ4cAS1AIdhnO40FlWluQm+kHqz9PwxK1UEY AHCCfWDCGmMPXPCmdXk2s1YEnFlCMsNu7DAtkfDQxmcTlZWl4QLUTfMQ2KQPSR54oGYJO1 OQAOvv1a8OfbykbuK6PmcaATu+y8LU0dIgOdEcRemagKY8vWFIV8jOkkrjpMsxBHGLk9J+ viAW81rNSYwCFxq73blKC4wjgXqoEiavik/tuhJzimsfYYKvRAeb9uIC/03qHYSGZsbzfj Pf0bIMfXfAakTHMO1L+c8hDorM/d47dEbtdMogm6DlBc6tBhqYhtQK8WHe2+CA== 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=1715824608; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=dXmqhrT2DFKIOMAA3s9jmoVdE3tlFlfZhLw/OOF/FNc=; b=EcmZK5vE+LWv3zjtn871r3oEG+Y/LLNilNl1NMYyLEF+xvgemT6aVNIgLiss+rGbHtQDdX AGmvre324mJIbK8dj1yhompVD99DN6H+GkfGaTF+T9vpBdKF6KakVwsmX4VHEdG8jTF8UL +A+jJyO5D0hnwnUotAqNa2bgT+aEiXUmHEoKor6R9+/FlI2jvaHoBpPDcC3x6tYQv/8Ip0 8QhOQ6HsLvuPY4tfc230WlwBlANZ8islvEs3PA3RloyaAFsezFEiyI69Umpc2d51+ikV4p ADOTOWn9SxF65eRv3P8lbh64wP957+5+0gBUBeujVxWRThJQVEJ5XrmyECPbyg== Received: from smtpclient.apple (ns1.oxydns.net [45.32.91.63]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: zlei/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4VftW3103nzV8k; Thu, 16 May 2024 01:56:46 +0000 (UTC) (envelope-from zlei@FreeBSD.org) From: Zhenlei Huang Message-Id: <93753D00-CA46-4777-AB98-6C2A30906DB7@FreeBSD.org> Content-Type: multipart/alternative; boundary="Apple-Mail=_50E54440-1DA0-4055-88E2-92A7499DE7EE" 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.8\)) Subject: Re: git: b827afb9e3a7 - releng/14.1 - Revert "intrng: switch from MAXCPU to mp_ncpus" Date: Thu, 16 May 2024 09:56:41 +0800 In-Reply-To: <68191B25-A5CB-48CE-BD17-F5E7F95CF052@freebsd.org> Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-branches@freebsd.org" To: Mike Karels References: <202405151635.44FGZxAS021246@gitrepo.freebsd.org> <88AD738C-4E2C-430D-8AE1-D1C7A633B977@FreeBSD.org> <68191B25-A5CB-48CE-BD17-F5E7F95CF052@freebsd.org> X-Mailer: Apple Mail (2.3696.120.41.1.8) --Apple-Mail=_50E54440-1DA0-4055-88E2-92A7499DE7EE Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On May 16, 2024, at 9:23 AM, Mike Karels wrote: >=20 > On 15 May 2024, at 19:58, Zhenlei Huang wrote: >=20 >>> On May 16, 2024, at 12:35 AM, Mike Karels = wrote: >>>=20 >>> The branch releng/14.1 has been updated by karels: >>>=20 >>> URL: = https://cgit.FreeBSD.org/src/commit/?id=3Db827afb9e3a7aaaa2da7d101c46881c6= 46d4df2f >>>=20 >>> commit b827afb9e3a7aaaa2da7d101c46881c646d4df2f >>> Author: Mike Karels >>> AuthorDate: 2024-05-14 22:44:58 +0000 >>> Commit: Mike Karels >>> CommitDate: 2024-05-15 16:35:38 +0000 >>>=20 >>> Revert "intrng: switch from MAXCPU to mp_ncpus" >>>=20 >>> This reverts commit b4d11915c73f199501672b278be86e1f63790036. >>> This is a direct commit to stable/14. The change breaks booting >>> on older Raspberry Pi 4's, although that works on main. The cause >>=20 >> Emm, I think this revert affects other arch also. Does this have = large impact ? If yes, and only >> older Paspberry Pi 4 is to be fixed, why not add conditional compile = #if directive for Paspberry Pi 4 >> instead ? >=20 > That won't help with installations. We use one GENERIC config for = arm64. On > the other hand, arm64 has 32K counters for interrupts and only 1K for = IPIs > (with this reverted and MAXCPU at 1024), so this isn't that big an = increment. > arm has MAXCPU of 4; riscv has 16. This reversion makes the outcome = the same > as on 14.0. Thanks for the explanation. >=20 >> For amd64 the MAXCPU has been bumped from 256 to 1024 [1]. That is = large IMO. >=20 > This change does not affect amd64 or i386, just systems with INTRNG = (arm, > arm64, and riscv). So the change is only significant on arm64. Sorry I was not aware that INTRNG is arm, arm64 and riscv only. >=20 > Mike >=20 >> 1. 9051987e40c5 amd64: Bump MAXCPU to 1024 (from 256) >>=20 >>> is unknown. The original commit should be redone on stable/14 >>> if/when it catches up with main. >>>=20 >>> (cherry picked from commit = 3e627553bbd791a4f73eaeea2c2d795fd4e0ee70) >>>=20 >>> Approved-by: re (cperciva) >>> --- >>> sys/kern/subr_intr.c | 22 +++++++++++----------- >>> 1 file changed, 11 insertions(+), 11 deletions(-) >>>=20 >>> diff --git a/sys/kern/subr_intr.c b/sys/kern/subr_intr.c >>> index 49fe20cdc890..6535c42f2404 100644 >>> --- a/sys/kern/subr_intr.c >>> +++ b/sys/kern/subr_intr.c >>> @@ -175,11 +175,11 @@ intr_irq_init(void *dummy __unused) >>>=20 >>> /* >>> * - 2 counters for each I/O interrupt. >>> - * - mp_maxid + 1 counters for each IPI counters for SMP. >>> + * - MAXCPU counters for each IPI counters for SMP. >>> */ >>> nintrcnt =3D intr_nirq * 2; >>> #ifdef SMP >>> - nintrcnt +=3D INTR_IPI_COUNT * (mp_maxid + 1); >>> + nintrcnt +=3D INTR_IPI_COUNT * MAXCPU; >>> #endif >>>=20 >>> intrcnt =3D mallocarray(nintrcnt, sizeof(u_long), M_INTRNG, >>> @@ -312,18 +312,18 @@ intr_ipi_setup_counters(const char *name) >>> mtx_lock(&isrc_table_lock); >>>=20 >>> /* >>> - * 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. >>> + * 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. >>> */ >>> - bit_ffc_area(intrcnt_bitmap, nintrcnt, mp_maxid + 1, &index); >>> + bit_ffc_area(intrcnt_bitmap, nintrcnt, MAXCPU, &index); >>> if (index =3D=3D -1) >>> panic("Failed to allocate %d counters. Array = exhausted?", >>> - mp_maxid + 1); >>> - bit_nset(intrcnt_bitmap, index, index + mp_maxid); >>> - for (i =3D 0; i < mp_maxid + 1; i++) { >>> + MAXCPU); >>> + bit_nset(intrcnt_bitmap, index, index + MAXCPU - 1); >>> + for (i =3D 0; i < MAXCPU; i++) { >>> snprintf(str, INTRNAME_LEN, "cpu%d:%s", i, name); >>> intrcnt_setname(str, index + i); >>> } >>=20 >> Best regards, >> Zhenlei --Apple-Mail=_50E54440-1DA0-4055-88E2-92A7499DE7EE Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii

On May 16, 2024, at 9:23 AM, Mike Karels <karels@freebsd.org> = wrote:

On 15 May 2024, at 19:58, Zhenlei Huang wrote:

On May 16, 2024, at = 12:35 AM, Mike Karels <karels@FreeBSD.org> wrote:

The branch releng/14.1 has been updated by karels:

URL: https://cgit.FreeBSD.org/src/commit/?id=3Db827afb9e3a7aaaa2da7d= 101c46881c646d4df2f

commit = b827afb9e3a7aaaa2da7d101c46881c646d4df2f
Author: =     Mike Karels <karels@FreeBSD.org>
AuthorDate: = 2024-05-14 22:44:58 +0000
Commit: =     Mike Karels <karels@FreeBSD.org>
CommitDate: = 2024-05-15 16:35:38 +0000

  Revert = "intrng: switch from MAXCPU to mp_ncpus"

  This reverts commit = b4d11915c73f199501672b278be86e1f63790036.
  This = is a direct commit to stable/14.  The change breaks booting
  on older Raspberry Pi 4's, although that works on = main.  The cause

Emm, I = think this revert affects other arch also. Does this have large impact ? = If yes, and only
older Paspberry Pi 4 is to be fixed, why = not add conditional compile #if directive for Paspberry Pi 4
instead ?

That won't help with installations.  We use one GENERIC = config for arm64.  On
the other hand, arm64 has 32K counters for interrupts and = only 1K for IPIs
(with this reverted and MAXCPU at 1024), so this isn't that = big an increment.
arm has MAXCPU of 4; riscv has 16.  This reversion makes = the outcome the same
as on 14.0.

Thanks for the explanation.


For = amd64 the MAXCPU has been bumped from 256 to 1024 [1]. That is large = IMO.

This change does not affect amd64 or i386, just systems with = INTRNG (arm,
arm64, and = riscv).  So the change is only significant on arm64.

Sorry = I was not aware that INTRNG is arm, arm64 and riscv only.


= Mike

1. = 9051987e40c5 amd64: Bump MAXCPU to 1024 (from 256)

  is unknown. =  The original commit should be redone on stable/14
  if/when it catches up with main.

  (cherry picked from commit = 3e627553bbd791a4f73eaeea2c2d795fd4e0ee70)

  Approved-by:    re (cperciva)
---
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 = 49fe20cdc890..6535c42f2404 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.
-  * - mp_maxid + 1 counters = for each IPI counters for SMP.
+  * - MAXCPU counters for = each IPI counters for SMP.
 */
nintrcnt = =3D intr_nirq * 2;
#ifdef SMP
- nintrcnt = +=3D INTR_IPI_COUNT * (mp_maxid + 1);
+ nintrcnt = +=3D INTR_IPI_COUNT * MAXCPU;
#endif

= intrcnt =3D 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 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.
+  * 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.
 */
- = bit_ffc_area(intrcnt_bitmap, nintrcnt, mp_maxid + 1, = &index);
+ bit_ffc_area(intrcnt_bitmap, = nintrcnt, MAXCPU, &index);
if (index = =3D=3D -1)
panic("Failed to allocate %d = counters. Array exhausted?",
-     mp_maxid = + 1);
- bit_nset(intrcnt_bitmap, index, index + mp_maxid);
- = for (i =3D 0; i < mp_maxid + 1; i++) {
+     MAXCPU);+ = bit_nset(intrcnt_bitmap, index, index + MAXCPU - 1);
+ = for (i =3D 0; i < MAXCPU; i++) {
= snprintf(str, INTRNAME_LEN, "cpu%d:%s", i, name);
= = intrcnt_setname(str, index + i);
}

Best regards,
Zhenlei


= --Apple-Mail=_50E54440-1DA0-4055-88E2-92A7499DE7EE--