svn commit: r213305 - in head/sys: gdb kern sys

mdf at FreeBSD.org mdf at FreeBSD.org
Thu Sep 30 17:18:45 UTC 2010


On Thu, Sep 30, 2010 at 10:05 AM, Andriy Gapon <avg at freebsd.org> wrote:
> Author: avg
> Date: Thu Sep 30 17:05:23 2010
> New Revision: 213305
> URL: http://svn.freebsd.org/changeset/base/213305
>
> Log:
>  there must be only one SYSINIT with SI_SUB_RUN_SCHEDULER+SI_ORDER_ANY order
>
>  SI_SUB_RUN_SCHEDULER+SI_ORDER_ANY should only be used to call
>  scheduler() function which turns the initial thread into swapper proper
>  and thus there is no further SYSINIT processing.

Does this imply that scheduler() shouldn't be called from a sysinit at
all, and instead a hand-call after processing all the boot-time
sysinit's would make more sense?  This prevents the bug from
reoccuring, and also prevents bugs with adding a SYSINIT that runs at
SI_SUB_RUN_SCHEDULER + 1 time.

Thanks,
matthew

>  Other SYSINITs with SI_SUB_RUN_SCHEDULER+SI_ORDER_ANY may get ordered
>  after scheduler() and thus never executed.  That particular relative
>  order is semi-arbitrary.
>
>  Thus, change such places to use SI_ORDER_MIDDLE.
>  Also, use SI_ORDER_MIDDLE instead of correct, but less appealing,
>  SI_ORDER_ANY - 1.
>
>  MFC after:    1 week
>
> Modified:
>  head/sys/gdb/gdb_cons.c
>  head/sys/kern/kern_ntptime.c
>  head/sys/sys/sched.h
>
> Modified: head/sys/gdb/gdb_cons.c
> ==============================================================================
> --- head/sys/gdb/gdb_cons.c     Thu Sep 30 16:47:01 2010        (r213304)
> +++ head/sys/gdb/gdb_cons.c     Thu Sep 30 17:05:23 2010        (r213305)
> @@ -126,7 +126,7 @@ oktousecallout(void *data __unused)
>  {
>        calloutok = 1;
>  }
> -SYSINIT(gdbhack, SI_SUB_RUN_SCHEDULER, SI_ORDER_ANY, oktousecallout, NULL);
> +SYSINIT(gdbhack, SI_SUB_RUN_SCHEDULER, SI_ORDER_MIDDLE, oktousecallout, NULL);
>
>  static void
>  gdb_cnputc(struct consdev *cp, int c)
>
> Modified: head/sys/kern/kern_ntptime.c
> ==============================================================================
> --- head/sys/kern/kern_ntptime.c        Thu Sep 30 16:47:01 2010        (r213304)
> +++ head/sys/kern/kern_ntptime.c        Thu Sep 30 17:05:23 2010        (r213305)
> @@ -1035,5 +1035,5 @@ start_periodic_resettodr(void *arg __unu
>            periodic_resettodr, NULL);
>  }
>
> -SYSINIT(periodic_resettodr, SI_SUB_RUN_SCHEDULER, SI_ORDER_ANY - 1,
> +SYSINIT(periodic_resettodr, SI_SUB_RUN_SCHEDULER, SI_ORDER_MIDDLE,
>        start_periodic_resettodr, NULL);
>
> Modified: head/sys/sys/sched.h
> ==============================================================================
> --- head/sys/sys/sched.h        Thu Sep 30 16:47:01 2010        (r213304)
> +++ head/sys/sys/sched.h        Thu Sep 30 17:05:23 2010        (r213305)
> @@ -173,7 +173,7 @@ static void name ## _add_proc(void *dumm
>            #name, CTLTYPE_LONG|CTLFLAG_RD|CTLFLAG_MPSAFE,              \
>            ptr, 0, sysctl_dpcpu_long, "LU", descr);                    \
>  }                                                                      \
> -SYSINIT(name, SI_SUB_RUN_SCHEDULER, SI_ORDER_ANY, name ## _add_proc, NULL);
> +SYSINIT(name, SI_SUB_RUN_SCHEDULER, SI_ORDER_MIDDLE, name ## _add_proc, NULL);
>
>  #define        SCHED_STAT_DEFINE(name, descr)                                  \
>     DPCPU_DEFINE(unsigned long, name);                                 \
>


More information about the svn-src-head mailing list