From 4e492c03dbe0a29fd21569fe6c1295c73f1f403f Mon Sep 17 00:00:00 2001 From: "Bjoern B. Brandenburg" Date: Thu, 1 May 2008 12:29:05 -0400 Subject: 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. --- arch/x86/kernel/syscall_table_32.S | 4 +- include/asm-x86/unistd_32.h | 6 +-- include/litmus/fdso.h | 4 +- litmus/fdso.c | 4 +- litmus/fmlp.c | 76 +++++++++++--------------------------- 5 files changed, 30 insertions(+), 64 deletions(-) diff --git a/arch/x86/kernel/syscall_table_32.S b/arch/x86/kernel/syscall_table_32.S index d8106dca4e..aee6fb9b79 100644 --- a/arch/x86/kernel/syscall_table_32.S +++ b/arch/x86/kernel/syscall_table_32.S @@ -332,8 +332,8 @@ ENTRY(sys_call_table) .long sys_exit_np .long sys_od_open /* 330 */ .long sys_od_close - .long sys_pi_down - .long sys_pi_up + .long sys_fmlp_down + .long sys_fmlp_up .long sys_srp_down .long sys_srp_up /* 335 */ .long sys_reg_task_srp_sem diff --git a/include/asm-x86/unistd_32.h b/include/asm-x86/unistd_32.h index dbd936a38d..d2bc5e56b0 100644 --- a/include/asm-x86/unistd_32.h +++ b/include/asm-x86/unistd_32.h @@ -337,8 +337,8 @@ #define __NR_exit_np 329 #define __NR_od_open 330 #define __NR_od_close 331 -#define __NR_pi_down 332 -#define __NR_pi_up 333 +#define __NR_fmlp_down 332 +#define __NR_fmlp_up 333 #define __NR_srp_down 334 #define __NR_srp_up 335 #define __NR_reg_task_srp_sem 336 @@ -349,7 +349,7 @@ #ifdef __KERNEL__ -#define NR_syscalls 339 +#define NR_syscalls 340 #define __ARCH_WANT_IPC_PARSE_VERSION #define __ARCH_WANT_OLD_READDIR diff --git a/include/litmus/fdso.h b/include/litmus/fdso.h index 5a783555e7..286e10f86d 100644 --- a/include/litmus/fdso.h +++ b/include/litmus/fdso.h @@ -16,7 +16,7 @@ typedef enum { MIN_OBJ_TYPE = 0, - PI_SEM = 0, + FMLP_SEM = 0, SRP_SEM = 1, MAX_OBJ_TYPE = 1 @@ -61,7 +61,7 @@ static inline void* od_lookup(int od, obj_type_t type) return e && e->obj->type == type ? e->obj->obj : NULL; } -#define lookup_pi_sem(od) ((struct pi_semaphore*) od_lookup(od, PI_SEM)) +#define lookup_fmlp_sem(od)((struct pi_semaphore*) od_lookup(od, FMLP_SEM)) #define lookup_srp_sem(od) ((struct srp_semaphore*) od_lookup(od, SRP_SEM)) #define lookup_ics(od) ((struct ics*) od_lookup(od, ICS_ID)) 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 @@ #include -extern struct fdso_ops pi_sem_ops; +extern struct fdso_ops fmlp_sem_ops; extern struct fdso_ops srp_sem_ops; static const struct fdso_ops* fdso_ops[] = { - &pi_sem_ops, + &fmlp_sem_ops, &srp_sem_ops, }; 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 @@ /* PRIORITY INHERITANCE */ /* ************************************************************************** */ -static void* create_pi_semaphore(void) +static void* create_fmlp_semaphore(void) { struct pi_semaphore* sem; int i; @@ -38,15 +38,23 @@ static void* create_pi_semaphore(void) return sem; } -static void destroy_pi_semaphore(void* sem) +static int open_fmlp_semaphore(struct od_table_entry* entry, void* __user arg) +{ + if (!fmlp_active()) + return -EBUSY; + return 0; +} + +static void destroy_fmlp_semaphore(void* sem) { /* XXX assert invariants */ kfree(sem); } -struct fdso_ops pi_sem_ops = { - .create = create_pi_semaphore, - .destroy = destroy_pi_semaphore +struct fdso_ops fmlp_sem_ops = { + .create = create_fmlp_semaphore, + .open = open_fmlp_semaphore, + .destroy = destroy_fmlp_semaphore }; struct wq_pair { @@ -120,7 +128,7 @@ int edf_set_hp_cpu_task(struct pi_semaphore *sem, int cpu) return ret; } -int do_pi_down(struct pi_semaphore* sem) +int do_fmlp_down(struct pi_semaphore* sem) { unsigned long flags; struct task_struct *tsk = current; @@ -179,7 +187,7 @@ int do_pi_down(struct pi_semaphore* sem) return suspended; } -void do_pi_up(struct pi_semaphore* sem) +void do_fmlp_up(struct pi_semaphore* sem) { unsigned long flags; @@ -195,7 +203,7 @@ void do_pi_up(struct pi_semaphore* sem) spin_unlock_irqrestore(&sem->wait.lock, flags); } -asmlinkage long sys_pi_down(int sem_od) +asmlinkage long sys_fmlp_down(int sem_od) { long ret = 0; struct pi_semaphore * sem; @@ -204,9 +212,9 @@ asmlinkage long sys_pi_down(int sem_od) preempt_disable(); TS_PI_DOWN_START; - sem = lookup_pi_sem(sem_od); + sem = lookup_fmlp_sem(sem_od); if (sem) - suspended = do_pi_down(sem); + suspended = do_fmlp_down(sem); else ret = -EINVAL; @@ -218,7 +226,7 @@ asmlinkage long sys_pi_down(int sem_od) return ret; } -asmlinkage long sys_pi_up(int sem_od) +asmlinkage long sys_fmlp_up(int sem_od) { long ret = 0; struct pi_semaphore * sem; @@ -226,9 +234,9 @@ asmlinkage long sys_pi_up(int sem_od) preempt_disable(); TS_PI_UP_START; - sem = lookup_pi_sem(sem_od); + sem = lookup_fmlp_sem(sem_od); if (sem) - do_pi_up(sem); + do_fmlp_up(sem); else ret = -EINVAL; @@ -238,45 +246,3 @@ asmlinkage long sys_pi_up(int sem_od) return ret; } - -/* Clear wait queue and wakeup waiting tasks, and free semaphore. */ -/* -asmlinkage long sys_pi_sema_free(int sem_id) -{ - struct list_head *tmp, *next; - unsigned long flags; - - if (sem_id < 0 || sem_id >= MAX_PI_SEMAPHORES) - return -EINVAL; - - if (!pi_sems[sem_id].used) - return -EINVAL; - - spin_lock_irqsave(&pi_sems[sem_id].wait.lock, flags); - if (waitqueue_active(&pi_sems[sem_id].wait)) { - list_for_each_safe(tmp, next, - &pi_sems[sem_id].wait.task_list) { - wait_queue_t *curr = list_entry(tmp, wait_queue_t, - task_list); - list_del(tmp); - set_rt_flags((struct task_struct*)curr->private, - RT_F_EXIT_SEM); - curr->func(curr, - TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE, - 0, NULL); - } - } - - spin_unlock_irqrestore(&pi_sems[sem_id].wait.lock, flags); - pi_sems[sem_id].used = 0; - - return 0; -} -*/ - - - -/* ************************************************************************** */ - - - -- cgit v1.2.2