xref: /titanic_50/usr/src/uts/common/conf/param.c (revision a1e9eea083a8f257157edb8a1efb5bbd300eb4bf)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
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  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #include <sys/types.h>
27 #include <sys/time.h>
28 #include <sys/param.h>
29 #include <sys/systm.h>
30 #include <sys/signal.h>
31 #include <sys/sysmacros.h>
32 #include <sys/cmn_err.h>
33 #include <sys/user.h>
34 #include <sys/proc.h>
35 #include <sys/task.h>
36 #include <sys/project.h>
37 #include <sys/klwp.h>
38 #include <sys/vnode.h>
39 #include <sys/file.h>
40 #include <sys/fcntl.h>
41 #include <sys/flock.h>
42 #include <sys/var.h>
43 #include <sys/stream.h>
44 #include <sys/strsubr.h>
45 #include <sys/conf.h>
46 #include <sys/class.h>
47 #include <sys/ts.h>
48 #include <sys/rt.h>
49 #include <sys/exec.h>
50 #include <sys/exechdr.h>
51 #include <sys/buf.h>
52 #include <sys/resource.h>
53 #include <vm/seg.h>
54 #include <vm/pvn.h>
55 #include <vm/seg_kmem.h>
56 #include <sys/vmparam.h>
57 #include <sys/machparam.h>
58 #include <sys/utsname.h>
59 #include <sys/kmem.h>
60 #include <sys/stack.h>
61 #include <sys/modctl.h>
62 #include <sys/fdbuffer.h>
63 #include <sys/cyclic_impl.h>
64 #include <sys/disp.h>
65 #include <sys/tuneable.h>
66 #include <sys/systeminfo.h>
67 
68 #include <sys/vmem.h>
69 #include <sys/clock.h>
70 #include <sys/serializer.h>
71 
72 /*
73  * The following few lines describe generic things that must be compiled
74  * into the booted executable (unix) rather than genunix or any other
75  * module because they're required by crash dump readers, etc.
76  */
77 struct modctl modules;		/* head of linked list of modules */
78 char *default_path;		/* default module loading path */
79 struct swapinfo *swapinfo;	/* protected by the swapinfo_lock */
80 proc_t *practive;		/* active process list */
81 uint_t nproc;			/* current number of processes */
82 proc_t p0;			/* process 0 */
83 struct plock p0lock;		/* p0's p_lock */
84 klwp_t lwp0;			/* t0's lwp */
85 task_t *task0p;			/* task 0 */
86 kproject_t *proj0p;		/* location of project 0 */
87 
88 /*
89  * The following are "implementation architecture" dependent constants made
90  * available here in the form of initialized data for use by "implementation
91  * architecture" independent modules. See machparam.h.
92  */
93 const unsigned long	_pagesize	= (unsigned long)PAGESIZE;
94 const unsigned int	_pageshift	= (unsigned int)PAGESHIFT;
95 const unsigned long	_pageoffset	= (unsigned long)PAGEOFFSET;
96 /*
97  * XXX - This value pagemask has to be a 64bit size because
98  * large file support uses this mask on offsets which are 64 bit size.
99  * using unsigned leaves the higher 32 bits value as zero thus
100  * corrupting offset calculations in the file system and VM.
101  */
102 const u_longlong_t	_pagemask	= (u_longlong_t)PAGEMASK;
103 const unsigned long	_mmu_pagesize	= (unsigned long)MMU_PAGESIZE;
104 const unsigned int	_mmu_pageshift	= (unsigned int)MMU_PAGESHIFT;
105 const unsigned long	_mmu_pageoffset	= (unsigned long)MMU_PAGEOFFSET;
106 const unsigned long	_mmu_pagemask	= (unsigned long)MMU_PAGEMASK;
107 uintptr_t		_kernelbase	= (uintptr_t)KERNELBASE;
108 uintptr_t		_userlimit	= (uintptr_t)USERLIMIT;
109 uintptr_t		_userlimit32	= (uintptr_t)USERLIMIT32;
110 const uintptr_t		_argsbase	= (uintptr_t)ARGSBASE;
111 const unsigned int	_diskrpm	= (unsigned int)DISKRPM;
112 const unsigned long	_pgthresh	= (unsigned long)PGTHRESH;
113 const unsigned int	_maxslp		= (unsigned int)MAXSLP;
114 const unsigned long	_maxhandspreadpages = (unsigned long)MAXHANDSPREADPAGES;
115 const int		_ncpu 		= (int)NCPU;
116 const unsigned long	_defaultstksz	= (unsigned long)DEFAULTSTKSZ;
117 const unsigned int	_nbpg		= (unsigned int)MMU_PAGESIZE;
118 
119 /*
120  * System parameter formulae.
121  *
122  * This file is copied into each directory where we compile
123  * the kernel; it should be modified there to suit local taste
124  * if necessary.
125  */
126 
127 /*
128  * Default hz is 100, but if we set hires_tick we get higher resolution
129  * clock behavior (currently defined to be 1000 hz).  Higher values seem
130  * to work, but are not supported.
131  *
132  * If we do decide to play with higher values, remember that hz should
133  * satisfy the following constraints to avoid integer round-off problems:
134  *
135  * (1) hz should be in the range 100 <= hz <= MICROSEC.  If hz exceeds
136  *     MICROSEC, usec_per_tick will be zero and lots of stuff will break.
137  *     Similarly, if hz < 100 then hz / 100 == 0 and stuff will break.
138  *
139  * (2) If hz <= 1000, it should be both a multiple of 100 and a
140  *	divisor of 1000.
141  *
142  * (3) If hz > 1000, it should be both a multiple of 1000 and a
143  *	divisor of MICROSEC.
144  *
145  * Thus the only reasonable values of hz (i.e. the values that won't
146  * cause roundoff error) are: 100, 200, 500, 1000, 2000, 4000, 5000,
147  * 8000, 10000, 20000, 25000, 40000, 50000, 100000, 125000, 200000,
148  * 250000, 500000, 1000000.  As of this writing (1996) a clock rate
149  * of more than about 10 kHz seems utterly ridiculous, although
150  * this observation will no doubt seem quaintly amusing one day.
151  */
152 int hz = 100;
153 int hires_hz = 1000;
154 int hires_tick = 0;
155 int cpu_decay_factor = 10;	/* this is no longer tied to clock */
156 int tick_per_msec;	/* clock ticks per millisecond (zero if hz < 1000) */
157 int msec_per_tick;	/* millseconds per clock tick (zero if hz > 1000) */
158 int usec_per_tick;	/* microseconds per clock tick */
159 int nsec_per_tick;	/* nanoseconds per clock tick */
160 int max_hres_adj;	/* maximum adjustment of hrtime per tick */
161 
162 /*
163  * Setting "snooping" to a non-zero value will cause a deadman panic if
164  * snoop_interval microseconds elapse without lbolt increasing.  The default
165  * snoop_interval is 50 seconds.
166  */
167 #define	SNOOP_INTERVAL_MIN	(MICROSEC)
168 #define	SNOOP_INTERVAL_DEFAULT	(50 * MICROSEC)
169 
170 int snooping = 0;
171 uint_t snoop_interval = SNOOP_INTERVAL_DEFAULT;
172 
173 /*
174  * Tables of initialization functions, called from main().
175  */
176 
177 extern void system_taskq_init(void);
178 extern void binit(void);
179 extern void space_init(void);
180 extern void dnlc_init(void);
181 extern void vfsinit(void);
182 extern void finit(void);
183 extern void strinit(void);
184 extern void flk_init(void);
185 extern void ftrace_init(void);
186 extern void softcall_init(void);
187 extern void ttyinit(void);
188 extern void schedctl_init(void);
189 extern void deadman_init(void);
190 extern void clock_timer_init(void);
191 extern void clock_realtime_init(void);
192 extern void clock_highres_init(void);
193 extern void pg_init(void);
194 extern void pg_cmt_class_init(void);
195 extern void pg_cpu0_init(void);
196 extern void clock_tick_mp_init(void);
197 extern void callout_mp_init(void);
198 extern void cpu_seq_tbl_init(void);
199 
200 void	(*init_tbl[])(void) = {
201 	system_taskq_init,
202 	binit,
203 	space_init,
204 	dnlc_init,
205 	vfsinit,
206 	finit,
207 	strinit,
208 	serializer_init,
209 	softcall_init,
210 	ttyinit,
211 	as_init,
212 	pvn_init,
213 	anon_init,
214 	segvn_init,
215 	flk_init,
216 	cpu_seq_tbl_init,
217 	pg_init,
218 	pg_cmt_class_init,
219 	pg_cpu0_init,
220 	schedctl_init,
221 	fdb_init,
222 	deadman_init,
223 	clock_timer_init,
224 	clock_realtime_init,
225 	clock_highres_init,
226 	0
227 };
228 
229 
230 #if defined(__sparc)
231 	extern void siron_mp_init();
232 #endif
233 
234 /*
235  * Any per cpu resources should be initialized via
236  * an entry in mp_init_tbl().
237  */
238 void	(*mp_init_tbl[])(void) = {
239 	ftrace_init,
240 	cyclic_mp_init,
241 #if defined(__sparc)
242 	siron_mp_init,
243 #endif
244 	clock_tick_mp_init,
245 	callout_mp_init,
246 	0
247 };
248 
249 int maxusers;		/* kitchen-sink knob for dynamic configuration */
250 
251 /*
252  * pidmax -- highest pid value assigned by the system
253  * Settable in /etc/system
254  */
255 int pidmax = DEFAULT_MAXPID;
256 
257 /*
258  * jump_pid - if set, this value is where pid numbers should start
259  * after the first few system pids (0-3) are used.  If 0, pids are
260  * chosen in the usual way. This variable can be used to quickly
261  * create large pids (by setting it to 100000, for example). pids
262  * less than this value will never be chosen.
263  */
264 pid_t jump_pid = DEFAULT_JUMPPID;
265 
266 /*
267  * autoup -- used in struct var for dynamic config of the age a delayed-write
268  * buffer must be in seconds before bdflush will write it out.
269  */
270 #define	DEFAULT_AUTOUP	30
271 int autoup = DEFAULT_AUTOUP;
272 
273 /*
274  * bufhwm -- tuneable variable for struct var for v_bufhwm.
275  * high water mark for buffer cache mem usage in units of K bytes.
276  *
277  * bufhwm_pct -- ditto, but given in % of physmem.
278  */
279 int bufhwm = 0;
280 int bufhwm_pct = 0;
281 
282 /*
283  * Process table.
284  */
285 int maxpid;
286 int max_nprocs;		/* set in param_init() */
287 int maxuprc;		/* set in param_init() */
288 int reserved_procs;
289 int nthread = 1;
290 
291 /*
292  * UFS tunables
293  */
294 int ufs_ninode;		/* declared here due to backwards compatibility */
295 int ndquot;		/* declared here due to backwards compatibility */
296 
297 /*
298  * Exec switch table. This is used by the generic exec module
299  * to switch out to the desired executable type, based on the
300  * magic number. The currently supported types are ELF, a.out
301  * (both NMAGIC and ZMAGIC), interpreter (#!) files,
302  * and Java executables.
303  */
304 /*
305  * Magic numbers
306  */
307 short elfmagic = 0x7f45;
308 short intpmagic = 0x2321;
309 short jmagic = 0x504b;
310 
311 #if defined(__sparc)
312 short aout_nmagic = NMAGIC;
313 short aout_zmagic = ZMAGIC;
314 short aout_omagic = OMAGIC;
315 #endif
316 short nomagic = 0;
317 
318 /*
319  * Magic strings
320  */
321 #define	ELF32MAGIC_STRING	"\x7f""ELF\x1"
322 #define	ELF64MAGIC_STRING	"\x7f""ELF\x2"
323 #define	INTPMAGIC_STRING	"#!"
324 #define	JAVAMAGIC_STRING	"PK\003\004"
325 #define	AOUT_OMAGIC_STRING	"\x1""\x07"	/* 0407 */
326 #define	AOUT_NMAGIC_STRING	"\x1""\x08"	/* 0410 */
327 #define	AOUT_ZMAGIC_STRING	"\x1""\x0b"	/* 0413 */
328 #define	NOMAGIC_STRING		""
329 
330 #define	SHBIN_CNTL(x)	((x)&037)
331 #define	SHBINMAGIC_STRING {SHBIN_CNTL('k'), SHBIN_CNTL('s'), SHBIN_CNTL('h'), 0}
332 #define	SHBINMAGIC_LEN	4
333 
334 char elf32magicstr[] = ELF32MAGIC_STRING;
335 char elf64magicstr[] = ELF64MAGIC_STRING;
336 char intpmagicstr[] = INTPMAGIC_STRING;
337 char shbinmagicstr[] = SHBINMAGIC_STRING;
338 char javamagicstr[] = JAVAMAGIC_STRING;
339 #if defined(__sparc)
340 char aout_nmagicstr[] = AOUT_NMAGIC_STRING;
341 char aout_zmagicstr[] = AOUT_ZMAGIC_STRING;
342 char aout_omagicstr[] = AOUT_OMAGIC_STRING;
343 #endif
344 char nomagicstr[] = NOMAGIC_STRING;
345 
346 char *execswnames[] = {
347 	"elfexec",	/* Elf32 */
348 #ifdef _LP64
349 	"elfexec",	/* Elf64 */
350 #endif
351 	"intpexec",
352 	"shbinexec",
353 	"javaexec",
354 #if defined(__sparc)
355 	"aoutexec",
356 	"aoutexec",
357 	"aoutexec",
358 #endif
359 	NULL,
360 	NULL,
361 	NULL
362 };
363 
364 struct execsw execsw[] = {
365 	{ elf32magicstr, 0, 5, NULL, NULL, NULL },
366 #ifdef _LP64
367 	{ elf64magicstr, 0, 5, NULL, NULL, NULL },
368 #endif
369 	{ intpmagicstr, 0, 2, NULL, NULL, NULL },
370 	{ shbinmagicstr, 0, SHBINMAGIC_LEN, NULL, NULL, NULL },
371 	{ javamagicstr, 0, 4, NULL, NULL, NULL },
372 #if defined(__sparc)
373 	{ aout_zmagicstr, 2, 2, NULL, NULL, NULL },
374 	{ aout_nmagicstr, 2, 2, NULL, NULL, NULL },
375 	{ aout_omagicstr, 2, 2, NULL, NULL, NULL },
376 #endif
377 	{ nomagicstr, 0, 0, NULL, NULL, NULL },
378 	{ nomagicstr, 0, 0, NULL, NULL, NULL },
379 	{ nomagicstr, 0, 0, NULL, NULL, NULL },
380 	{ nomagicstr, 0, 0, NULL, NULL, NULL }
381 };
382 int nexectype = sizeof (execsw) / sizeof (execsw[0]);	/* # of exec types */
383 kmutex_t execsw_lock;	/* Used for allocation of execsw entries */
384 
385 /*
386  * symbols added to make changing max-file-descriptors
387  * simple via /etc/system
388  */
389 #define	RLIM_FD_CUR 0x100
390 #define	RLIM_FD_MAX 0x10000
391 
392 uint_t rlim_fd_cur = RLIM_FD_CUR;
393 uint_t rlim_fd_max = RLIM_FD_MAX;
394 
395 /*
396  * (Default resource limits were formerly declared here, but are now provided by
397  * the more general resource controls framework.)
398  */
399 
400 /*
401  * STREAMS tunables
402  */
403 int	nstrpush = 9;		/* maximum # of modules/drivers on a stream */
404 ssize_t	strctlsz = 1024;	/* maximum size of user-generated M_PROTO */
405 ssize_t	strmsgsz = 0x10000;	/* maximum size of user-generated M_DATA */
406 				/* for `strmsgsz', zero means unlimited */
407 /*
408  * Filesystem tunables
409  */
410 int	rstchown = 1;		/* POSIX_CHOWN_RESTRICTED is enabled */
411 int	ngroups_max = NGROUPS_MAX_DEFAULT;
412 
413 /*
414  * generic scheduling stuff
415  *
416  * Configurable parameters for RT and TS are in the respective
417  * scheduling class modules.
418  */
419 
420 pri_t maxclsyspri = MAXCLSYSPRI;
421 pri_t minclsyspri = MINCLSYSPRI;
422 char sys_name[] = "SYS";
423 
424 extern pri_t sys_init();
425 extern classfuncs_t sys_classfuncs;
426 
427 sclass_t sclass[] = {
428 	{ "SYS",	sys_init,	&sys_classfuncs, STATIC_SCHED, 0 },
429 	{ "",	NULL,	NULL,	NULL, 0 },
430 	{ "",	NULL,	NULL,	NULL, 0 },
431 	{ "",	NULL,	NULL,	NULL, 0 },
432 	{ "",	NULL,	NULL,	NULL, 0 },
433 	{ "",	NULL,	NULL,	NULL, 0 },
434 	{ "",	NULL,	NULL,	NULL, 0 },
435 	{ "",	NULL,	NULL,	NULL, 0 },
436 	{ "",	NULL,	NULL,	NULL, 0 },
437 	{ "",	NULL,	NULL,	NULL, 0 }
438 };
439 
440 int loaded_classes = 1;		/* for loaded classes */
441 kmutex_t class_lock;		/* lock for class[] */
442 
443 int nclass = sizeof (sclass) / sizeof (sclass_t);
444 char initcls[] = "TS";
445 char *defaultclass = initcls;
446 
447 /*
448  * Tunable system parameters.
449  */
450 
451 /*
452  * The integers tune_* are done this way so that the tune
453  * data structure may be "tuned" if necessary from the /etc/system
454  * file. The tune data structure is initialized in param_init();
455  */
456 
457 tune_t tune;
458 
459 /*
460  * If freemem < t_getpgslow, then start to steal pages from processes.
461  */
462 int tune_t_gpgslo = 25;
463 
464 /*
465  * Rate at which fsflush is run, in seconds.
466  */
467 #define	DEFAULT_TUNE_T_FSFLUSHR	1
468 int tune_t_fsflushr = DEFAULT_TUNE_T_FSFLUSHR;
469 
470 /*
471  * The minimum available resident (not swappable) memory to maintain
472  * in order to avoid deadlock.  In pages.
473  */
474 int tune_t_minarmem = 25;
475 
476 /*
477  * The minimum available swappable memory to maintain in order to avoid
478  * deadlock.  In pages.
479  */
480 int tune_t_minasmem = 25;
481 
482 int tune_t_flckrec = 512;	/* max # of active frlocks */
483 
484 /*
485  * Number of currently available pages that cannot be 'locked'
486  * This is set in init_pages_pp_maximum, and must be initialized
487  * to zero here to detect an override in /etc/system
488  */
489 pgcnt_t pages_pp_maximum = 0;
490 
491 int boothowto;			/* boot flags passed to kernel */
492 struct var v;			/* System Configuration Information */
493 
494 /*
495  * System Configuration Information
496  */
497 
498 /*
499  * The physical system's host identifier, expressed as a decimal string.
500  * Code should only directly access this value when writing to it (setting the
501  * physical system's host identifier).  Code that reads the physical system's
502  * host identifier should use zone_get_hostid(NULL) instead.
503  */
504 char hw_serial[HW_HOSTID_LEN] = "0";
505 
506 #if defined(__sparc)
507 
508 /*
509  * On sparc machines, read hw_serial from the firmware at boot time
510  * and simply assert Sun is the hardware provider.  Hmm.
511  */
512 char architecture[] = "sparcv9";
513 char architecture_32[] = "sparc";
514 char hw_provider[] = "Sun_Microsystems";
515 
516 #elif defined(__i386)
517 
518 /*
519  * On x86 machines, read hw_serial, hw_provider and srpc_domain from
520  * /etc/bootrc at boot time.
521  */
522 char architecture[] = "i386";
523 char architecture_32[] = "i386";
524 char hw_provider[SYS_NMLN] = "";
525 
526 #elif defined(__amd64)
527 
528 /*
529  * On amd64 machines, read hw_serial, hw_provider and srpc_domain from
530  * /etc/bootrc at boot time.
531  */
532 char architecture[] = "amd64";
533 char architecture_32[] = "i386";
534 char hw_provider[SYS_NMLN] = "";
535 
536 #else
537 #error "unknown processor architecture"
538 #endif
539 
540 char srpc_domain[SYS_NMLN] = "";
541 char platform[SYS_NMLN] = "";	/* read from the devinfo root node */
542 
543 /* Initialize isa_list */
544 char *isa_list = architecture;
545 
546 static pgcnt_t original_physmem = 0;
547 
548 #define	MIN_DEFAULT_MAXUSERS	8u
549 #define	MAX_DEFAULT_MAXUSERS	2048u
550 #define	MAX_MAXUSERS		4096u
551 
552 void
553 param_preset(void)
554 {
555 	original_physmem = physmem;
556 }
557 
558 void
559 param_calc(int platform_max_nprocs)
560 {
561 	/*
562 	 * Default to about one "user" per megabyte, taking into
563 	 * account both physical and virtual constraints.
564 	 * Note: 2^20 is a meg; shifting right by (20 - PAGESHIFT)
565 	 * converts pages to megs without integer overflow.
566 	 */
567 #if defined(__sparc)
568 	if (physmem > original_physmem) {
569 		physmem = original_physmem;
570 		cmn_err(CE_NOTE, "physmem limited to %ld", physmem);
571 	}
572 #endif
573 	if (maxusers == 0) {
574 		pgcnt_t physmegs = physmem >> (20 - PAGESHIFT);
575 		pgcnt_t virtmegs = vmem_size(heap_arena, VMEM_FREE) >> 20;
576 		maxusers = MIN(MAX(MIN(physmegs, virtmegs),
577 		    MIN_DEFAULT_MAXUSERS), MAX_DEFAULT_MAXUSERS);
578 	}
579 	if (maxusers > MAX_MAXUSERS) {
580 		maxusers = MAX_MAXUSERS;
581 		cmn_err(CE_NOTE, "maxusers limited to %d", MAX_MAXUSERS);
582 	}
583 
584 	if (ngroups_max > NGROUPS_MAX_DEFAULT)
585 		cmn_err(CE_WARN, "ngroups_max of %d > %d, NFS AUTH_SYS will"
586 		    " not work properly", ngroups_max, NGROUPS_MAX_DEFAULT);
587 
588 #ifdef DEBUG
589 	/*
590 	 * The purpose of maxusers is to prevent memory overcommit.
591 	 * DEBUG kernels take more space, so reduce maxusers a bit.
592 	 */
593 	maxusers = (3 * maxusers) / 4;
594 #endif
595 
596 	/*
597 	 * We need to dynamically change any variables now so that
598 	 * the setting of maxusers and pidmax propagate to the other
599 	 * variables that are dependent on them.
600 	 */
601 	if (reserved_procs == 0)
602 		reserved_procs = 5;
603 	if (pidmax < reserved_procs || pidmax > MAX_MAXPID)
604 		maxpid = MAX_MAXPID;
605 	else
606 		maxpid = pidmax;
607 
608 	/*
609 	 * This allows platform-dependent code to constrain the maximum
610 	 * number of processes allowed in case there are e.g. VM limitations
611 	 * with how many contexts are available.
612 	 */
613 	if (max_nprocs == 0)
614 		max_nprocs = (10 + 16 * maxusers);
615 	if (platform_max_nprocs > 0 && max_nprocs > platform_max_nprocs)
616 		max_nprocs = platform_max_nprocs;
617 	if (max_nprocs > maxpid)
618 		max_nprocs = maxpid;
619 
620 	if (maxuprc == 0)
621 		maxuprc = (max_nprocs - reserved_procs);
622 }
623 
624 void
625 param_init(void)
626 {
627 	/*
628 	 * Set each individual element of struct var v to be the
629 	 * default value. This is done this way
630 	 * so that a user can set the assigned integer value in the
631 	 * /etc/system file *IF* tuning is needed.
632 	 */
633 	v.v_proc = max_nprocs;	/* v_proc - max # of processes system wide */
634 	v.v_maxupttl = max_nprocs - reserved_procs;
635 	v.v_maxsyspri = (int)maxclsyspri;  /* max global pri for sysclass */
636 	v.v_maxup = MIN(maxuprc, v.v_maxupttl); /* max procs per user */
637 	v.v_autoup = autoup;	/* v_autoup - delay for delayed writes */
638 
639 	/*
640 	 * Set each individual element of struct tune to be the
641 	 * default value. Each struct element This is done this way
642 	 *  so that a user can set the assigned integer value in the
643 	 * /etc/system file *IF* tuning is needed.
644 	 */
645 	tune.t_gpgslo = tune_t_gpgslo;
646 	tune.t_fsflushr = tune_t_fsflushr;
647 	tune.t_minarmem = tune_t_minarmem;
648 	tune.t_minasmem = tune_t_minasmem;
649 	tune.t_flckrec = tune_t_flckrec;
650 
651 	/*
652 	 * Initialization for file descriptors to correct mistaken settings in
653 	 * /etc/system.  Initialization of limits performed by resource control
654 	 * system.
655 	 */
656 	if (rlim_fd_cur > rlim_fd_max)
657 		rlim_fd_cur = rlim_fd_max;
658 
659 	/*
660 	 * calculations needed if hz was set in /etc/system
661 	 */
662 	if (hires_tick)
663 		hz = hires_hz;
664 
665 	tick_per_msec = hz / MILLISEC;
666 	msec_per_tick = MILLISEC / hz;
667 	usec_per_tick = MICROSEC / hz;
668 	nsec_per_tick = NANOSEC / hz;
669 	max_hres_adj = nsec_per_tick >> ADJ_SHIFT;
670 }
671 
672 /*
673  * Validate tuneable parameters following /etc/system processing,
674  * but prior to param_init().
675  */
676 void
677 param_check(void)
678 {
679 #if defined(__x86)
680 	if (physmem != original_physmem) {
681 		cmn_err(CE_NOTE, "physmem cannot be modified to 0x%lx"
682 		    " via /etc/system. Please use eeprom(1M) instead.",
683 		    physmem);
684 		physmem = original_physmem;
685 	}
686 #endif
687 	if (ngroups_max < NGROUPS_UMIN || ngroups_max > NGROUPS_UMAX)
688 		ngroups_max = NGROUPS_MAX_DEFAULT;
689 
690 	if (autoup <= 0) {
691 		autoup = DEFAULT_AUTOUP;
692 		cmn_err(CE_WARN, "autoup <= 0; defaulting to %d", autoup);
693 	}
694 
695 	if (tune_t_fsflushr <= 0) {
696 		tune_t_fsflushr = DEFAULT_TUNE_T_FSFLUSHR;
697 		cmn_err(CE_WARN, "tune_t_fsflushr <= 0; defaulting to %d",
698 		    tune_t_fsflushr);
699 	}
700 
701 	if (jump_pid < 0 || jump_pid >= pidmax) {
702 		jump_pid = 0;
703 		cmn_err(CE_WARN, "jump_pid < 0 or >= pidmax; ignored");
704 	}
705 
706 	if (snoop_interval < SNOOP_INTERVAL_MIN) {
707 		snoop_interval = SNOOP_INTERVAL_DEFAULT;
708 		cmn_err(CE_WARN, "snoop_interval < minimum (%d); defaulting"
709 		    " to %d", SNOOP_INTERVAL_MIN, SNOOP_INTERVAL_DEFAULT);
710 	}
711 }
712