xref: /onnv-gate/usr/src/uts/common/disp/ts_dptbl.c (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24*0Sstevel@tonic-gate  * Use is subject to license terms.
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate 
27*0Sstevel@tonic-gate /*	Copyright (c) 1990, 1991 UNIX System Laboratories, Inc.	*/
28*0Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T	*/
29*0Sstevel@tonic-gate /*	  All Rights Reserved  	*/
30*0Sstevel@tonic-gate 
31*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
32*0Sstevel@tonic-gate 
33*0Sstevel@tonic-gate #include <sys/proc.h>
34*0Sstevel@tonic-gate #include <sys/priocntl.h>
35*0Sstevel@tonic-gate #include <sys/class.h>
36*0Sstevel@tonic-gate #include <sys/disp.h>
37*0Sstevel@tonic-gate #include <sys/ts.h>
38*0Sstevel@tonic-gate #include <sys/tspriocntl.h>
39*0Sstevel@tonic-gate #include <sys/modctl.h>
40*0Sstevel@tonic-gate 
41*0Sstevel@tonic-gate /*
42*0Sstevel@tonic-gate  * The purpose of this file is to allow a user to make their own
43*0Sstevel@tonic-gate  * ts_dptbl. The contents of this file should be included in the
44*0Sstevel@tonic-gate  * ts_dptbl(4) man page with proper instructions for making
45*0Sstevel@tonic-gate  * and replacing the TS_DPTBL.kmod in modules/sched. This was the
46*0Sstevel@tonic-gate  * only way to provide functionality equivalent to the mkboot/cunix
47*0Sstevel@tonic-gate  * method in SVr4 without having the utilities mkboot/cunix in
48*0Sstevel@tonic-gate  * SunOS/Svr4.
49*0Sstevel@tonic-gate  * It is recommended that the system calls be used to change the time
50*0Sstevel@tonic-gate  * quantums instead of re-building the module.
51*0Sstevel@tonic-gate  * There are also other tunable time sharing parameters in here also
52*0Sstevel@tonic-gate  * that used to be in param.c
53*0Sstevel@tonic-gate  */
54*0Sstevel@tonic-gate 
55*0Sstevel@tonic-gate extern int ts_dispatch_extended;
56*0Sstevel@tonic-gate 
57*0Sstevel@tonic-gate static struct modlmisc modlmisc = {
58*0Sstevel@tonic-gate 	&mod_miscops, "Time sharing dispatch table"
59*0Sstevel@tonic-gate };
60*0Sstevel@tonic-gate 
61*0Sstevel@tonic-gate static struct modlinkage modlinkage = {
62*0Sstevel@tonic-gate 	MODREV_1, &modlmisc, 0
63*0Sstevel@tonic-gate };
64*0Sstevel@tonic-gate 
65*0Sstevel@tonic-gate int
_init()66*0Sstevel@tonic-gate _init()
67*0Sstevel@tonic-gate {
68*0Sstevel@tonic-gate 	return (mod_install(&modlinkage));
69*0Sstevel@tonic-gate }
70*0Sstevel@tonic-gate 
71*0Sstevel@tonic-gate int
_info(struct modinfo * modinfop)72*0Sstevel@tonic-gate _info(struct modinfo *modinfop)
73*0Sstevel@tonic-gate {
74*0Sstevel@tonic-gate 	return (mod_info(&modlinkage, modinfop));
75*0Sstevel@tonic-gate }
76*0Sstevel@tonic-gate 
77*0Sstevel@tonic-gate #define	TSGPUP0	0	/* Global priority for TS user priority 0 */
78*0Sstevel@tonic-gate #define	TSGPKP0	60	/* Global priority for TS kernel priority 0 */
79*0Sstevel@tonic-gate 
80*0Sstevel@tonic-gate /*
81*0Sstevel@tonic-gate  * array of global priorities used by ts procs sleeping or
82*0Sstevel@tonic-gate  * running in kernel mode after sleep
83*0Sstevel@tonic-gate  */
84*0Sstevel@tonic-gate 
85*0Sstevel@tonic-gate pri_t config_ts_kmdpris[] = {
86*0Sstevel@tonic-gate 	TSGPKP0,    TSGPKP0+1,  TSGPKP0+2,  TSGPKP0+3,
87*0Sstevel@tonic-gate 	TSGPKP0+4,  TSGPKP0+5,  TSGPKP0+6,  TSGPKP0+7,
88*0Sstevel@tonic-gate 	TSGPKP0+8,  TSGPKP0+9,  TSGPKP0+10, TSGPKP0+11,
89*0Sstevel@tonic-gate 	TSGPKP0+12, TSGPKP0+13, TSGPKP0+14, TSGPKP0+15,
90*0Sstevel@tonic-gate 	TSGPKP0+16, TSGPKP0+17, TSGPKP0+18, TSGPKP0+19,
91*0Sstevel@tonic-gate 	TSGPKP0+20, TSGPKP0+21, TSGPKP0+22, TSGPKP0+23,
92*0Sstevel@tonic-gate 	TSGPKP0+24, TSGPKP0+25, TSGPKP0+26, TSGPKP0+27,
93*0Sstevel@tonic-gate 	TSGPKP0+28, TSGPKP0+29, TSGPKP0+30, TSGPKP0+31,
94*0Sstevel@tonic-gate 	TSGPKP0+32, TSGPKP0+33, TSGPKP0+34, TSGPKP0+35,
95*0Sstevel@tonic-gate 	TSGPKP0+36, TSGPKP0+37, TSGPKP0+38, TSGPKP0+39
96*0Sstevel@tonic-gate };
97*0Sstevel@tonic-gate 
98*0Sstevel@tonic-gate tsdpent_t	config_ts_dptbl[] = {
99*0Sstevel@tonic-gate 
100*0Sstevel@tonic-gate /*	glbpri		qntm	tqexp	slprt	mxwt	lwt */
101*0Sstevel@tonic-gate 
102*0Sstevel@tonic-gate 	TSGPUP0+0,	20,	 0,	50,	    0,	50,
103*0Sstevel@tonic-gate 	TSGPUP0+1,	20,	 0,	50,	    0,	50,
104*0Sstevel@tonic-gate 	TSGPUP0+2,	20,	 0,	50,	    0,	50,
105*0Sstevel@tonic-gate 	TSGPUP0+3,	20,	 0,	50,	    0,	50,
106*0Sstevel@tonic-gate 	TSGPUP0+4,	20,	 0,	50,	    0,	50,
107*0Sstevel@tonic-gate 	TSGPUP0+5,	20,	 0,	50,	    0,	50,
108*0Sstevel@tonic-gate 	TSGPUP0+6,	20,	 0,	50,	    0,	50,
109*0Sstevel@tonic-gate 	TSGPUP0+7,	20,	 0,	50,	    0,	50,
110*0Sstevel@tonic-gate 	TSGPUP0+8,	20,	 0,	50,	    0,	50,
111*0Sstevel@tonic-gate 	TSGPUP0+9,	20,	 0,	50,	    0,	50,
112*0Sstevel@tonic-gate 	TSGPUP0+10,	16,	 0,	51,	    0,	51,
113*0Sstevel@tonic-gate 	TSGPUP0+11,	16,	 1,	51,	    0,	51,
114*0Sstevel@tonic-gate 	TSGPUP0+12,	16,	 2,	51,	    0,	51,
115*0Sstevel@tonic-gate 	TSGPUP0+13,	16,	 3,	51,	    0,	51,
116*0Sstevel@tonic-gate 	TSGPUP0+14,	16,	 4,	51,	    0,	51,
117*0Sstevel@tonic-gate 	TSGPUP0+15,	16,	 5,	51,	    0,	51,
118*0Sstevel@tonic-gate 	TSGPUP0+16,	16,	 6,	51,	    0,	51,
119*0Sstevel@tonic-gate 	TSGPUP0+17,	16,	 7,	51,	    0,	51,
120*0Sstevel@tonic-gate 	TSGPUP0+18,	16,	 8,	51,	    0,	51,
121*0Sstevel@tonic-gate 	TSGPUP0+19,	16,	 9,	51,	    0,	51,
122*0Sstevel@tonic-gate 	TSGPUP0+20,	12,	10,	52,	    0,	52,
123*0Sstevel@tonic-gate 	TSGPUP0+21,	12,	11,	52,	    0,	52,
124*0Sstevel@tonic-gate 	TSGPUP0+22,	12,	12,	52,	    0,	52,
125*0Sstevel@tonic-gate 	TSGPUP0+23,	12,	13,	52,	    0,	52,
126*0Sstevel@tonic-gate 	TSGPUP0+24,	12,	14,	52,	    0,	52,
127*0Sstevel@tonic-gate 	TSGPUP0+25,	12,	15,	52,	    0,	52,
128*0Sstevel@tonic-gate 	TSGPUP0+26,	12,	16,	52,	    0,	52,
129*0Sstevel@tonic-gate 	TSGPUP0+27,	12,	17,	52,	    0,	52,
130*0Sstevel@tonic-gate 	TSGPUP0+28,	12,	18,	52,	    0,	52,
131*0Sstevel@tonic-gate 	TSGPUP0+29,	12,	19,	52,	    0,	52,
132*0Sstevel@tonic-gate 	TSGPUP0+30,	 8,	20,	53,	    0,	53,
133*0Sstevel@tonic-gate 	TSGPUP0+31,	 8,	21,	53,	    0,	53,
134*0Sstevel@tonic-gate 	TSGPUP0+32,	 8,	22,	53,	    0,	53,
135*0Sstevel@tonic-gate 	TSGPUP0+33,	 8,	23,	53,	    0,	53,
136*0Sstevel@tonic-gate 	TSGPUP0+34,	 8,	24,	53,	    0,	53,
137*0Sstevel@tonic-gate 	TSGPUP0+35,	 8,	25,	54,	    0,	54,
138*0Sstevel@tonic-gate 	TSGPUP0+36,	 8,	26,	54,	    0,	54,
139*0Sstevel@tonic-gate 	TSGPUP0+37,	 8,	27,	54,	    0,	54,
140*0Sstevel@tonic-gate 	TSGPUP0+38,	 8,	28,	54,	    0,	54,
141*0Sstevel@tonic-gate 	TSGPUP0+39,	 8,	29,	54,	    0,	54,
142*0Sstevel@tonic-gate 	TSGPUP0+40,	 4,	30,	55,	    0,	55,
143*0Sstevel@tonic-gate 	TSGPUP0+41,	 4,	31,	55,	    0,	55,
144*0Sstevel@tonic-gate 	TSGPUP0+42,	 4,	32,	55,	    0,	55,
145*0Sstevel@tonic-gate 	TSGPUP0+43,	 4,	33,	55,	    0,	55,
146*0Sstevel@tonic-gate 	TSGPUP0+44,	 4,	34,	55,	    0,	55,
147*0Sstevel@tonic-gate 	TSGPUP0+45,	 4,	35,	56,	    0,	56,
148*0Sstevel@tonic-gate 	TSGPUP0+46,	 4,	36,	57,	    0,	57,
149*0Sstevel@tonic-gate 	TSGPUP0+47,	 4,	37,	58,	    0,	58,
150*0Sstevel@tonic-gate 	TSGPUP0+48,	 4,	38,	58,	    0,	58,
151*0Sstevel@tonic-gate 	TSGPUP0+49,	 4,	39,	58,	    0,	59,
152*0Sstevel@tonic-gate 	TSGPUP0+50,	 4,	40,	58,	    0,	59,
153*0Sstevel@tonic-gate 	TSGPUP0+51,	 4,	41,	58,	    0,	59,
154*0Sstevel@tonic-gate 	TSGPUP0+52,	 4,	42,	58,	    0,	59,
155*0Sstevel@tonic-gate 	TSGPUP0+53,	 4,	43,	58,	    0,	59,
156*0Sstevel@tonic-gate 	TSGPUP0+54,	 4,	44,	58,	    0,	59,
157*0Sstevel@tonic-gate 	TSGPUP0+55,	 4,	45,	58,	    0,	59,
158*0Sstevel@tonic-gate 	TSGPUP0+56,	 4,	46,	58,	    0,	59,
159*0Sstevel@tonic-gate 	TSGPUP0+57,	 4,	47,	58,	    0,	59,
160*0Sstevel@tonic-gate 	TSGPUP0+58,	 4,	48,	58,	    0,	59,
161*0Sstevel@tonic-gate 	TSGPUP0+59,	 2,	49,	59,	32000,	59
162*0Sstevel@tonic-gate };
163*0Sstevel@tonic-gate 
164*0Sstevel@tonic-gate /*
165*0Sstevel@tonic-gate  * config_ts_dptbl_server[] is an alternate dispatch table that may
166*0Sstevel@tonic-gate  * deliver better performance on large server configurations.
167*0Sstevel@tonic-gate  * This table must be the same size as the default table, config_ts_dptbl.
168*0Sstevel@tonic-gate  */
169*0Sstevel@tonic-gate tsdpent_t	config_ts_dptbl_server[] = {
170*0Sstevel@tonic-gate 
171*0Sstevel@tonic-gate /*	glbpri		qntm	tqexp	slprt	mxwt	lwt */
172*0Sstevel@tonic-gate 
173*0Sstevel@tonic-gate 	TSGPUP0+0,	40,	 0,	 1,	    2,	40,
174*0Sstevel@tonic-gate 	TSGPUP0+1,	38,	 0,	 2,	    2,	40,
175*0Sstevel@tonic-gate 	TSGPUP0+2,	38,	 1,	 3,	    2,	40,
176*0Sstevel@tonic-gate 	TSGPUP0+3,	38,	 1,	 4,	    2,	40,
177*0Sstevel@tonic-gate 	TSGPUP0+4,	38,	 2,	 5,	    2,	40,
178*0Sstevel@tonic-gate 	TSGPUP0+5,	38,	 2,	 6,	    2,	40,
179*0Sstevel@tonic-gate 	TSGPUP0+6,	38,	 3,	 7,	    2,	40,
180*0Sstevel@tonic-gate 	TSGPUP0+7,	38,	 3,	 8,	    2,	40,
181*0Sstevel@tonic-gate 	TSGPUP0+8,	38,	 4,	 9,	    2,	40,
182*0Sstevel@tonic-gate 	TSGPUP0+9,	38,	 4,	10,	    2,	40,
183*0Sstevel@tonic-gate 	TSGPUP0+10,	38,	 5,	11,	    2,	40,
184*0Sstevel@tonic-gate 	TSGPUP0+11,	38,	 5,	12,	    2,	40,
185*0Sstevel@tonic-gate 	TSGPUP0+12,	38,	 6,	13,	    2,	40,
186*0Sstevel@tonic-gate 	TSGPUP0+13,	38,	 6,	14,	    2,	40,
187*0Sstevel@tonic-gate 	TSGPUP0+14,	38,	 7,	15,	    2,	40,
188*0Sstevel@tonic-gate 	TSGPUP0+15,	38,	 7,	16,	    2,	40,
189*0Sstevel@tonic-gate 	TSGPUP0+16,	38,	 8,	17,	    2,	40,
190*0Sstevel@tonic-gate 	TSGPUP0+17,	38,	 8,	18,	    2,	40,
191*0Sstevel@tonic-gate 	TSGPUP0+18,	38,	 9,	19,	    2,	40,
192*0Sstevel@tonic-gate 	TSGPUP0+19,	38,	 9,	20,	    2,	40,
193*0Sstevel@tonic-gate 	TSGPUP0+20,	36,	10,	21,	    2,	40,
194*0Sstevel@tonic-gate 	TSGPUP0+21,	36,	11,	22,	    2,	40,
195*0Sstevel@tonic-gate 	TSGPUP0+22,	36,	12,	23,	    2,	40,
196*0Sstevel@tonic-gate 	TSGPUP0+23,	36,	13,	24,	    2,	40,
197*0Sstevel@tonic-gate 	TSGPUP0+24,	36,	14,	25,	    2,	40,
198*0Sstevel@tonic-gate 	TSGPUP0+25,	36,	15,	26,	    2,	40,
199*0Sstevel@tonic-gate 	TSGPUP0+26,	36,	16,	27,	    2,	40,
200*0Sstevel@tonic-gate 	TSGPUP0+27,	36,	17,	28,	    2,	40,
201*0Sstevel@tonic-gate 	TSGPUP0+28,	36,	18,	29,	    2,	40,
202*0Sstevel@tonic-gate 	TSGPUP0+29,	36,	19,	30,	    2,	40,
203*0Sstevel@tonic-gate 	TSGPUP0+30,	36,	20,	31,	    2,	40,
204*0Sstevel@tonic-gate 	TSGPUP0+31,	36,	21,	32,	    2,	40,
205*0Sstevel@tonic-gate 	TSGPUP0+32,	36,	22,	33,	    2,	40,
206*0Sstevel@tonic-gate 	TSGPUP0+33,	36,	23,	34,	    2,	40,
207*0Sstevel@tonic-gate 	TSGPUP0+34,	36,	24,	35,	    2,	40,
208*0Sstevel@tonic-gate 	TSGPUP0+35,	36,	25,	36,	    2,	40,
209*0Sstevel@tonic-gate 	TSGPUP0+36,	36,	26,	37,	    2,	40,
210*0Sstevel@tonic-gate 	TSGPUP0+37,	36,	27,	38,	    2,	40,
211*0Sstevel@tonic-gate 	TSGPUP0+38,	36,	28,	39,	    2,	40,
212*0Sstevel@tonic-gate 	TSGPUP0+39,	36,	29,	40,	    2,	40,
213*0Sstevel@tonic-gate 	TSGPUP0+40,	36,	30,	41,	    2,	41,
214*0Sstevel@tonic-gate 	TSGPUP0+41,	34,	31,	42,	    2,	42,
215*0Sstevel@tonic-gate 	TSGPUP0+42,	34,	32,	43,	    2,	43,
216*0Sstevel@tonic-gate 	TSGPUP0+43,	34,	33,	44,	    2,	44,
217*0Sstevel@tonic-gate 	TSGPUP0+44,	34,	34,	45,	    2,	45,
218*0Sstevel@tonic-gate 	TSGPUP0+45,	34,	35,	46,	    2,	46,
219*0Sstevel@tonic-gate 	TSGPUP0+46,	34,	36,	47,	    2,	47,
220*0Sstevel@tonic-gate 	TSGPUP0+47,	34,	37,	48,	    2,	48,
221*0Sstevel@tonic-gate 	TSGPUP0+48,	34,	38,	49,	    2,	49,
222*0Sstevel@tonic-gate 	TSGPUP0+49,	34,	39,	50,	    2,	50,
223*0Sstevel@tonic-gate 	TSGPUP0+50,	34,	40,	51,	    2,	51,
224*0Sstevel@tonic-gate 	TSGPUP0+51,	34,	41,	52,	    2,	52,
225*0Sstevel@tonic-gate 	TSGPUP0+52,	34,	42,	53,	    2,	53,
226*0Sstevel@tonic-gate 	TSGPUP0+53,	34,	43,	54,	    2,	54,
227*0Sstevel@tonic-gate 	TSGPUP0+54,	34,	44,	55,	    2,	55,
228*0Sstevel@tonic-gate 	TSGPUP0+55,	34,	45,	56,	    2,	56,
229*0Sstevel@tonic-gate 	TSGPUP0+56,	34,	46,	57,	    2,	57,
230*0Sstevel@tonic-gate 	TSGPUP0+57,	34,	47,	58,	    2,	58,
231*0Sstevel@tonic-gate 	TSGPUP0+58,	34,	48,	59,	    2,	59,
232*0Sstevel@tonic-gate 	TSGPUP0+59,	34,	49,	59,	    2,	59
233*0Sstevel@tonic-gate };
234*0Sstevel@tonic-gate 
235*0Sstevel@tonic-gate 
236*0Sstevel@tonic-gate 
237*0Sstevel@tonic-gate pri_t config_ts_maxumdpri = sizeof (config_ts_dptbl) / sizeof (tsdpent_t) - 1;
238*0Sstevel@tonic-gate 
239*0Sstevel@tonic-gate /*
240*0Sstevel@tonic-gate  * Return the address of config_ts_dptbl
241*0Sstevel@tonic-gate  */
242*0Sstevel@tonic-gate tsdpent_t *
ts_getdptbl()243*0Sstevel@tonic-gate ts_getdptbl()
244*0Sstevel@tonic-gate {
245*0Sstevel@tonic-gate 	/*
246*0Sstevel@tonic-gate 	 * If ts_dispatch_extended is -1, set it to 0x0
247*0Sstevel@tonic-gate 	 * to choose the default TS table.
248*0Sstevel@tonic-gate 	 */
249*0Sstevel@tonic-gate 	if (ts_dispatch_extended == -1)
250*0Sstevel@tonic-gate 		ts_dispatch_extended = 0;
251*0Sstevel@tonic-gate 
252*0Sstevel@tonic-gate 	/*
253*0Sstevel@tonic-gate 	 * If ts_dispatch_extended is non-zero, use the
254*0Sstevel@tonic-gate 	 * "large server style" TS dispatch table.
255*0Sstevel@tonic-gate 	 */
256*0Sstevel@tonic-gate 	if (ts_dispatch_extended)
257*0Sstevel@tonic-gate 		return (config_ts_dptbl_server);
258*0Sstevel@tonic-gate 	else
259*0Sstevel@tonic-gate 		return (config_ts_dptbl);
260*0Sstevel@tonic-gate }
261*0Sstevel@tonic-gate 
262*0Sstevel@tonic-gate /*
263*0Sstevel@tonic-gate  * Return the address of config_ts_kmdpris
264*0Sstevel@tonic-gate  */
265*0Sstevel@tonic-gate pri_t *
ts_getkmdpris()266*0Sstevel@tonic-gate ts_getkmdpris()
267*0Sstevel@tonic-gate {
268*0Sstevel@tonic-gate 	return (config_ts_kmdpris);
269*0Sstevel@tonic-gate }
270*0Sstevel@tonic-gate 
271*0Sstevel@tonic-gate /*
272*0Sstevel@tonic-gate  * Return the address of ts_maxumdpri
273*0Sstevel@tonic-gate  */
274*0Sstevel@tonic-gate pri_t
ts_getmaxumdpri()275*0Sstevel@tonic-gate ts_getmaxumdpri()
276*0Sstevel@tonic-gate {
277*0Sstevel@tonic-gate 	/*
278*0Sstevel@tonic-gate 	 * The config_ts_dptbl_server table must be the same size as
279*0Sstevel@tonic-gate 	 * the config_ts_dptbl table.
280*0Sstevel@tonic-gate 	 */
281*0Sstevel@tonic-gate 	/*LINTED*/
282*0Sstevel@tonic-gate 	ASSERT(sizeof (config_ts_dptbl) == sizeof (config_ts_dptbl_server));
283*0Sstevel@tonic-gate 	return (config_ts_maxumdpri);
284*0Sstevel@tonic-gate }
285