diff options
Diffstat (limited to 'include/litmus/litmus_softirq.h')
-rw-r--r-- | include/litmus/litmus_softirq.h | 92 |
1 files changed, 90 insertions, 2 deletions
diff --git a/include/litmus/litmus_softirq.h b/include/litmus/litmus_softirq.h index 37804fcfe8a3..6d1f85c2e093 100644 --- a/include/litmus/litmus_softirq.h +++ b/include/litmus/litmus_softirq.h | |||
@@ -1,11 +1,99 @@ | |||
1 | |||
2 | #include <linux/interrupt.h> | 1 | #include <linux/interrupt.h> |
3 | 2 | ||
3 | /* | ||
4 | Threaded tasklet handling for Litmus. Tasklets | ||
5 | are scheduled with the priority of the tasklet's | ||
6 | owner-- that is, the RT task on behalf the tasklet | ||
7 | runs. | ||
8 | |||
9 | Tasklets are current scheduled in FIFO order with | ||
10 | NO priority inheritance for "blocked" tasklets. | ||
11 | |||
12 | klitirqd assumes the priority of the owner of the | ||
13 | tasklet when the tasklet is next to execute. | ||
14 | |||
15 | Currently, hi-tasklets are scheduled before | ||
16 | low-tasklets, regardless of priority of low-tasklets. | ||
17 | This priority inversion probably needs to be fixed, | ||
18 | though it is not an issue if our work with GPUs as | ||
19 | GPUs are owned (and associated klitirqds) for | ||
20 | exclusive time periods, thus no inversions can | ||
21 | occur. | ||
22 | |||
23 | FIXME: Let low-tasklets with higher Litmus priority | ||
24 | be scheduled before hi-tasklets of lower Litmus | ||
25 | priority. | ||
26 | |||
27 | TODO: Decide if tasklets should really be scheduled | ||
28 | FIFO. If not, we should probably ensure tasklets with | ||
29 | the same owner still execute in FIFO order lest we | ||
30 | confuse drivers with out-of-order execution (though | ||
31 | they probably should still be able to handle it by | ||
32 | tasklet processing design). | ||
33 | */ | ||
34 | |||
35 | |||
36 | |||
4 | #define NR_LITMUS_SOFTIRQD CONFIG_NR_LITMUS_SOFTIRQD | 37 | #define NR_LITMUS_SOFTIRQD CONFIG_NR_LITMUS_SOFTIRQD |
5 | 38 | ||
6 | void trigger_litirqs(struct task_struct*); | ||
7 | 39 | ||
40 | //void trigger_litirqs(struct task_struct*); | ||
41 | |||
42 | /* Spawns NR_LITMUS_SOFTIRQD klitirqd daemons. | ||
43 | Actual launch of threads is deffered to kworker's | ||
44 | workqueue, so daemons will likely not be immediately | ||
45 | running when this function returns, though the required | ||
46 | data will be initialized. */ | ||
8 | void spawn_klitirqd(void); | 47 | void spawn_klitirqd(void); |
9 | 48 | ||
49 | |||
50 | /* Raises a flag to tell klitirqds to terminate. | ||
51 | Termination is async, so some threads may be running | ||
52 | after function return. */ | ||
10 | void kill_klitirqd(void); | 53 | void kill_klitirqd(void); |
11 | 54 | ||
55 | |||
56 | /* Returns 1 if all NR_LITMUS_SOFTIRQD klitirqs are ready | ||
57 | to handle tasklets. 0, otherwise.*/ | ||
58 | int klitirqd_is_ready(void); | ||
59 | |||
60 | |||
61 | void __litmus_tasklet_schedule( | ||
62 | struct tasklet_struct *t, | ||
63 | unsigned int k_id); | ||
64 | |||
65 | /* schedule a tasklet on klitirqd #k_id */ | ||
66 | static inline void litmus_tasklet_schedule( | ||
67 | struct tasklet_struct *t, | ||
68 | unsigned int k_id) | ||
69 | { | ||
70 | if (!test_and_set_bit(TASKLET_STATE_SCHED, &t->state)) | ||
71 | __litmus_tasklet_schedule(t, k_id); | ||
72 | } | ||
73 | |||
74 | |||
75 | extern void __litmus_tasklet_hi_schedule(struct tasklet_struct *t, | ||
76 | unsigned int k_id); | ||
77 | |||
78 | /* schedule a hi tasklet on klitirqd #k_id */ | ||
79 | static inline void litmus_tasklet_hi_schedule(struct tasklet_struct *t, | ||
80 | unsigned int k_id) | ||
81 | { | ||
82 | if (!test_and_set_bit(TASKLET_STATE_SCHED, &t->state)) | ||
83 | __litmus_tasklet_hi_schedule(t, k_id); | ||
84 | } | ||
85 | |||
86 | |||
87 | extern void __litmus_tasklet_hi_schedule_first( | ||
88 | struct tasklet_struct *t, | ||
89 | unsigned int k_id); | ||
90 | |||
91 | /* schedule a hi tasklet on klitirqd #k_id on next go-around */ | ||
92 | /* PRECONDITION: Interrupts must be disabled. */ | ||
93 | static inline void litmus_tasklet_hi_schedule_first( | ||
94 | struct tasklet_struct *t, | ||
95 | unsigned int k_id) | ||
96 | { | ||
97 | if (!test_and_set_bit(TASKLET_STATE_SCHED, &t->state)) | ||
98 | __litmus_tasklet_hi_schedule_first(t, k_id); | ||
99 | } \ No newline at end of file | ||