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