Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 May 2024 09:56:41 +0800
From:      Zhenlei Huang <zlei@FreeBSD.org>
To:        Mike Karels <karels@freebsd.org>
Cc:        "src-committers@freebsd.org" <src-committers@FreeBSD.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@FreeBSD.org>, "dev-commits-src-branches@freebsd.org" <dev-commits-src-branches@FreeBSD.org>
Subject:   Re: git: b827afb9e3a7 - releng/14.1 - Revert "intrng: switch from MAXCPU to mp_ncpus"
Message-ID:  <93753D00-CA46-4777-AB98-6C2A30906DB7@FreeBSD.org>
In-Reply-To: <68191B25-A5CB-48CE-BD17-F5E7F95CF052@freebsd.org>
References:  <202405151635.44FGZxAS021246@gitrepo.freebsd.org> <88AD738C-4E2C-430D-8AE1-D1C7A633B977@FreeBSD.org> <68191B25-A5CB-48CE-BD17-F5E7F95CF052@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--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 <karels@freebsd.org> wrote:
>=20
> On 15 May 2024, at 19:58, Zhenlei Huang wrote:
>=20
>>> On May 16, 2024, at 12:35 AM, Mike Karels <karels@FreeBSD.org> =
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 <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
>>>=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

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Dus-ascii"></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: after-white-space;" class=3D""><br =
class=3D""><div><br class=3D""><blockquote type=3D"cite" class=3D""><div =
class=3D"">On May 16, 2024, at 9:23 AM, Mike Karels &lt;<a =
href=3D"mailto:karels@freebsd.org" class=3D"">karels@freebsd.org</a>&gt; =
wrote:</div><br class=3D"Apple-interchange-newline"><div class=3D""><meta =
charset=3D"UTF-8" class=3D""><span style=3D"caret-color: rgb(0, 0, 0); =
font-family: Menlo-Regular; font-size: 13px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none; float: none; display: inline !important;" =
class=3D"">On 15 May 2024, at 19:58, Zhenlei Huang wrote:</span><br =
style=3D"caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; =
font-size: 13px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none;" class=3D""><br style=3D"caret-color: rgb(0, 0, 0); font-family: =
Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none;" class=3D""><blockquote type=3D"cite" style=3D"font-family: =
Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; orphans: auto; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; =
-webkit-text-stroke-width: 0px; text-decoration: none;" =
class=3D""><blockquote type=3D"cite" class=3D"">On May 16, 2024, at =
12:35 AM, Mike Karels &lt;<a href=3D"mailto:karels@FreeBSD.org" =
class=3D"">karels@FreeBSD.org</a>&gt; wrote:<br class=3D""><br =
class=3D"">The branch releng/14.1 has been updated by karels:<br =
class=3D""><br class=3D"">URL: <a =
href=3D"https://cgit.FreeBSD.org/src/commit/?id=3Db827afb9e3a7aaaa2da7d101=
c46881c646d4df2f" =
class=3D"">https://cgit.FreeBSD.org/src/commit/?id=3Db827afb9e3a7aaaa2da7d=
101c46881c646d4df2f</a><br class=3D""><br class=3D"">commit =
b827afb9e3a7aaaa2da7d101c46881c646d4df2f<br class=3D"">Author: =
&nbsp;&nbsp;&nbsp;&nbsp;Mike Karels &lt;<a =
href=3D"mailto:karels@FreeBSD.org" =
class=3D"">karels@FreeBSD.org</a>&gt;<br class=3D"">AuthorDate: =
2024-05-14 22:44:58 +0000<br class=3D"">Commit: =
&nbsp;&nbsp;&nbsp;&nbsp;Mike Karels &lt;<a =
href=3D"mailto:karels@FreeBSD.org" =
class=3D"">karels@FreeBSD.org</a>&gt;<br class=3D"">CommitDate: =
2024-05-15 16:35:38 +0000<br class=3D""><br class=3D"">&nbsp;&nbsp;Revert =
"intrng: switch from MAXCPU to mp_ncpus"<br class=3D""><br =
class=3D"">&nbsp;&nbsp;This reverts commit =
b4d11915c73f199501672b278be86e1f63790036.<br class=3D"">&nbsp;&nbsp;This =
is a direct commit to stable/14. &nbsp;The change breaks booting<br =
class=3D"">&nbsp;&nbsp;on older Raspberry Pi 4's, although that works on =
main. &nbsp;The cause<br class=3D""></blockquote><br class=3D"">Emm, I =
think this revert affects other arch also. Does this have large impact ? =
If yes, and only<br class=3D"">older Paspberry Pi 4 is to be fixed, why =
not add conditional compile #if directive for Paspberry Pi 4<br =
class=3D"">instead ?<br class=3D""></blockquote><br style=3D"caret-color: =
rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px; font-style: =
normal; font-variant-caps: normal; font-weight: 400; letter-spacing: =
normal; text-align: start; text-indent: 0px; text-transform: none; =
white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
0); font-family: Menlo-Regular; font-size: 13px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none; float: none; display: inline !important;" =
class=3D"">That won't help with installations. &nbsp;We use one GENERIC =
config for arm64. &nbsp;On</span><br style=3D"caret-color: rgb(0, 0, 0); =
font-family: Menlo-Regular; font-size: 13px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
0); font-family: Menlo-Regular; font-size: 13px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none; float: none; display: inline !important;" =
class=3D"">the other hand, arm64 has 32K counters for interrupts and =
only 1K for IPIs</span><br style=3D"caret-color: rgb(0, 0, 0); =
font-family: Menlo-Regular; font-size: 13px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
0); font-family: Menlo-Regular; font-size: 13px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none; float: none; display: inline !important;" =
class=3D"">(with this reverted and MAXCPU at 1024), so this isn't that =
big an increment.</span><br style=3D"caret-color: rgb(0, 0, 0); =
font-family: Menlo-Regular; font-size: 13px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
0); font-family: Menlo-Regular; font-size: 13px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none; float: none; display: inline !important;" =
class=3D"">arm has MAXCPU of 4; riscv has 16. &nbsp;This reversion makes =
the outcome the same</span><br style=3D"caret-color: rgb(0, 0, 0); =
font-family: Menlo-Regular; font-size: 13px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
0); font-family: Menlo-Regular; font-size: 13px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none; float: none; display: inline !important;" =
class=3D"">as on 14.0.</span><br style=3D"caret-color: rgb(0, 0, 0); =
font-family: Menlo-Regular; font-size: 13px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;" class=3D""></div></blockquote><div><br =
class=3D""></div>Thanks for the explanation.</div><div><br =
class=3D""><blockquote type=3D"cite" class=3D""><div class=3D""><br =
style=3D"caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; =
font-size: 13px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none;" class=3D""><blockquote type=3D"cite" style=3D"font-family: =
Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; orphans: auto; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; =
-webkit-text-stroke-width: 0px; text-decoration: none;" class=3D"">For =
amd64 the MAXCPU has been bumped from 256 to 1024 [1]. That is large =
IMO.<br class=3D""></blockquote><br style=3D"caret-color: rgb(0, 0, 0); =
font-family: Menlo-Regular; font-size: 13px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
0); font-family: Menlo-Regular; font-size: 13px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none; float: none; display: inline !important;" =
class=3D"">This change does not affect amd64 or i386, just systems with =
INTRNG (arm,</span><br style=3D"caret-color: rgb(0, 0, 0); font-family: =
Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none;" class=3D""><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none; float: none; display: inline !important;" class=3D"">arm64, and =
riscv). &nbsp;So the change is only significant on arm64.</span><br =
style=3D"caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; =
font-size: 13px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none;" class=3D""></div></blockquote><div><br class=3D""></div><div>Sorry =
I was not aware that INTRNG is arm, arm64 and riscv only.</div><br =
class=3D""><blockquote type=3D"cite" class=3D""><div class=3D""><br =
style=3D"caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; =
font-size: 13px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none;" class=3D""><span class=3D"Apple-tab-span" style=3D"caret-color: =
rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px; font-style: =
normal; font-variant-caps: normal; font-weight: 400; letter-spacing: =
normal; text-align: start; text-indent: 0px; text-transform: none; =
white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;">	</span><span class=3D"Apple-tab-span" =
style=3D"caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; =
font-size: 13px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: pre; word-spacing: =
0px; -webkit-text-stroke-width: 0px; text-decoration: none;">	=
</span><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none; float: none; display: inline !important;" class=3D"">Mike</span><br =
style=3D"caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; =
font-size: 13px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none;" class=3D""><br style=3D"caret-color: rgb(0, 0, 0); font-family: =
Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none;" class=3D""><blockquote type=3D"cite" style=3D"font-family: =
Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; orphans: auto; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; =
-webkit-text-stroke-width: 0px; text-decoration: none;" class=3D"">1. =
9051987e40c5 amd64: Bump MAXCPU to 1024 (from 256)<br class=3D""><br =
class=3D""><blockquote type=3D"cite" class=3D"">&nbsp;&nbsp;is unknown. =
&nbsp;The original commit should be redone on stable/14<br =
class=3D"">&nbsp;&nbsp;if/when it catches up with main.<br class=3D""><br =
class=3D"">&nbsp;&nbsp;(cherry picked from commit =
3e627553bbd791a4f73eaeea2c2d795fd4e0ee70)<br class=3D""><br =
class=3D"">&nbsp;&nbsp;Approved-by: &nbsp;&nbsp;&nbsp;re (cperciva)<br =
class=3D"">---<br class=3D"">sys/kern/subr_intr.c | 22 =
+++++++++++-----------<br class=3D"">1 file changed, 11 insertions(+), =
11 deletions(-)<br class=3D""><br class=3D"">diff --git =
a/sys/kern/subr_intr.c b/sys/kern/subr_intr.c<br class=3D"">index =
49fe20cdc890..6535c42f2404 100644<br class=3D"">--- =
a/sys/kern/subr_intr.c<br class=3D"">+++ b/sys/kern/subr_intr.c<br =
class=3D"">@@ -175,11 +175,11 @@ intr_irq_init(void *dummy __unused)<br =
class=3D""><br class=3D""><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span>/*<br class=3D""><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-converted-space">&nbsp;</span>* - 2 counters for each I/O =
interrupt.<br class=3D"">-<span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span><span =
class=3D"Apple-converted-space">&nbsp;</span>* - mp_maxid + 1 counters =
for each IPI counters for SMP.<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-converted-space">&nbsp;</span>* - MAXCPU counters for =
each IPI counters for SMP.<br class=3D""><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span><span =
class=3D"Apple-converted-space">&nbsp;</span>*/<br class=3D""><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span>nintrcnt =
=3D intr_nirq * 2;<br class=3D"">#ifdef SMP<br class=3D"">-<span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span>nintrcnt =
+=3D INTR_IPI_COUNT * (mp_maxid + 1);<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span>nintrcnt =
+=3D INTR_IPI_COUNT * MAXCPU;<br class=3D"">#endif<br class=3D""><br =
class=3D""><span class=3D"Apple-tab-span" style=3D"white-space: pre;">	=
</span>intrcnt =3D mallocarray(nintrcnt, sizeof(u_long), M_INTRNG,<br =
class=3D"">@@ -312,18 +312,18 @@ intr_ipi_setup_counters(const char =
*name)<br class=3D""><span class=3D"Apple-tab-span" style=3D"white-space: =
pre;">	</span>mtx_lock(&amp;isrc_table_lock);<br class=3D""><br =
class=3D""><span class=3D"Apple-tab-span" style=3D"white-space: pre;">	=
</span>/*<br class=3D"">-<span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span><span =
class=3D"Apple-converted-space">&nbsp;</span>* We should never have a =
problem finding mp_maxid + 1 contiguous<br class=3D"">-<span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-converted-space">&nbsp;</span>* counters, in practice. =
Interrupts will be allocated sequentially<br class=3D"">-<span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-converted-space">&nbsp;</span>* during boot, so the array =
should fill from low to high index. Once<br class=3D"">-<span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-converted-space">&nbsp;</span>* reserved, the IPI =
counters will never be released. Similarly, we<br class=3D"">-<span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-converted-space">&nbsp;</span>* will not need to allocate =
more IPIs once the system is running.<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-converted-space">&nbsp;</span>* We should never have a =
problem finding MAXCPU contiguous counters,<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-converted-space">&nbsp;</span>* in practice. Interrupts =
will be allocated sequentially during boot,<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-converted-space">&nbsp;</span>* so the array should fill =
from low to high index. Once reserved, the<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-converted-space">&nbsp;</span>* IPI counters will never =
be released. Similarly, we will not need to<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-converted-space">&nbsp;</span>* allocate more IPIs once =
the system is running.<br class=3D""><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span><span =
class=3D"Apple-converted-space">&nbsp;</span>*/<br class=3D"">-<span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	=
</span>bit_ffc_area(intrcnt_bitmap, nintrcnt, mp_maxid + 1, =
&amp;index);<br class=3D"">+<span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span>bit_ffc_area(intrcnt_bitmap, =
nintrcnt, MAXCPU, &amp;index);<br class=3D""><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span>if (index =
=3D=3D -1)<br class=3D""><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span>panic("Failed to allocate %d =
counters. Array exhausted?",<br class=3D"">-<span class=3D"Apple-tab-span"=
 style=3D"white-space: pre;">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span><span =
class=3D"Apple-converted-space">&nbsp;</span>&nbsp;&nbsp;&nbsp;mp_maxid =
+ 1);<br class=3D"">-<span class=3D"Apple-tab-span" style=3D"white-space: =
pre;">	</span>bit_nset(intrcnt_bitmap, index, index + mp_maxid);<br =
class=3D"">-<span class=3D"Apple-tab-span" style=3D"white-space: pre;">	=
</span>for (i =3D 0; i &lt; mp_maxid + 1; i++) {<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-converted-space">&nbsp;</span>&nbsp;&nbsp;&nbsp;MAXCPU);<br=
 class=3D"">+<span class=3D"Apple-tab-span" style=3D"white-space: pre;">	=
</span>bit_nset(intrcnt_bitmap, index, index + MAXCPU - 1);<br =
class=3D"">+<span class=3D"Apple-tab-span" style=3D"white-space: pre;">	=
</span>for (i =3D 0; i &lt; MAXCPU; i++) {<br class=3D""><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	=
</span>snprintf(str, INTRNAME_LEN, "cpu%d:%s", i, name);<br =
class=3D""><span class=3D"Apple-tab-span" style=3D"white-space: pre;">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space: pre;">	=
</span>intrcnt_setname(str, index + i);<br class=3D""><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span>}<br =
class=3D""></blockquote><br class=3D"">Best regards,<br =
class=3D"">Zhenlei</blockquote></div></blockquote></div><br =
class=3D""><div class=3D"">
<div><br class=3D""></div></div></body></html>=

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?93753D00-CA46-4777-AB98-6C2A30906DB7>