> On Sep 7, 2023, at 2:37 AM, Colin Percival <cperc...@freebsd.org> wrote:
> 
> The branch main has been updated by cperciva:
> 
> URL: 
> https://cgit.FreeBSD.org/src/commit/?id=1926d5cef6eaa1302024d6471271c930ad65f9b2
> 
> commit 1926d5cef6eaa1302024d6471271c930ad65f9b2
> Author:     Colin Percival <cperc...@freebsd.org>
> AuthorDate: 2023-09-05 23:47:57 +0000
> Commit:     Colin Percival <cperc...@freebsd.org>
> CommitDate: 2023-09-06 18:36:36 +0000
> 
>    init_main: Record completed SYSINITs
> 
>    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.

> 
>    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(-)
> 
> 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);
> 
> /*
> - * 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 =
> +    STAILQ_HEAD_INITIALIZER(sysinit_done_list);

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

> 
> /*
>  * 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 = STAILQ_FIRST(&sysinit_list)) != NULL) {
>               STAILQ_REMOVE_HEAD(&sysinit_list, next);
> +             STAILQ_INSERT_TAIL(&sysinit_done_list, sip, next);

Ditto.

> 
>               if (sip->subsystem == 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


Reply via email to