Print this page
XXX Rearchitect and replace interrupt distribution
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/os/main.c
+++ new/usr/src/uts/common/os/main.c
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
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
22 22 /*
23 23 * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
24 24 */
25 25
26 26 /* Copyright (c) 1988 AT&T */
27 27 /* All Rights Reserved */
28 28
29 29 /*
30 30 * Copyright (c) 2013, Joyent, Inc. All rights reserved.
31 31 */
32 32
33 33 #include <sys/types.h>
34 34 #include <sys/param.h>
35 35 #include <sys/sysmacros.h>
36 36 #include <sys/pcb.h>
37 37 #include <sys/systm.h>
38 38 #include <sys/signal.h>
39 39 #include <sys/cred.h>
40 40 #include <sys/user.h>
41 41 #include <sys/vfs.h>
42 42 #include <sys/vnode.h>
43 43 #include <sys/proc.h>
44 44 #include <sys/time.h>
45 45 #include <sys/file.h>
46 46 #include <sys/priocntl.h>
47 47 #include <sys/procset.h>
48 48 #include <sys/disp.h>
49 49 #include <sys/callo.h>
50 50 #include <sys/callb.h>
51 51 #include <sys/debug.h>
52 52 #include <sys/conf.h>
53 53 #include <sys/bootconf.h>
54 54 #include <sys/utsname.h>
55 55 #include <sys/cmn_err.h>
56 56 #include <sys/vmparam.h>
57 57 #include <sys/modctl.h>
58 58 #include <sys/vm.h>
59 59 #include <sys/callb.h>
60 60 #include <sys/ddi_periodic.h>
61 61 #include <sys/kmem.h>
62 62 #include <sys/vmem.h>
63 63 #include <sys/cpuvar.h>
64 64 #include <sys/cladm.h>
65 65 #include <sys/corectl.h>
66 66 #include <sys/exec.h>
67 67 #include <sys/syscall.h>
68 68 #include <sys/reboot.h>
69 69 #include <sys/task.h>
70 70 #include <sys/exacct.h>
71 71 #include <sys/autoconf.h>
72 72 #include <sys/errorq.h>
73 73 #include <sys/class.h>
74 74 #include <sys/stack.h>
75 75 #include <sys/brand.h>
76 76 #include <sys/mmapobj.h>
77 77
78 78 #include <vm/as.h>
79 79 #include <vm/seg_kmem.h>
↓ open down ↓ |
79 lines elided |
↑ open up ↑ |
80 80 #include <sys/dc_ki.h>
81 81
82 82 #include <c2/audit.h>
83 83 #include <sys/bootprops.h>
84 84
85 85 /* well known processes */
86 86 proc_t *proc_sched; /* memory scheduler */
87 87 proc_t *proc_init; /* init */
88 88 proc_t *proc_pageout; /* pageout daemon */
89 89 proc_t *proc_fsflush; /* fsflush daemon */
90 +proc_t *proc_intrd; /* interrupt daemon */
90 91
91 92 pgcnt_t maxmem; /* Maximum available memory in pages. */
92 93 pgcnt_t freemem; /* Current available memory in pages. */
93 94 int interrupts_unleashed; /* set when we do the first spl0() */
94 95
95 96 kmem_cache_t *process_cache; /* kmem cache for proc structures */
96 97
97 98 /*
98 99 * Indicates whether the auditing module (c2audit) is loaded. Possible
99 100 * values are:
100 101 * 0 - c2audit module is excluded in /etc/system and cannot be loaded
101 102 * 1 - c2audit module is not loaded but can be anytime
102 103 * 2 - c2audit module is loaded
103 104 */
104 105 int audit_active = C2AUDIT_DISABLED;
105 106
106 107 /*
107 108 * Process 0's lwp directory and lwpid hash table.
108 109 */
109 110 lwpdir_t p0_lwpdir[2];
110 111 tidhash_t p0_tidhash[2];
111 112 lwpent_t p0_lep;
112 113
113 114 /*
114 115 * Machine-independent initialization code
115 116 * Called from cold start routine as
116 117 * soon as a stack and segmentation
117 118 * have been established.
118 119 * Functions:
119 120 * clear and free user core
120 121 * turn on clock
121 122 * hand craft 0th process
122 123 * call all initialization routines
123 124 * fork - process 0 to schedule
124 125 * - process 1 execute bootstrap
125 126 * - process 2 to page out
126 127 * create system threads
127 128 */
128 129
129 130 int cluster_bootflags = 0;
130 131
131 132 void
132 133 cluster_wrapper(void)
133 134 {
134 135 cluster();
135 136 panic("cluster() returned");
136 137 }
137 138
138 139 char initname[INITNAME_SZ] = "/sbin/init"; /* also referenced by zone0 */
139 140 char initargs[BOOTARGS_MAX] = ""; /* also referenced by zone0 */
140 141
141 142 /*
142 143 * Construct a stack for init containing the arguments to it, then
143 144 * pass control to exec_common.
144 145 */
145 146 int
146 147 exec_init(const char *initpath, const char *args)
147 148 {
148 149 caddr32_t ucp;
149 150 caddr32_t *uap;
150 151 caddr32_t *argv;
151 152 caddr32_t exec_fnamep;
152 153 char *scratchargs;
153 154 int i, sarg;
154 155 size_t argvlen, alen;
155 156 boolean_t in_arg;
156 157 int argc = 0;
157 158 int error = 0, count = 0;
158 159 proc_t *p = ttoproc(curthread);
159 160 klwp_t *lwp = ttolwp(curthread);
160 161 int brand_action;
161 162
162 163 if (args == NULL)
163 164 args = "";
164 165
165 166 alen = strlen(initpath) + 1 + strlen(args) + 1;
166 167 scratchargs = kmem_alloc(alen, KM_SLEEP);
167 168 (void) snprintf(scratchargs, alen, "%s %s", initpath, args);
168 169
169 170 /*
170 171 * We do a quick two state parse of the string to sort out how big
171 172 * argc should be.
172 173 */
173 174 in_arg = B_FALSE;
174 175 for (i = 0; i < strlen(scratchargs); i++) {
175 176 if (scratchargs[i] == ' ' || scratchargs[i] == '\0') {
176 177 if (in_arg) {
177 178 in_arg = B_FALSE;
178 179 argc++;
179 180 }
180 181 } else {
181 182 in_arg = B_TRUE;
182 183 }
183 184 }
184 185 argvlen = sizeof (caddr32_t) * (argc + 1);
185 186 argv = kmem_zalloc(argvlen, KM_SLEEP);
186 187
187 188 /*
188 189 * We pull off a bit of a hack here. We work our way through the
189 190 * args string, putting nulls at the ends of space delimited tokens
190 191 * (boot args don't support quoting at this time). Then we just
191 192 * copy the whole mess to userland in one go. In other words, we
192 193 * transform this: "init -s -r\0" into this on the stack:
193 194 *
194 195 * -0x00 \0
195 196 * -0x01 r
196 197 * -0x02 - <--------.
197 198 * -0x03 \0 |
198 199 * -0x04 s |
199 200 * -0x05 - <------. |
200 201 * -0x06 \0 | |
201 202 * -0x07 t | |
202 203 * -0x08 i | |
203 204 * -0x09 n | |
204 205 * -0x0a i <---. | |
205 206 * -0x10 NULL | | | (argv[3])
206 207 * -0x14 -----|--|-' (argv[2])
207 208 * -0x18 ------|--' (argv[1])
208 209 * -0x1c -------' (argv[0])
209 210 *
210 211 * Since we know the value of ucp at the beginning of this process,
211 212 * we can trivially compute the argv[] array which we also need to
212 213 * place in userland: argv[i] = ucp - sarg(i), where ucp is the
213 214 * stack ptr, and sarg is the string index of the start of the
214 215 * argument.
215 216 */
216 217 ucp = (caddr32_t)(uintptr_t)p->p_usrstack;
217 218
218 219 argc = 0;
219 220 in_arg = B_FALSE;
220 221 sarg = 0;
221 222
222 223 for (i = 0; i < alen; i++) {
223 224 if (scratchargs[i] == ' ' || scratchargs[i] == '\0') {
224 225 if (in_arg == B_TRUE) {
225 226 in_arg = B_FALSE;
226 227 scratchargs[i] = '\0';
227 228 argv[argc++] = ucp - (alen - sarg);
228 229 }
229 230 } else if (in_arg == B_FALSE) {
230 231 in_arg = B_TRUE;
231 232 sarg = i;
232 233 }
233 234 }
234 235 ucp -= alen;
235 236 error |= copyout(scratchargs, (caddr_t)(uintptr_t)ucp, alen);
236 237
237 238 uap = (caddr32_t *)P2ALIGN((uintptr_t)ucp, sizeof (caddr32_t));
238 239 uap--; /* advance to be below the word we're in */
239 240 uap -= (argc + 1); /* advance argc words down, plus one for NULL */
240 241 error |= copyout(argv, uap, argvlen);
241 242
242 243 if (error != 0) {
243 244 zcmn_err(p->p_zone->zone_id, CE_WARN,
244 245 "Could not construct stack for init.\n");
245 246 kmem_free(argv, argvlen);
246 247 kmem_free(scratchargs, alen);
247 248 return (EFAULT);
248 249 }
249 250
250 251 exec_fnamep = argv[0];
251 252 kmem_free(argv, argvlen);
252 253 kmem_free(scratchargs, alen);
253 254
254 255 /*
255 256 * Point at the arguments.
256 257 */
257 258 lwp->lwp_ap = lwp->lwp_arg;
258 259 lwp->lwp_arg[0] = (uintptr_t)exec_fnamep;
259 260 lwp->lwp_arg[1] = (uintptr_t)uap;
260 261 lwp->lwp_arg[2] = NULL;
261 262 curthread->t_post_sys = 1;
262 263 curthread->t_sysnum = SYS_execve;
263 264
264 265 /*
265 266 * If we are executing init from zsched, we may have inherited its
266 267 * parent process's signal mask. Clear it now so that we behave in
267 268 * the same way as when started from the global zone.
268 269 */
269 270 sigemptyset(&curthread->t_hold);
270 271
271 272 brand_action = ZONE_IS_BRANDED(p->p_zone) ? EBA_BRAND : EBA_NONE;
272 273 again:
273 274 error = exec_common((const char *)(uintptr_t)exec_fnamep,
274 275 (const char **)(uintptr_t)uap, NULL, brand_action);
275 276
276 277 /*
277 278 * Normally we would just set lwp_argsaved and t_post_sys and
278 279 * let post_syscall reset lwp_ap for us. Unfortunately,
279 280 * exec_init isn't always called from a system call. Instead
280 281 * of making a mess of trap_cleanup, we just reset the args
281 282 * pointer here.
282 283 */
283 284 reset_syscall_args();
284 285
285 286 switch (error) {
286 287 case 0:
287 288 return (0);
288 289
289 290 case ENOENT:
290 291 zcmn_err(p->p_zone->zone_id, CE_WARN,
291 292 "exec(%s) failed (file not found).\n", initpath);
292 293 return (ENOENT);
293 294
294 295 case EAGAIN:
295 296 case EINTR:
296 297 ++count;
297 298 if (count < 5) {
298 299 zcmn_err(p->p_zone->zone_id, CE_WARN,
299 300 "exec(%s) failed with errno %d. Retrying...\n",
300 301 initpath, error);
301 302 goto again;
302 303 }
303 304 }
304 305
305 306 zcmn_err(p->p_zone->zone_id, CE_WARN,
306 307 "exec(%s) failed with errno %d.", initpath, error);
307 308 return (error);
308 309 }
309 310
310 311 /*
311 312 * This routine does all of the common setup for invoking init; global
312 313 * and non-global zones employ this routine for the functionality which is
313 314 * in common.
314 315 *
315 316 * This program (init, presumably) must be a 32-bit process.
316 317 */
317 318 int
318 319 start_init_common()
319 320 {
320 321 proc_t *p = curproc;
321 322 ASSERT_STACK_ALIGNED();
322 323 p->p_zone->zone_proc_initpid = p->p_pid;
323 324
324 325 p->p_cstime = p->p_stime = p->p_cutime = p->p_utime = 0;
325 326 p->p_usrstack = (caddr_t)USRSTACK32;
326 327 p->p_model = DATAMODEL_ILP32;
327 328 p->p_stkprot = PROT_ZFOD & ~PROT_EXEC;
328 329 p->p_datprot = PROT_ZFOD & ~PROT_EXEC;
329 330 p->p_stk_ctl = INT32_MAX;
330 331
331 332 p->p_as = as_alloc();
332 333 p->p_as->a_proc = p;
333 334 p->p_as->a_userlimit = (caddr_t)USERLIMIT32;
334 335 (void) hat_setup(p->p_as->a_hat, HAT_INIT);
335 336
336 337 init_core();
337 338
338 339 init_mstate(curthread, LMS_SYSTEM);
339 340 return (exec_init(p->p_zone->zone_initname, p->p_zone->zone_bootargs));
340 341 }
341 342
342 343 /*
343 344 * Start the initial user process for the global zone; once running, if
344 345 * init should subsequently fail, it will be automatically be caught in the
345 346 * exit(2) path, and restarted by restart_init().
346 347 */
347 348 static void
348 349 start_init(void)
349 350 {
350 351 proc_init = curproc;
351 352
352 353 ASSERT(curproc->p_zone->zone_initname != NULL);
353 354
354 355 if (start_init_common() != 0)
355 356 halt("unix: Could not start init");
↓ open down ↓ |
256 lines elided |
↑ open up ↑ |
356 357 lwp_rtt();
357 358 }
358 359
359 360 void
360 361 main(void)
361 362 {
362 363 proc_t *p = ttoproc(curthread); /* &p0 */
363 364 int (**initptr)();
364 365 extern void sched();
365 366 extern void fsflush();
367 + extern void interrupt_balancer();
366 368 extern int (*init_tbl[])();
367 369 extern int (*mp_init_tbl[])();
368 370 extern id_t syscid, defaultcid;
369 371 extern int swaploaded;
370 372 extern int netboot;
371 373 extern ib_boot_prop_t *iscsiboot_prop;
372 374 extern void vm_init(void);
373 375 extern void cbe_init_pre(void);
374 376 extern void cbe_init(void);
375 377 extern void clock_tick_init_pre(void);
376 378 extern void clock_tick_init_post(void);
377 379 extern void clock_init(void);
378 380 extern void physio_bufs_init(void);
379 381 extern void pm_cfb_setup_intr(void);
380 382 extern int pm_adjust_timestamps(dev_info_t *, void *);
381 383 extern void start_other_cpus(int);
382 384 extern void sysevent_evc_thrinit();
383 385 extern kmutex_t ualock;
384 386 #if defined(__x86)
385 387 extern void fastboot_post_startup(void);
386 388 extern void progressbar_start(void);
387 389 #endif
388 390 /*
389 391 * In the horrible world of x86 in-lines, you can't get symbolic
390 392 * structure offsets a la genassym. This assertion is here so
391 393 * that the next poor slob who innocently changes the offset of
392 394 * cpu_thread doesn't waste as much time as I just did finding
393 395 * out that it's hard-coded in i86/ml/i86.il. Similarly for
394 396 * curcpup. You're welcome.
395 397 */
396 398 ASSERT(CPU == CPU->cpu_self);
397 399 ASSERT(curthread == CPU->cpu_thread);
398 400 ASSERT_STACK_ALIGNED();
399 401
400 402 /*
401 403 * We take the ualock until we have completed the startup
402 404 * to prevent kadmin() from disrupting this work. In particular,
403 405 * we don't want kadmin() to bring the system down while we are
404 406 * trying to start it up.
405 407 */
406 408 mutex_enter(&ualock);
407 409
408 410 /*
409 411 * Setup root lgroup and leaf lgroup for CPU 0
410 412 */
411 413 lgrp_init(LGRP_INIT_STAGE2);
412 414
413 415 /*
414 416 * Once 'startup()' completes, the thread_reaper() daemon would be
415 417 * created(in thread_init()). After that, it is safe to create threads
416 418 * that could exit. These exited threads will get reaped.
417 419 */
418 420 startup();
419 421 segkmem_gc();
420 422 callb_init();
421 423 cbe_init_pre(); /* x86 must initialize gethrtimef before timer_init */
422 424 ddi_periodic_init();
423 425 cbe_init();
424 426 callout_init(); /* callout table MUST be init'd after cyclics */
425 427 clock_tick_init_pre();
426 428 clock_init();
427 429
428 430 #if defined(__x86)
429 431 /*
430 432 * The progressbar thread uses cv_reltimedwait() and hence needs to be
431 433 * started after the callout mechanism has been initialized.
432 434 */
433 435 progressbar_start();
434 436 #endif
435 437 /*
436 438 * On some platforms, clkinitf() changes the timing source that
437 439 * gethrtime_unscaled() uses to generate timestamps. cbe_init() calls
438 440 * clkinitf(), so re-initialize the microstate counters after the
439 441 * timesource has been chosen.
440 442 */
441 443 init_mstate(&t0, LMS_SYSTEM);
442 444 init_cpu_mstate(CPU, CMS_SYSTEM);
443 445
444 446 /*
445 447 * May need to probe to determine latencies from CPU 0 after
446 448 * gethrtime() comes alive in cbe_init() and before enabling interrupts
447 449 * and copy and release any temporary memory allocated with BOP_ALLOC()
448 450 * before release_bootstrap() frees boot memory
449 451 */
450 452 lgrp_init(LGRP_INIT_STAGE3);
451 453
452 454 /*
453 455 * Call all system initialization functions.
454 456 */
455 457 for (initptr = &init_tbl[0]; *initptr; initptr++)
456 458 (**initptr)();
457 459 /*
458 460 * Load iSCSI boot properties
459 461 */
460 462 ld_ib_prop();
461 463 /*
462 464 * initialize vm related stuff.
463 465 */
464 466 vm_init();
465 467
466 468 /*
467 469 * initialize buffer pool for raw I/O requests
468 470 */
469 471 physio_bufs_init();
470 472
471 473 ttolwp(curthread)->lwp_error = 0; /* XXX kludge for SCSI driver */
472 474
473 475 /*
474 476 * Drop the interrupt level and allow interrupts. At this point
475 477 * the DDI guarantees that interrupts are enabled.
476 478 */
477 479 (void) spl0();
478 480 interrupts_unleashed = 1;
479 481
480 482 /*
481 483 * Create kmem cache for proc structures
482 484 */
483 485 process_cache = kmem_cache_create("process_cache", sizeof (proc_t),
484 486 0, NULL, NULL, NULL, NULL, NULL, 0);
485 487
486 488 vfs_mountroot(); /* Mount the root file system */
487 489 errorq_init(); /* after vfs_mountroot() so DDI root is ready */
488 490 cpu_kstat_init(CPU); /* after vfs_mountroot() so TOD is valid */
489 491 ddi_walk_devs(ddi_root_node(), pm_adjust_timestamps, NULL);
490 492 /* after vfs_mountroot() so hrestime is valid */
491 493
492 494 post_startup();
493 495 swaploaded = 1;
494 496
495 497 /*
496 498 * Initialize Solaris Audit Subsystem
497 499 */
498 500 audit_init();
499 501
500 502 /*
501 503 * Plumb the protocol modules and drivers only if we are not
502 504 * networked booted, in this case we already did it in rootconf().
503 505 */
504 506 if (netboot == 0 && iscsiboot_prop == NULL)
505 507 (void) strplumb();
506 508
507 509 gethrestime(&PTOU(curproc)->u_start);
508 510 curthread->t_start = PTOU(curproc)->u_start.tv_sec;
509 511 p->p_mstart = gethrtime();
510 512
511 513 /*
512 514 * Perform setup functions that can only be done after root
513 515 * and swap have been set up.
514 516 */
515 517 consconfig();
516 518 #ifndef __sparc
517 519 release_bootstrap();
518 520 #endif
519 521
520 522 /*
521 523 * attach drivers with ddi-forceattach prop
522 524 * It must be done early enough to load hotplug drivers (e.g.
523 525 * pcmcia nexus) so that devices enumerated via hotplug is
524 526 * available before I/O subsystem is fully initialized.
525 527 */
526 528 i_ddi_forceattach_drivers();
527 529
528 530 /*
529 531 * Set the scan rate and other parameters of the paging subsystem.
530 532 */
531 533 setupclock(0);
532 534
533 535 /*
534 536 * Initialize process 0's lwp directory and lwpid hash table.
535 537 */
536 538 p->p_lwpdir = p->p_lwpfree = p0_lwpdir;
537 539 p->p_lwpdir->ld_next = p->p_lwpdir + 1;
538 540 p->p_lwpdir_sz = 2;
539 541 p->p_tidhash = p0_tidhash;
540 542 p->p_tidhash_sz = 2;
541 543 p0_lep.le_thread = curthread;
542 544 p0_lep.le_lwpid = curthread->t_tid;
543 545 p0_lep.le_start = curthread->t_start;
544 546 lwp_hash_in(p, &p0_lep, p0_tidhash, 2, 0);
545 547
546 548 /*
547 549 * Initialize extended accounting.
548 550 */
549 551 exacct_init();
550 552
551 553 /*
552 554 * Initialize threads of sysevent event channels
553 555 */
554 556 sysevent_evc_thrinit();
555 557
556 558 /*
557 559 * This must be done after post_startup() but before
558 560 * start_other_cpus()
559 561 */
560 562 lgrp_init(LGRP_INIT_STAGE4);
561 563
562 564 /*
563 565 * Perform MP initialization, if any.
564 566 */
565 567 start_other_cpus(0);
566 568
567 569 #ifdef __sparc
568 570 /*
569 571 * Release bootstrap here since PROM interfaces are
570 572 * used to start other CPUs above.
571 573 */
572 574 release_bootstrap();
573 575 #endif
574 576
575 577 /*
576 578 * Finish lgrp initialization after all CPUS are brought online.
577 579 */
578 580 lgrp_init(LGRP_INIT_STAGE5);
579 581
580 582 /*
581 583 * After mp_init(), number of cpus are known (this is
582 584 * true for the time being, when there are actually
583 585 * hot pluggable cpus then this scheme would not do).
584 586 * Any per cpu initialization is done here.
585 587 */
586 588 kmem_mp_init();
587 589 vmem_update(NULL);
588 590
589 591 clock_tick_init_post();
590 592
591 593 for (initptr = &mp_init_tbl[0]; *initptr; initptr++)
592 594 (**initptr)();
593 595
594 596 /*
595 597 * These must be called after start_other_cpus
596 598 */
597 599 pm_cfb_setup_intr();
598 600 #if defined(__x86)
599 601 fastboot_post_startup();
600 602 #endif
601 603
602 604 /*
603 605 * Make init process; enter scheduling loop with system process.
604 606 *
605 607 * Note that we manually assign the pids for these processes, for
606 608 * historical reasons. If more pre-assigned pids are needed,
607 609 * FAMOUS_PIDS will have to be updated.
608 610 */
609 611
610 612 /* create init process */
611 613 if (newproc(start_init, NULL, defaultcid, 59, NULL,
612 614 FAMOUS_PID_INIT))
613 615 panic("main: unable to fork init.");
614 616
↓ open down ↓ |
239 lines elided |
↑ open up ↑ |
615 617 /* create pageout daemon */
616 618 if (newproc(pageout, NULL, syscid, maxclsyspri - 1, NULL,
617 619 FAMOUS_PID_PAGEOUT))
618 620 panic("main: unable to fork pageout()");
619 621
620 622 /* create fsflush daemon */
621 623 if (newproc(fsflush, NULL, syscid, minclsyspri, NULL,
622 624 FAMOUS_PID_FSFLUSH))
623 625 panic("main: unable to fork fsflush()");
624 626
627 + /* create interrupt balancer process */
628 + if (newproc(interrupt_balancer, NULL, syscid, minclsyspri, NULL, 0))
629 + panic("main: unable to fork interrupt_balancer()");
630 +
625 631 /* create cluster process if we're a member of one */
626 632 if (cluster_bootflags & CLUSTER_BOOTED) {
627 633 if (newproc(cluster_wrapper, NULL, syscid, minclsyspri,
628 634 NULL, 0)) {
629 635 panic("main: unable to fork cluster()");
630 636 }
631 637 }
632 638
633 639 /*
634 640 * Create system threads (threads are associated with p0)
635 641 */
636 642
637 643 /* create module uninstall daemon */
638 644 /* BugID 1132273. If swapping over NFS need a bigger stack */
639 645 (void) thread_create(NULL, 0, (void (*)())mod_uninstall_daemon,
640 646 NULL, 0, &p0, TS_RUN, minclsyspri);
641 647
642 648 (void) thread_create(NULL, 0, seg_pasync_thread,
643 649 NULL, 0, &p0, TS_RUN, minclsyspri);
644 650
645 651 pid_setmin();
646 652
647 653 /* system is now ready */
648 654 mutex_exit(&ualock);
649 655
650 656 bcopy("sched", PTOU(curproc)->u_psargs, 6);
651 657 bcopy("sched", PTOU(curproc)->u_comm, 5);
652 658 sched();
653 659 /* NOTREACHED */
654 660 }
↓ open down ↓ |
20 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX