52 #include <sys/vmsystm.h>
53 #include <sys/time.h>
54 #include <sys/policy.h>
55 #include <sys/sdt.h>
56 #include <sys/cpupart.h>
57 #include <sys/modctl.h>
58
59 static pri_t rt_init(id_t, int, classfuncs_t **);
60
61 static struct sclass csw = {
62 "RT",
63 rt_init,
64 0
65 };
66
67 static struct modlsched modlsched = {
68 &mod_schedops, "realtime scheduling class", &csw
69 };
70
71 static struct modlinkage modlinkage = {
72 MODREV_1, (void *)&modlsched, NULL
73 };
74
75 int
76 _init()
77 {
78 return (mod_install(&modlinkage));
79 }
80
81 int
82 _fini()
83 {
84 return (EBUSY); /* don't remove RT for now */
85 }
86
87 int
88 _info(struct modinfo *modinfop)
89 {
90 return (mod_info(&modlinkage, modinfop));
91 }
92
132 static void rt_tick(kthread_t *);
133 static void rt_wakeup(kthread_t *);
134 static pri_t rt_swapin(kthread_t *, int);
135 static pri_t rt_swapout(kthread_t *, int);
136 static pri_t rt_globpri(kthread_t *);
137 static void rt_yield(kthread_t *);
138 static int rt_alloc(void **, int);
139 static void rt_free(void *);
140
141 static void rt_change_priority(kthread_t *, rtproc_t *);
142
143 static id_t rt_cid; /* real-time class ID */
144 static rtproc_t rt_plisthead; /* dummy rtproc at head of rtproc list */
145 static kmutex_t rt_dptblock; /* protects realtime dispatch table */
146 static kmutex_t rt_list_lock; /* protects RT thread list */
147
148 extern rtdpent_t *rt_getdptbl(void);
149
150 static struct classfuncs rt_classfuncs = {
151 /* class ops */
152 rt_admin,
153 rt_getclinfo,
154 rt_parmsin,
155 rt_parmsout,
156 rt_vaparmsin,
157 rt_vaparmsout,
158 rt_getclpri,
159 rt_alloc,
160 rt_free,
161 /* thread ops */
162 rt_enterclass,
163 rt_exitclass,
164 rt_canexit,
165 rt_fork,
166 rt_forkret,
167 rt_parmsget,
168 rt_parmsset,
169 rt_nullsys, /* stop */
170 rt_nullsys, /* exit */
171 rt_nullsys, /* active */
172 rt_nullsys, /* inactive */
173 rt_swapin,
174 rt_swapout,
175 rt_nullsys, /* trapret */
176 rt_preempt,
177 rt_setrun,
178 rt_nullsys, /* sleep */
179 rt_tick,
180 rt_wakeup,
181 rt_donice,
182 rt_globpri,
183 rt_nullsys, /* set_process_group */
184 rt_yield,
185 rt_doprio,
186 };
187
188 /*
189 * Real-time class initialization. Called by dispinit() at boot time.
190 * We can ignore the clparmsz argument since we know that the smallest
191 * possible parameter buffer is big enough for us.
192 */
193 /* ARGSUSED */
194 pri_t
195 rt_init(id_t cid, int clparmsz, classfuncs_t **clfuncspp)
196 {
197 rt_dptbl = rt_getdptbl();
198 rt_cid = cid; /* Record our class ID */
199
200 /*
201 * Initialize the rtproc list.
202 */
203 rt_plisthead.rt_next = rt_plisthead.rt_prev = &rt_plisthead;
204
205 /*
|
52 #include <sys/vmsystm.h>
53 #include <sys/time.h>
54 #include <sys/policy.h>
55 #include <sys/sdt.h>
56 #include <sys/cpupart.h>
57 #include <sys/modctl.h>
58
59 static pri_t rt_init(id_t, int, classfuncs_t **);
60
61 static struct sclass csw = {
62 "RT",
63 rt_init,
64 0
65 };
66
67 static struct modlsched modlsched = {
68 &mod_schedops, "realtime scheduling class", &csw
69 };
70
71 static struct modlinkage modlinkage = {
72 MODREV_1, { (void *)&modlsched, NULL }
73 };
74
75 int
76 _init()
77 {
78 return (mod_install(&modlinkage));
79 }
80
81 int
82 _fini()
83 {
84 return (EBUSY); /* don't remove RT for now */
85 }
86
87 int
88 _info(struct modinfo *modinfop)
89 {
90 return (mod_info(&modlinkage, modinfop));
91 }
92
132 static void rt_tick(kthread_t *);
133 static void rt_wakeup(kthread_t *);
134 static pri_t rt_swapin(kthread_t *, int);
135 static pri_t rt_swapout(kthread_t *, int);
136 static pri_t rt_globpri(kthread_t *);
137 static void rt_yield(kthread_t *);
138 static int rt_alloc(void **, int);
139 static void rt_free(void *);
140
141 static void rt_change_priority(kthread_t *, rtproc_t *);
142
143 static id_t rt_cid; /* real-time class ID */
144 static rtproc_t rt_plisthead; /* dummy rtproc at head of rtproc list */
145 static kmutex_t rt_dptblock; /* protects realtime dispatch table */
146 static kmutex_t rt_list_lock; /* protects RT thread list */
147
148 extern rtdpent_t *rt_getdptbl(void);
149
150 static struct classfuncs rt_classfuncs = {
151 /* class ops */
152 { rt_admin,
153 rt_getclinfo,
154 rt_parmsin,
155 rt_parmsout,
156 rt_vaparmsin,
157 rt_vaparmsout,
158 rt_getclpri,
159 rt_alloc,
160 rt_free },
161 /* thread ops */
162 { rt_enterclass,
163 rt_exitclass,
164 rt_canexit,
165 rt_fork,
166 rt_forkret,
167 rt_parmsget,
168 rt_parmsset,
169 rt_nullsys, /* stop */
170 rt_nullsys, /* exit */
171 rt_nullsys, /* active */
172 rt_nullsys, /* inactive */
173 rt_swapin,
174 rt_swapout,
175 rt_nullsys, /* trapret */
176 rt_preempt,
177 rt_setrun,
178 rt_nullsys, /* sleep */
179 rt_tick,
180 rt_wakeup,
181 rt_donice,
182 rt_globpri,
183 rt_nullsys, /* set_process_group */
184 rt_yield,
185 rt_doprio },
186 };
187
188 /*
189 * Real-time class initialization. Called by dispinit() at boot time.
190 * We can ignore the clparmsz argument since we know that the smallest
191 * possible parameter buffer is big enough for us.
192 */
193 /* ARGSUSED */
194 pri_t
195 rt_init(id_t cid, int clparmsz, classfuncs_t **clfuncspp)
196 {
197 rt_dptbl = rt_getdptbl();
198 rt_cid = cid; /* Record our class ID */
199
200 /*
201 * Initialize the rtproc list.
202 */
203 rt_plisthead.rt_next = rt_plisthead.rt_prev = &rt_plisthead;
204
205 /*
|