diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-06-13 22:54:33 -0400 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-06-13 22:54:33 -0400 |
commit | 63360ea7ec23f403462e5335d4a3aed9d756a24e (patch) | |
tree | 25535ae302ca39f2f1168f4aa94017b2fdf0908d /include | |
parent | 42cbfb1aecca6482f278e640ea4af21f02a775f9 (diff) |
Added syscall hooks, 'finished' produce/consume code.
Diffstat (limited to 'include')
-rw-r--r-- | include/litmus/litmus.h | 20 | ||||
-rw-r--r-- | include/litmus/pgm.h | 28 | ||||
-rw-r--r-- | include/litmus/rt_param.h | 19 | ||||
-rw-r--r-- | include/litmus/unistd_32.h | 6 | ||||
-rw-r--r-- | include/litmus/unistd_64.h | 12 |
5 files changed, 61 insertions, 24 deletions
diff --git a/include/litmus/litmus.h b/include/litmus/litmus.h index 683407328f5a..cfafef3a795d 100644 --- a/include/litmus/litmus.h +++ b/include/litmus/litmus.h | |||
@@ -126,26 +126,14 @@ void preempt_if_preemptable(struct task_struct* t, int on_cpu); | |||
126 | (is_pgm(t) && \ | 126 | (is_pgm(t) && \ |
127 | tsk_rt(t)->pgm_params.produce != NULL && \ | 127 | tsk_rt(t)->pgm_params.produce != NULL && \ |
128 | tsk_rt(t)->pgm_params.consume == NULL) | 128 | tsk_rt(t)->pgm_params.consume == NULL) |
129 | #define is_pgm_sink(t) \ | ||
130 | (is_pgm(t) && \ | ||
131 | tsk_rt(t)->pgm_params.produce == NULL && \ | ||
132 | tsk_rt(t)->pgm_params.consume != NULL) | ||
133 | #define is_pgm_intermediate(t) \ | 129 | #define is_pgm_intermediate(t) \ |
134 | (is_pgm(t) && \ | 130 | (is_pgm(t) && \ |
135 | tsk_rt(t)->pgm_params.produce != NULL && \ | 131 | tsk_rt(t)->pgm_params.produce != NULL && \ |
136 | tsk_rt(t)->pgm_params.consume != NULL) | 132 | tsk_rt(t)->pgm_params.consume != NULL) |
137 | #ifdef CONFIG_PGM | 133 | #define is_pgm_sink(t) \ |
138 | int is_pgm_satisfied(struct task_struct* t); | 134 | (is_pgm_intermediate(t) && \ |
139 | void pgm_produce(struct task_struct* t); | 135 | tsk_rt(t)->pgm_params.produce == NULL && \ |
140 | void pgm_consume(struct task_struct* t); | 136 | tsk_rt(t)->pgm_params.consume != NULL) |
141 | int pgm_complete(struct task_struct* t); | ||
142 | #else | ||
143 | /* nothing */ | ||
144 | #define is_pgm_satisfied(t) | ||
145 | #define pgm_produce(t) | ||
146 | #define pgm_consume(t) | ||
147 | #define pgm_complete(t) | ||
148 | #endif | ||
149 | 137 | ||
150 | #ifdef CONFIG_LITMUS_LOCKING | 138 | #ifdef CONFIG_LITMUS_LOCKING |
151 | void srp_ceiling_block(void); | 139 | void srp_ceiling_block(void); |
diff --git a/include/litmus/pgm.h b/include/litmus/pgm.h new file mode 100644 index 000000000000..688fc3b9bbe2 --- /dev/null +++ b/include/litmus/pgm.h | |||
@@ -0,0 +1,28 @@ | |||
1 | /* | ||
2 | * Routines for constructing and working with PGMs. | ||
3 | */ | ||
4 | |||
5 | #ifndef __UNC_PGM_H__ | ||
6 | #define __UNC_PGM_H__ | ||
7 | |||
8 | #include <linux/sched.h> | ||
9 | |||
10 | #include <litmus/litmus.h> | ||
11 | #include <litmus/rt_param.h> | ||
12 | |||
13 | int is_pgm_satisfied(struct task_struct* t); | ||
14 | |||
15 | void pgm_prepare_for_next_period(struct task_struct *t); | ||
16 | |||
17 | int pgm_complete_job(struct task_struct* t); | ||
18 | |||
19 | int do_pgm_add_edge(struct task_struct *a, int nr_gen, | ||
20 | struct task_struct *b, int nr_req); | ||
21 | int do_pgm_signal_ready(struct task_struct *src); | ||
22 | int do_pgm_set_nr_children(int nr_children); | ||
23 | int do_pgm_wait_for_children(void); | ||
24 | |||
25 | // TODO | ||
26 | //int pgm_remove_edge(struct task_struct *a, struct task_struct *b); | ||
27 | |||
28 | #endif | ||
diff --git a/include/litmus/rt_param.h b/include/litmus/rt_param.h index 613e9f98294e..a767e52882f4 100644 --- a/include/litmus/rt_param.h +++ b/include/litmus/rt_param.h | |||
@@ -77,6 +77,14 @@ struct control_page { | |||
77 | /* to be extended */ | 77 | /* to be extended */ |
78 | }; | 78 | }; |
79 | 79 | ||
80 | struct pgm_edge { | ||
81 | pid_t a; | ||
82 | int a_nr_produced; | ||
83 | |||
84 | pid_t b; | ||
85 | int b_nr_consumed; | ||
86 | }; | ||
87 | |||
80 | /* don't export internal data structures to user space (liblitmus) */ | 88 | /* don't export internal data structures to user space (liblitmus) */ |
81 | #ifdef __KERNEL__ | 89 | #ifdef __KERNEL__ |
82 | 90 | ||
@@ -100,28 +108,29 @@ struct pgm_production | |||
100 | struct pgm_produce | 108 | struct pgm_produce |
101 | { | 109 | { |
102 | unsigned long nr_productions; /* num productions/children */ | 110 | unsigned long nr_productions; /* num productions/children */ |
103 | struct pgm_production produce[0]; /* array of productions */ | 111 | struct pgm_production produce[MAX_FAN]; /* array of productions. TODO: make dyn alloc */ |
104 | }; | 112 | }; |
105 | 113 | ||
106 | struct pgm_consumption | 114 | struct pgm_consumption |
107 | { | 115 | { |
116 | /* assumption required == number consumed */ | ||
108 | unsigned long required; /* number tokens required before firing */ | 117 | unsigned long required; /* number tokens required before firing */ |
109 | long nr_tokens; /* constraint met when >= required */ | 118 | long nr_tokens; /* constraint met when >= required */ |
110 | }; | 119 | }; |
111 | 120 | ||
112 | struct pgm_consume | 121 | struct pgm_consume |
113 | { | 122 | { |
114 | spinlock_t lock; | 123 | spinlock_t lock; /* TODO: Use atomics instead of a lock. */ |
115 | unsigned long nr_consumptions; /* num of consumption constraints */ | 124 | unsigned long nr_consumptions; /* num of consumption constraints */ |
116 | unsigned long unsatisfied[NR_FAN_CHUNKS]; /* bit-array of unsatisfied constraints */ | 125 | unsigned long unsatisfied[NR_FAN_CHUNKS]; /* bit-array of unsatisfied constraints */ |
117 | struct pgm_consumption consume[0]; /* array of consumption constraints */ | 126 | struct pgm_consumption consume[MAX_FAN]; /* array of consumption constraints. TODO: make dyn alloc */ |
118 | //atomic_t nr_pending_release; | ||
119 | }; | 127 | }; |
120 | 128 | ||
121 | struct rt_pgm { | 129 | struct rt_pgm { |
122 | struct pgm_produce *produce; /* output and current state */ | 130 | struct pgm_produce *produce; /* output and current state */ |
123 | struct pgm_consume *consume; /* input constraints and current state */ | 131 | struct pgm_consume *consume; /* input constraints and current state */ |
124 | struct task_struct *src; /* only not NULL if task is sink */ | 132 | struct task_struct *root; /* root node of the PGM */ |
133 | // struct task_struct *src; /* only not NULL if task is sink */ | ||
125 | }; | 134 | }; |
126 | 135 | ||
127 | #endif /* end PGM */ | 136 | #endif /* end PGM */ |
diff --git a/include/litmus/unistd_32.h b/include/litmus/unistd_32.h index 94264c27d9ac..92e733c42041 100644 --- a/include/litmus/unistd_32.h +++ b/include/litmus/unistd_32.h | |||
@@ -17,5 +17,9 @@ | |||
17 | #define __NR_wait_for_ts_release __LSC(9) | 17 | #define __NR_wait_for_ts_release __LSC(9) |
18 | #define __NR_release_ts __LSC(10) | 18 | #define __NR_release_ts __LSC(10) |
19 | #define __NR_null_call __LSC(11) | 19 | #define __NR_null_call __LSC(11) |
20 | #define __NR_add_pgm_edge __LSC(12) | ||
21 | #define __NR_pgm_signal_ready __LSC(13) | ||
22 | #define __NR_pgm_set_nr_children __LSC(14) | ||
23 | #define __NR_pgm_wait_for_children __LSC(15) | ||
20 | 24 | ||
21 | #define NR_litmus_syscalls 12 | 25 | #define NR_litmus_syscalls 16 |
diff --git a/include/litmus/unistd_64.h b/include/litmus/unistd_64.h index d5ced0d2642c..84125395dfe6 100644 --- a/include/litmus/unistd_64.h +++ b/include/litmus/unistd_64.h | |||
@@ -27,7 +27,15 @@ __SYSCALL(__NR_wait_for_job_release, sys_wait_for_job_release) | |||
27 | __SYSCALL(__NR_wait_for_ts_release, sys_wait_for_ts_release) | 27 | __SYSCALL(__NR_wait_for_ts_release, sys_wait_for_ts_release) |
28 | #define __NR_release_ts __LSC(10) | 28 | #define __NR_release_ts __LSC(10) |
29 | __SYSCALL(__NR_release_ts, sys_release_ts) | 29 | __SYSCALL(__NR_release_ts, sys_release_ts) |
30 | #define __NR_null_call __LSC(11) | 30 | #define __NR_null_call __LSC(11) |
31 | __SYSCALL(__NR_null_call, sys_null_call) | 31 | __SYSCALL(__NR_null_call, sys_null_call) |
32 | #define __NR_add_pgm_edge __LSC(12) | ||
33 | __SYSCALL(__NR_add_pgm_edge, sys_add_pgm_edge) | ||
34 | #define __NR_pgm_signal_ready __LSC(13) | ||
35 | __SYSCALL(__NR_pgm_signal_ready, sys_pgm_signal_ready) | ||
36 | #define __NR_pgm_set_nr_children __LSC(14) | ||
37 | __SYSCALL(__NR_pgm_set_nr_children, sys_pgm_set_nr_children) | ||
38 | #define __NR_pgm_wait_for_children __LSC(15) | ||
39 | __SYSCALL(__NR_pgm_wait_for_children, sys_pgm_wait_for_children) | ||
32 | 40 | ||
33 | #define NR_litmus_syscalls 12 | 41 | #define NR_litmus_syscalls 16 |