Print this page
OS-2366 ddi_periodic_add(9F) is entirely rubbish


   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
  24  */
  25 
  26 /*      Copyright (c) 1988 AT&T     */
  27 /*        All Rights Reserved   */
  28 




  29 #include <sys/types.h>
  30 #include <sys/param.h>
  31 #include <sys/sysmacros.h>
  32 #include <sys/pcb.h>
  33 #include <sys/systm.h>
  34 #include <sys/signal.h>
  35 #include <sys/cred.h>
  36 #include <sys/user.h>
  37 #include <sys/vfs.h>
  38 #include <sys/vnode.h>
  39 #include <sys/proc.h>
  40 #include <sys/time.h>
  41 #include <sys/file.h>
  42 #include <sys/priocntl.h>
  43 #include <sys/procset.h>
  44 #include <sys/disp.h>
  45 #include <sys/callo.h>
  46 #include <sys/callb.h>
  47 #include <sys/debug.h>
  48 #include <sys/conf.h>
  49 #include <sys/bootconf.h>
  50 #include <sys/utsname.h>
  51 #include <sys/cmn_err.h>
  52 #include <sys/vmparam.h>
  53 #include <sys/modctl.h>
  54 #include <sys/vm.h>
  55 #include <sys/callb.h>
  56 #include <sys/ddi_timer.h>
  57 #include <sys/kmem.h>
  58 #include <sys/vmem.h>
  59 #include <sys/cpuvar.h>
  60 #include <sys/cladm.h>
  61 #include <sys/corectl.h>
  62 #include <sys/exec.h>
  63 #include <sys/syscall.h>
  64 #include <sys/reboot.h>
  65 #include <sys/task.h>
  66 #include <sys/exacct.h>
  67 #include <sys/autoconf.h>
  68 #include <sys/errorq.h>
  69 #include <sys/class.h>
  70 #include <sys/stack.h>
  71 #include <sys/brand.h>
  72 #include <sys/mmapobj.h>
  73 
  74 #include <vm/as.h>
  75 #include <vm/seg_kmem.h>
  76 #include <sys/dc_ki.h>


 398          * to prevent kadmin() from disrupting this work. In particular,
 399          * we don't want kadmin() to bring the system down while we are
 400          * trying to start it up.
 401          */
 402         mutex_enter(&ualock);
 403 
 404         /*
 405          * Setup root lgroup and leaf lgroup for CPU 0
 406          */
 407         lgrp_init(LGRP_INIT_STAGE2);
 408 
 409         /*
 410          * Once 'startup()' completes, the thread_reaper() daemon would be
 411          * created(in thread_init()). After that, it is safe to create threads
 412          * that could exit. These exited threads will get reaped.
 413          */
 414         startup();
 415         segkmem_gc();
 416         callb_init();
 417         cbe_init_pre(); /* x86 must initialize gethrtimef before timer_init */
 418         timer_init();   /* timer must be initialized before cyclic starts */
 419         cbe_init();
 420         callout_init(); /* callout table MUST be init'd after cyclics */
 421         clock_tick_init_pre();
 422         clock_init();
 423 
 424 #if defined(__x86)
 425         /*
 426          * The progressbar thread uses cv_reltimedwait() and hence needs to be
 427          * started after the callout mechanism has been initialized.
 428          */
 429         progressbar_start();
 430 #endif
 431         /*
 432          * On some platforms, clkinitf() changes the timing source that
 433          * gethrtime_unscaled() uses to generate timestamps.  cbe_init() calls
 434          * clkinitf(), so re-initialize the microstate counters after the
 435          * timesource has been chosen.
 436          */
 437         init_mstate(&t0, LMS_SYSTEM);
 438         init_cpu_mstate(CPU, CMS_SYSTEM);




   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
  24  */
  25 
  26 /*      Copyright (c) 1988 AT&T     */
  27 /*        All Rights Reserved   */
  28 
  29 /*
  30  * Copyright (c) 2013, Joyent, Inc. All rights reserved.
  31  */
  32 
  33 #include <sys/types.h>
  34 #include <sys/param.h>
  35 #include <sys/sysmacros.h>
  36 #include <sys/pcb.h>
  37 #include <sys/systm.h>
  38 #include <sys/signal.h>
  39 #include <sys/cred.h>
  40 #include <sys/user.h>
  41 #include <sys/vfs.h>
  42 #include <sys/vnode.h>
  43 #include <sys/proc.h>
  44 #include <sys/time.h>
  45 #include <sys/file.h>
  46 #include <sys/priocntl.h>
  47 #include <sys/procset.h>
  48 #include <sys/disp.h>
  49 #include <sys/callo.h>
  50 #include <sys/callb.h>
  51 #include <sys/debug.h>
  52 #include <sys/conf.h>
  53 #include <sys/bootconf.h>
  54 #include <sys/utsname.h>
  55 #include <sys/cmn_err.h>
  56 #include <sys/vmparam.h>
  57 #include <sys/modctl.h>
  58 #include <sys/vm.h>
  59 #include <sys/callb.h>
  60 #include <sys/ddi_periodic.h>
  61 #include <sys/kmem.h>
  62 #include <sys/vmem.h>
  63 #include <sys/cpuvar.h>
  64 #include <sys/cladm.h>
  65 #include <sys/corectl.h>
  66 #include <sys/exec.h>
  67 #include <sys/syscall.h>
  68 #include <sys/reboot.h>
  69 #include <sys/task.h>
  70 #include <sys/exacct.h>
  71 #include <sys/autoconf.h>
  72 #include <sys/errorq.h>
  73 #include <sys/class.h>
  74 #include <sys/stack.h>
  75 #include <sys/brand.h>
  76 #include <sys/mmapobj.h>
  77 
  78 #include <vm/as.h>
  79 #include <vm/seg_kmem.h>
  80 #include <sys/dc_ki.h>


 402          * to prevent kadmin() from disrupting this work. In particular,
 403          * we don't want kadmin() to bring the system down while we are
 404          * trying to start it up.
 405          */
 406         mutex_enter(&ualock);
 407 
 408         /*
 409          * Setup root lgroup and leaf lgroup for CPU 0
 410          */
 411         lgrp_init(LGRP_INIT_STAGE2);
 412 
 413         /*
 414          * Once 'startup()' completes, the thread_reaper() daemon would be
 415          * created(in thread_init()). After that, it is safe to create threads
 416          * that could exit. These exited threads will get reaped.
 417          */
 418         startup();
 419         segkmem_gc();
 420         callb_init();
 421         cbe_init_pre(); /* x86 must initialize gethrtimef before timer_init */
 422         ddi_periodic_init();
 423         cbe_init();
 424         callout_init(); /* callout table MUST be init'd after cyclics */
 425         clock_tick_init_pre();
 426         clock_init();
 427 
 428 #if defined(__x86)
 429         /*
 430          * The progressbar thread uses cv_reltimedwait() and hence needs to be
 431          * started after the callout mechanism has been initialized.
 432          */
 433         progressbar_start();
 434 #endif
 435         /*
 436          * On some platforms, clkinitf() changes the timing source that
 437          * gethrtime_unscaled() uses to generate timestamps.  cbe_init() calls
 438          * clkinitf(), so re-initialize the microstate counters after the
 439          * timesource has been chosen.
 440          */
 441         init_mstate(&t0, LMS_SYSTEM);
 442         init_cpu_mstate(CPU, CMS_SYSTEM);