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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/os/clock.c
          +++ new/usr/src/uts/common/os/clock.c
↓ open down ↓ 15 lines elided ↑ open up ↑
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
  22   22  /*        All Rights Reserved   */
  23   23  
  24   24  /*
  25   25   * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
  26      - * Copyright (c) 2011, Joyent, Inc. All rights reserved.
       26 + * Copyright (c) 2013, Joyent, Inc.  All rights reserved.
  27   27   */
  28   28  
  29   29  #include <sys/param.h>
  30   30  #include <sys/t_lock.h>
  31   31  #include <sys/types.h>
  32   32  #include <sys/tuneable.h>
  33   33  #include <sys/sysmacros.h>
  34   34  #include <sys/systm.h>
  35   35  #include <sys/cpuvar.h>
  36   36  #include <sys/lgrp.h>
↓ open down ↓ 903 lines elided ↑ open up ↑
 940  940                          THREAD_TRANSITION(t);
 941  941                          setfrontdq(t);
 942  942                  }
 943  943                  thread_unlock(t);
 944  944          }
 945  945  }
 946  946  
 947  947  void
 948  948  clock_init(void)
 949  949  {
 950      -        cyc_handler_t clk_hdlr, timer_hdlr, lbolt_hdlr;
      950 +        cyc_handler_t clk_hdlr, lbolt_hdlr;
 951  951          cyc_time_t clk_when, lbolt_when;
 952  952          int i, sz;
 953  953          intptr_t buf;
 954  954  
 955  955          /*
 956  956           * Setup handler and timer for the clock cyclic.
 957  957           */
 958  958          clk_hdlr.cyh_func = (cyc_func_t)clock;
 959  959          clk_hdlr.cyh_level = CY_LOCK_LEVEL;
 960  960          clk_hdlr.cyh_arg = NULL;
 961  961  
 962  962          clk_when.cyt_when = 0;
 963  963          clk_when.cyt_interval = nsec_per_tick;
 964  964  
 965  965          /*
 966      -         * cyclic_timer is dedicated to the ddi interface, which
 967      -         * uses the same clock resolution as the system one.
 968      -         */
 969      -        timer_hdlr.cyh_func = (cyc_func_t)cyclic_timer;
 970      -        timer_hdlr.cyh_level = CY_LOCK_LEVEL;
 971      -        timer_hdlr.cyh_arg = NULL;
 972      -
 973      -        /*
 974  966           * The lbolt cyclic will be reprogramed to fire at a nsec_per_tick
 975  967           * interval to satisfy performance needs of the DDI lbolt consumers.
 976  968           * It is off by default.
 977  969           */
 978  970          lbolt_hdlr.cyh_func = (cyc_func_t)lbolt_cyclic;
 979  971          lbolt_hdlr.cyh_level = CY_LOCK_LEVEL;
 980  972          lbolt_hdlr.cyh_arg = NULL;
 981  973  
 982  974          lbolt_when.cyt_interval = nsec_per_tick;
 983  975  
↓ open down ↓ 54 lines elided ↑ open up ↑
1038 1030                  lbolt_when.cyt_when = CY_INFINITY;
1039 1031                  lbolt_hybrid = lbolt_event_driven;
1040 1032          }
1041 1033  
1042 1034          /*
1043 1035           * Grab cpu_lock and install all three cyclics.
1044 1036           */
1045 1037          mutex_enter(&cpu_lock);
1046 1038  
1047 1039          clock_cyclic = cyclic_add(&clk_hdlr, &clk_when);
1048      -        ddi_timer_cyclic = cyclic_add(&timer_hdlr, &clk_when);
1049 1040          lb_info->id.lbi_cyclic_id = cyclic_add(&lbolt_hdlr, &lbolt_when);
1050 1041  
1051 1042          mutex_exit(&cpu_lock);
1052 1043  }
1053 1044  
1054 1045  /*
1055 1046   * Called before calcloadavg to get 10-sec moving loadavg together
1056 1047   */
1057 1048  
1058 1049  static int
↓ open down ↓ 1617 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX