aboutsummaryrefslogtreecommitdiffstats
path: root/litmus
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@cs.unc.edu>2008-05-01 12:29:05 -0400
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2008-05-01 12:29:05 -0400
commit4e492c03dbe0a29fd21569fe6c1295c73f1f403f (patch)
treed843c17d8a9f7a7bb726d8d04b5bbf4653a7cc7e /litmus
parent7d9d731677836b9e8e71271f8dd01bb35ab62062 (diff)
FMLP: rename pi->fmlp
pi is confusing, there are many PI schemes in the world. We implement the FMLP, thus we should label it as such.
Diffstat (limited to 'litmus')
-rw-r--r--litmus/fdso.c4
-rw-r--r--litmus/fmlp.c76
2 files changed, 23 insertions, 57 deletions
diff --git a/litmus/fdso.c b/litmus/fdso.c
index ca9557d877..966b6e9e87 100644
--- a/litmus/fdso.c
+++ b/litmus/fdso.c
@@ -18,11 +18,11 @@
18 18
19#include <litmus/fdso.h> 19#include <litmus/fdso.h>
20 20
21extern struct fdso_ops pi_sem_ops; 21extern struct fdso_ops fmlp_sem_ops;
22extern struct fdso_ops srp_sem_ops; 22extern struct fdso_ops srp_sem_ops;
23 23
24static const struct fdso_ops* fdso_ops[] = { 24static const struct fdso_ops* fdso_ops[] = {
25 &pi_sem_ops, 25 &fmlp_sem_ops,
26 &srp_sem_ops, 26 &srp_sem_ops,
27}; 27};
28 28
diff --git a/litmus/fmlp.c b/litmus/fmlp.c
index b40e42e9e0..1c359c21c2 100644
--- a/litmus/fmlp.c
+++ b/litmus/fmlp.c
@@ -20,7 +20,7 @@
20/* PRIORITY INHERITANCE */ 20/* PRIORITY INHERITANCE */
21/* ************************************************************************** */ 21/* ************************************************************************** */
22 22
23static void* create_pi_semaphore(void) 23static void* create_fmlp_semaphore(void)
24{ 24{
25 struct pi_semaphore* sem; 25 struct pi_semaphore* sem;
26 int i; 26 int i;
@@ -38,15 +38,23 @@ static void* create_pi_semaphore(void)
38 return sem; 38 return sem;
39} 39}
40 40
41static void destroy_pi_semaphore(void* sem) 41static int open_fmlp_semaphore(struct od_table_entry* entry, void* __user arg)
42{
43 if (!fmlp_active())
44 return -EBUSY;
45 return 0;
46}
47
48static void destroy_fmlp_semaphore(void* sem)
42{ 49{
43 /* XXX assert invariants */ 50 /* XXX assert invariants */
44 kfree(sem); 51 kfree(sem);
45} 52}
46 53
47struct fdso_ops pi_sem_ops = { 54struct fdso_ops fmlp_sem_ops = {
48 .create = create_pi_semaphore, 55 .create = create_fmlp_semaphore,
49 .destroy = destroy_pi_semaphore 56 .open = open_fmlp_semaphore,
57 .destroy = destroy_fmlp_semaphore
50}; 58};
51 59
52struct wq_pair { 60struct wq_pair {
@@ -120,7 +128,7 @@ int edf_set_hp_cpu_task(struct pi_semaphore *sem, int cpu)
120 return ret; 128 return ret;
121} 129}
122 130
123int do_pi_down(struct pi_semaphore* sem) 131int do_fmlp_down(struct pi_semaphore* sem)
124{ 132{
125 unsigned long flags; 133 unsigned long flags;
126 struct task_struct *tsk = current; 134 struct task_struct *tsk = current;
@@ -179,7 +187,7 @@ int do_pi_down(struct pi_semaphore* sem)
179 return suspended; 187 return suspended;
180} 188}
181 189
182void do_pi_up(struct pi_semaphore* sem) 190void do_fmlp_up(struct pi_semaphore* sem)
183{ 191{
184 unsigned long flags; 192 unsigned long flags;
185 193
@@ -195,7 +203,7 @@ void do_pi_up(struct pi_semaphore* sem)
195 spin_unlock_irqrestore(&sem->wait.lock, flags); 203 spin_unlock_irqrestore(&sem->wait.lock, flags);
196} 204}
197 205
198asmlinkage long sys_pi_down(int sem_od) 206asmlinkage long sys_fmlp_down(int sem_od)
199{ 207{
200 long ret = 0; 208 long ret = 0;
201 struct pi_semaphore * sem; 209 struct pi_semaphore * sem;
@@ -204,9 +212,9 @@ asmlinkage long sys_pi_down(int sem_od)
204 preempt_disable(); 212 preempt_disable();
205 TS_PI_DOWN_START; 213 TS_PI_DOWN_START;
206 214
207 sem = lookup_pi_sem(sem_od); 215 sem = lookup_fmlp_sem(sem_od);
208 if (sem) 216 if (sem)
209 suspended = do_pi_down(sem); 217 suspended = do_fmlp_down(sem);
210 else 218 else
211 ret = -EINVAL; 219 ret = -EINVAL;
212 220
@@ -218,7 +226,7 @@ asmlinkage long sys_pi_down(int sem_od)
218 return ret; 226 return ret;
219} 227}
220 228
221asmlinkage long sys_pi_up(int sem_od) 229asmlinkage long sys_fmlp_up(int sem_od)
222{ 230{
223 long ret = 0; 231 long ret = 0;
224 struct pi_semaphore * sem; 232 struct pi_semaphore * sem;
@@ -226,9 +234,9 @@ asmlinkage long sys_pi_up(int sem_od)
226 preempt_disable(); 234 preempt_disable();
227 TS_PI_UP_START; 235 TS_PI_UP_START;
228 236
229 sem = lookup_pi_sem(sem_od); 237 sem = lookup_fmlp_sem(sem_od);
230 if (sem) 238 if (sem)
231 do_pi_up(sem); 239 do_fmlp_up(sem);
232 else 240 else
233 ret = -EINVAL; 241 ret = -EINVAL;
234 242
@@ -238,45 +246,3 @@ asmlinkage long sys_pi_up(int sem_od)
238 246
239 return ret; 247 return ret;
240} 248}
241
242/* Clear wait queue and wakeup waiting tasks, and free semaphore. */
243/*
244asmlinkage long sys_pi_sema_free(int sem_id)
245{
246 struct list_head *tmp, *next;
247 unsigned long flags;
248
249 if (sem_id < 0 || sem_id >= MAX_PI_SEMAPHORES)
250 return -EINVAL;
251
252 if (!pi_sems[sem_id].used)
253 return -EINVAL;
254
255 spin_lock_irqsave(&pi_sems[sem_id].wait.lock, flags);
256 if (waitqueue_active(&pi_sems[sem_id].wait)) {
257 list_for_each_safe(tmp, next,
258 &pi_sems[sem_id].wait.task_list) {
259 wait_queue_t *curr = list_entry(tmp, wait_queue_t,
260 task_list);
261 list_del(tmp);
262 set_rt_flags((struct task_struct*)curr->private,
263 RT_F_EXIT_SEM);
264 curr->func(curr,
265 TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE,
266 0, NULL);
267 }
268 }
269
270 spin_unlock_irqrestore(&pi_sems[sem_id].wait.lock, flags);
271 pi_sems[sem_id].used = 0;
272
273 return 0;
274}
275*/
276
277
278
279/* ************************************************************************** */
280
281
282