Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Sep 2023 09:12:22 +0800
From:      Zhenlei Huang <zlei@FreeBSD.org>
To:        Colin Percival <cperciva@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-main@freebsd.org" <dev-commits-src-main@FreeBSD.org>
Subject:   Re: git: 1926d5cef6ea - main - init_main: Record completed SYSINITs
Message-ID:  <5BC96D9F-E4C4-4D34-B7B3-41576AD296DA@FreeBSD.org>
In-Reply-To: <202309061837.386Ib5AK086264@gitrepo.freebsd.org>
References:  <202309061837.386Ib5AK086264@gitrepo.freebsd.org>

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


> On Sep 7, 2023, at 2:37 AM, Colin Percival <cperciva@FreeBSD.org> =
wrote:
>=20
> The branch main has been updated by cperciva:
>=20
> URL: =
https://cgit.FreeBSD.org/src/commit/?id=3D1926d5cef6eaa1302024d6471271c930=
ad65f9b2
>=20
> commit 1926d5cef6eaa1302024d6471271c930ad65f9b2
> Author:     Colin Percival <cperciva@FreeBSD.org>
> AuthorDate: 2023-09-05 23:47:57 +0000
> Commit:     Colin Percival <cperciva@FreeBSD.org>
> CommitDate: 2023-09-06 18:36:36 +0000
>=20
>    init_main: Record completed SYSINITs
>=20
>    When removing them from sysinit_list, append them to =
sysinit_done_list;
>    print this list from 'show sysinit' along with the list of future
>    sysinits.

So the `sysinit_done_list` is for DDB only.

>=20
>    Reviewed by:    jhb, gallatin (previous version)
>    MFC after:      1 week
>    Differential Revision:  https://reviews.freebsd.org/D41749
> ---
> sys/kern/init_main.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>=20
> diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
> index a6b327339c80..a8df9f84a29a 100644
> --- a/sys/kern/init_main.c
> +++ b/sys/kern/init_main.c
> @@ -163,9 +163,11 @@ SYSINIT(placeholder, SI_SUB_DUMMY, SI_ORDER_ANY, =
NULL, NULL);
> SET_DECLARE(sysinit_set, struct sysinit);
>=20
> /*
> - * The sysinit list itself.  Items are removed as they are run.
> + * The sysinit lists.  Items are moved to sysinit_done_list when =
done.
>  */
> static STAILQ_HEAD(sysinitlist, sysinit) sysinit_list;
> +static struct sysinitlist sysinit_done_list =3D
> +    STAILQ_HEAD_INITIALIZER(sysinit_done_list);

Then it should be wrapped around with #ifdef DDB and #endif

>=20
> /*
>  * Compare two sysinits; return -1, 0, or 1 if a comes before, at the =
same time
> @@ -289,6 +291,7 @@ mi_startup(void)
> 	 */
> 	while ((sip =3D STAILQ_FIRST(&sysinit_list)) !=3D NULL) {
> 		STAILQ_REMOVE_HEAD(&sysinit_list, next);
> +		STAILQ_INSERT_TAIL(&sysinit_done_list, sip, next);

Ditto.

>=20
> 		if (sip->subsystem =3D=3D SI_SUB_DUMMY)
> 			continue;	/* skip dummy task(s)*/
> @@ -904,6 +907,11 @@ DB_SHOW_COMMAND_FLAGS(sysinit, db_show_sysinit, =
DB_CMD_MEMSAFE)
> 	db_printf("SYSINIT vs Name(Ptr)\n");
> 	db_printf("  Subsystem  Order\n");
> 	db_printf("  Function(Name)(Arg)\n");
> +	STAILQ_FOREACH(sip, &sysinit_done_list, next) {
> +		db_show_print_syinit(sip, true);
> +		if (db_pager_quit)
> +			return;
> +	}
> 	STAILQ_FOREACH(sip, &sysinit_list, next) {
> 		db_show_print_syinit(sip, true);
> 		if (db_pager_quit)

Best regards,
Zhenlei




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5BC96D9F-E4C4-4D34-B7B3-41576AD296DA>