diff options
author | John M. Calandrino <jmc@jupiter-cs.cs.unc.edu> | 2007-04-24 14:12:24 -0400 |
---|---|---|
committer | John M. Calandrino <jmc@jupiter-cs.cs.unc.edu> | 2007-04-24 14:12:24 -0400 |
commit | 9866b27f4820219f939d4d2e8bc2cdce5c6797e9 (patch) | |
tree | 1cb6da1312680b26339c17b13a7b2d8cda1bf939 /arch | |
parent | 7bf3583ed15c745f295099a0d1ac4b087a2ddcf6 (diff) |
Fixed a number of issues, subtle and otherwise, with PI semaphores.
PI semaphores now use scheduler callbacks to update priority on a down or
up call. Issues with calling down/up and not calling __down_failed or
__up_wakeup for PI semaphores has been noted (since priority-related things
occured in those calls) and up has been fixed (down is in process).
Callbacks are now responsible for the priority checks and
updates, and some subtle cases are handled that were missed before. Still
need to finish handling GSN-EDF implementation issues related to suspensions.
Diffstat (limited to 'arch')
-rw-r--r-- | arch/i386/kernel/pi_sem_syscalls.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/arch/i386/kernel/pi_sem_syscalls.c b/arch/i386/kernel/pi_sem_syscalls.c index f7a66da110..cab8270984 100644 --- a/arch/i386/kernel/pi_sem_syscalls.c +++ b/arch/i386/kernel/pi_sem_syscalls.c | |||
@@ -38,7 +38,8 @@ asmlinkage long sys_pi_sema_init (void) | |||
38 | atomic_set(&pi_sems[sem_id].count, 1); | 38 | atomic_set(&pi_sems[sem_id].count, 1); |
39 | pi_sems[sem_id].sleepers = 0; | 39 | pi_sems[sem_id].sleepers = 0; |
40 | init_waitqueue_head(&pi_sems[sem_id].wait); | 40 | init_waitqueue_head(&pi_sems[sem_id].wait); |
41 | pi_sems[sem_id].sem_hp_task = NULL; | 41 | pi_sems[sem_id].hp_sem_task = NULL; |
42 | pi_sems[sem_id].holder = NULL; | ||
42 | return sem_id; | 43 | return sem_id; |
43 | } | 44 | } |
44 | } | 45 | } |
@@ -78,15 +79,16 @@ asmlinkage long sys_pi_down(pi_sema_id sem_id) | |||
78 | } | 79 | } |
79 | 80 | ||
80 | /* | 81 | /* |
81 | * Note! This is subtle. We jump to wake people up only if | 82 | * We always jump to wake people and update semaphore priority. |
82 | * the semaphore was negative (== somebody was waiting on it). | 83 | * If the wait queue is empty, semaphore and priority update will |
84 | * still operate correctly. | ||
83 | */ | 85 | */ |
84 | void __sys_pi_up(struct pi_semaphore * sem) | 86 | void __sys_pi_up(struct pi_semaphore * sem) |
85 | { | 87 | { |
86 | __asm__ __volatile__( | 88 | __asm__ __volatile__( |
87 | "# atomic up operation\n\t" | 89 | "# atomic up operation\n\t" |
88 | LOCK_PREFIX "incl %0\n\t" /* ++sem->count */ | 90 | LOCK_PREFIX "incl %0\n\t" /* ++sem->count */ |
89 | "jg 1f\n\t" | 91 | /* "jg 1f\n\t" *** removed, always call wakeup *** */ |
90 | "lea %0,%%eax\n\t" | 92 | "lea %0,%%eax\n\t" |
91 | "call __pi_up_wakeup\n" | 93 | "call __pi_up_wakeup\n" |
92 | "1:" | 94 | "1:" |