Print this page
3625 we only need one thread_create_intr
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/disp/thread_intr.c
+++ new/usr/src/uts/common/disp/thread_intr.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
↓ open down ↓ |
16 lines elided |
↑ open up ↑ |
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 2006 Sun Microsystems, Inc. All rights reserved.
24 24 * Use is subject to license terms.
25 25 */
26 26
27 -/*
28 - * FILE NOTICE BEGIN
29 - *
30 - * This file should not be modified. If you wish to modify it or have it
31 - * modified, please contact Sun Microsystems at <LFI149367@-sun-.-com->
32 - * (without anti-spam dashes)
33 - *
34 - * FILE NOTICE END
35 - */
36 -
37 -#pragma ident "%Z%%M% %I% %E% SMI"
38 -
39 27 #include <sys/cpuvar.h>
40 28 #include <sys/stack.h>
41 29 #include <vm/seg_kp.h>
42 30 #include <sys/proc.h>
43 31 #include <sys/pset.h>
44 32 #include <sys/sysmacros.h>
45 33
46 34 /*
47 35 * Create and initialize an interrupt thread.
48 36 */
49 37 static void
50 38 thread_create_intr(cpu_t *cp)
51 39 {
52 40 kthread_t *tp;
53 41
54 42 tp = thread_create(NULL, 0,
55 43 (void (*)())thread_create_intr, NULL, 0, &p0, TS_ONPROC, 0);
56 44
57 45 /*
58 46 * Set the thread in the TS_FREE state. The state will change
59 47 * to TS_ONPROC only while the interrupt is active. Think of these
60 48 * as being on a private free list for the CPU. Being TS_FREE keeps
61 49 * inactive interrupt threads out of debugger thread lists.
62 50 *
63 51 * We cannot call thread_create with TS_FREE because of the current
64 52 * checks there for ONPROC. Fix this when thread_create takes flags.
65 53 */
66 54 THREAD_FREEINTR(tp, cp);
67 55
68 56 /*
69 57 * Nobody should ever reference the credentials of an interrupt
70 58 * thread so make it NULL to catch any such references.
71 59 */
72 60 tp->t_cred = NULL;
73 61 tp->t_flag |= T_INTR_THREAD;
74 62 tp->t_cpu = cp;
75 63 tp->t_bound_cpu = cp;
76 64 tp->t_disp_queue = cp->cpu_disp;
77 65 tp->t_affinitycnt = 1;
78 66 tp->t_preempt = 1;
79 67
80 68 /*
81 69 * Don't make a user-requested binding on this thread so that
82 70 * the processor can be offlined.
83 71 */
84 72 tp->t_bind_cpu = PBIND_NONE; /* no USER-requested binding */
85 73 tp->t_bind_pset = PS_NONE;
86 74
87 75 #if defined(__i386) || defined(__amd64)
88 76 tp->t_stk -= STACK_ALIGN;
89 77 *(tp->t_stk) = 0; /* terminate intr thread stack */
90 78 #endif
91 79
92 80 /*
93 81 * Link onto CPU's interrupt pool.
94 82 */
95 83 tp->t_link = cp->cpu_intr_thread;
96 84 cp->cpu_intr_thread = tp;
97 85 }
98 86
99 87 /*
100 88 * Allocate a given number of interrupt threads for a given CPU.
101 89 * These threads will get freed by cpu_destroy_bound_threads()
102 90 * when CPU gets unconfigured.
↓ open down ↓ |
54 lines elided |
↑ open up ↑ |
103 91 */
104 92 void
105 93 cpu_intr_alloc(cpu_t *cp, int n)
106 94 {
107 95 int i;
108 96
109 97 for (i = 0; i < n; i++)
110 98 thread_create_intr(cp);
111 99
112 100 cp->cpu_intr_stack = (caddr_t)segkp_get(segkp, INTR_STACK_SIZE,
113 - KPD_HASREDZONE | KPD_NO_ANON | KPD_LOCKED) +
114 - INTR_STACK_SIZE - SA(MINFRAME);
101 + KPD_HASREDZONE | KPD_NO_ANON | KPD_LOCKED) +
102 + INTR_STACK_SIZE - SA(MINFRAME);
115 103 }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX