50 #include <sys/spl.h>
51 #include <sys/modctl.h>
52 #include <sys/policy.h>
53 #include <sys/sdt.h>
54 #include <sys/cpupart.h>
55 #include <sys/cpucaps.h>
56
57 static pri_t fx_init(id_t, int, classfuncs_t **);
58
59 static struct sclass csw = {
60 "FX",
61 fx_init,
62 0
63 };
64
65 static struct modlsched modlsched = {
66 &mod_schedops, "Fixed priority sched class", &csw
67 };
68
69 static struct modlinkage modlinkage = {
70 MODREV_1, (void *)&modlsched, NULL
71 };
72
73
74 /*
75 * control flags (kparms->fx_cflags).
76 */
77 #define FX_DOUPRILIM 0x01 /* change user priority limit */
78 #define FX_DOUPRI 0x02 /* change user priority */
79 #define FX_DOTQ 0x04 /* change FX time quantum */
80
81
82 #define FXMAXUPRI 60 /* maximum user priority setting */
83
84 #define FX_MAX_UNPRIV_PRI 0 /* maximum unpriviledge priority */
85
86 /*
87 * The fxproc_t structures that have a registered callback vector,
88 * are also kept in an array of circular doubly linked lists. A hash on
89 * the thread id (from ddi_get_kt_did()) is used to determine which list
90 * each of such fxproc structures should be placed. Each list has a dummy
187 static void fx_preempt(kthread_t *);
188 static void fx_setrun(kthread_t *);
189 static void fx_sleep(kthread_t *);
190 static void fx_tick(kthread_t *);
191 static void fx_wakeup(kthread_t *);
192 static int fx_donice(kthread_t *, cred_t *, int, int *);
193 static int fx_doprio(kthread_t *, cred_t *, int, int *);
194 static pri_t fx_globpri(kthread_t *);
195 static void fx_yield(kthread_t *);
196 static void fx_nullsys();
197
198 extern fxdpent_t *fx_getdptbl(void);
199
200 static void fx_change_priority(kthread_t *, fxproc_t *);
201 static fxproc_t *fx_list_lookup(kt_did_t);
202 static void fx_list_release(fxproc_t *);
203
204
205 static struct classfuncs fx_classfuncs = {
206 /* class functions */
207 fx_admin,
208 fx_getclinfo,
209 fx_parmsin,
210 fx_parmsout,
211 fx_vaparmsin,
212 fx_vaparmsout,
213 fx_getclpri,
214 fx_alloc,
215 fx_free,
216
217 /* thread functions */
218 fx_enterclass,
219 fx_exitclass,
220 fx_canexit,
221 fx_fork,
222 fx_forkret,
223 fx_parmsget,
224 fx_parmsset,
225 fx_stop,
226 fx_exit,
227 fx_nullsys, /* active */
228 fx_nullsys, /* inactive */
229 fx_swapin,
230 fx_swapout,
231 fx_trapret,
232 fx_preempt,
233 fx_setrun,
234 fx_sleep,
235 fx_tick,
236 fx_wakeup,
237 fx_donice,
238 fx_globpri,
239 fx_nullsys, /* set_process_group */
240 fx_yield,
241 fx_doprio,
242 };
243
244
245 int
246 _init()
247 {
248 return (mod_install(&modlinkage));
249 }
250
251 int
252 _fini()
253 {
254 return (EBUSY);
255 }
256
257 int
258 _info(struct modinfo *modinfop)
259 {
260 return (mod_info(&modlinkage, modinfop));
261 }
|
50 #include <sys/spl.h>
51 #include <sys/modctl.h>
52 #include <sys/policy.h>
53 #include <sys/sdt.h>
54 #include <sys/cpupart.h>
55 #include <sys/cpucaps.h>
56
57 static pri_t fx_init(id_t, int, classfuncs_t **);
58
59 static struct sclass csw = {
60 "FX",
61 fx_init,
62 0
63 };
64
65 static struct modlsched modlsched = {
66 &mod_schedops, "Fixed priority sched class", &csw
67 };
68
69 static struct modlinkage modlinkage = {
70 MODREV_1, { (void *)&modlsched, NULL }
71 };
72
73
74 /*
75 * control flags (kparms->fx_cflags).
76 */
77 #define FX_DOUPRILIM 0x01 /* change user priority limit */
78 #define FX_DOUPRI 0x02 /* change user priority */
79 #define FX_DOTQ 0x04 /* change FX time quantum */
80
81
82 #define FXMAXUPRI 60 /* maximum user priority setting */
83
84 #define FX_MAX_UNPRIV_PRI 0 /* maximum unpriviledge priority */
85
86 /*
87 * The fxproc_t structures that have a registered callback vector,
88 * are also kept in an array of circular doubly linked lists. A hash on
89 * the thread id (from ddi_get_kt_did()) is used to determine which list
90 * each of such fxproc structures should be placed. Each list has a dummy
187 static void fx_preempt(kthread_t *);
188 static void fx_setrun(kthread_t *);
189 static void fx_sleep(kthread_t *);
190 static void fx_tick(kthread_t *);
191 static void fx_wakeup(kthread_t *);
192 static int fx_donice(kthread_t *, cred_t *, int, int *);
193 static int fx_doprio(kthread_t *, cred_t *, int, int *);
194 static pri_t fx_globpri(kthread_t *);
195 static void fx_yield(kthread_t *);
196 static void fx_nullsys();
197
198 extern fxdpent_t *fx_getdptbl(void);
199
200 static void fx_change_priority(kthread_t *, fxproc_t *);
201 static fxproc_t *fx_list_lookup(kt_did_t);
202 static void fx_list_release(fxproc_t *);
203
204
205 static struct classfuncs fx_classfuncs = {
206 /* class functions */
207 { fx_admin,
208 fx_getclinfo,
209 fx_parmsin,
210 fx_parmsout,
211 fx_vaparmsin,
212 fx_vaparmsout,
213 fx_getclpri,
214 fx_alloc,
215 fx_free },
216
217 /* thread functions */
218 { fx_enterclass,
219 fx_exitclass,
220 fx_canexit,
221 fx_fork,
222 fx_forkret,
223 fx_parmsget,
224 fx_parmsset,
225 fx_stop,
226 fx_exit,
227 fx_nullsys, /* active */
228 fx_nullsys, /* inactive */
229 fx_swapin,
230 fx_swapout,
231 fx_trapret,
232 fx_preempt,
233 fx_setrun,
234 fx_sleep,
235 fx_tick,
236 fx_wakeup,
237 fx_donice,
238 fx_globpri,
239 fx_nullsys, /* set_process_group */
240 fx_yield,
241 fx_doprio },
242 };
243
244
245 int
246 _init()
247 {
248 return (mod_install(&modlinkage));
249 }
250
251 int
252 _fini()
253 {
254 return (EBUSY);
255 }
256
257 int
258 _info(struct modinfo *modinfop)
259 {
260 return (mod_info(&modlinkage, modinfop));
261 }
|