From eeab5bc5e159f2da9a79f368f3d36012f06a9b01 Mon Sep 17 00:00:00 2001 From: Glenn Elliott Date: Tue, 29 Jan 2013 00:20:37 -0500 Subject: BUG IKGLP: Count replica holders as in FIFO Tasks that immediatly acquired a free replica were not being counted as being in the FIFOs. --- litmus/ikglp_lock.c | 107 ++-------------------------------------------------- 1 file changed, 3 insertions(+), 104 deletions(-) diff --git a/litmus/ikglp_lock.c b/litmus/ikglp_lock.c index 57be5db5f1be..fe242c789318 100644 --- a/litmus/ikglp_lock.c +++ b/litmus/ikglp_lock.c @@ -629,6 +629,9 @@ static void ikglp_get_immediate(struct task_struct* t, ++(fq->count); + // even though we got the replica, we're still considered in the fifo + ++(sem->nr_in_fifos); + ikglp_add_global_list(sem, t, &fq->global_heap_node); ikglp_add_donees(sem, fq, t, &fq->donee_heap_node); @@ -1014,110 +1017,6 @@ acquired: return replica; } -//int ikglp_lock(struct litmus_lock* l) -//{ -// struct task_struct* t = current; -// struct ikglp_semaphore *sem = ikglp_from_lock(l); -// unsigned long flags = 0, real_flags; -// struct fifo_queue *fq = NULL; -// int replica = -EINVAL; -// -//#ifdef CONFIG_LITMUS_DGL_SUPPORT -// raw_spinlock_t *dgl_lock; -//#endif -// -// ikglp_wait_state_t wait; -// -// if (!is_realtime(t)) -// return -EPERM; -// -//#ifdef CONFIG_LITMUS_DGL_SUPPORT -// dgl_lock = litmus->get_dgl_spinlock(t); -//#endif -// -// raw_spin_lock_irqsave(&sem->real_lock, real_flags); -// -// lock_global_irqsave(dgl_lock, flags); -// lock_fine_irqsave(&sem->lock, flags); -// -// -//#ifdef CONFIG_LITMUS_AFFINITY_LOCKING -// fq = (sem->aff_obs) ? -// sem->aff_obs->ops->advise_enqueue(sem->aff_obs, t) : -// sem->shortest_fifo_queue; -//#else -// fq = sem->shortest_fifo_queue; -//#endif -// -// if(fq->count == 0) { -// // take available resource -// replica = ikglp_get_idx(sem, fq); -// -// ikglp_get_immediate(t, fq, sem, flags); // unlocks sem->lock -// -// unlock_global_irqrestore(dgl_lock, flags); -// raw_spin_unlock_irqrestore(&sem->real_lock, real_flags); -// } -// else -// { -// // we have to suspend. -// -// wait.task = t; // THIS IS CRITICALLY IMPORTANT!!! -// -// tsk_rt(t)->blocked_lock = (struct litmus_lock*)sem; // record where we are blocked -// mb(); -// -// /* FIXME: interruptible would be nice some day */ -// set_task_state(t, TASK_UNINTERRUPTIBLE); -// -// if(fq->count < sem->max_fifo_len) { -// // enqueue on fq -// ikglp_enqueue_on_fq(sem, fq, &wait, flags); // unlocks sem->lock -// } -// else { -// -// TRACE_CUR("IKGLP fifo queues are full (at least they better be).\n"); -// -// // no room in fifos. Go to PQ or donors. -// -// if(litmus->__compare(ikglp_mth_highest(sem), BASE, t, BASE)) { -// // enqueue on PQ -// ikglp_enqueue_on_pq(sem, &wait); -// unlock_fine_irqrestore(&sem->lock, flags); -// } -// else { -// // enqueue as donor -// ikglp_enqueue_on_donor(sem, &wait, flags); // unlocks sem->lock -// } -// } -// -// unlock_global_irqrestore(dgl_lock, flags); -// raw_spin_unlock_irqrestore(&sem->real_lock, real_flags); -// -// TS_LOCK_SUSPEND; -// -// schedule(); -// -// TS_LOCK_RESUME; -// -// fq = ikglp_get_queue(sem, t); -// BUG_ON(!fq); -// -// replica = ikglp_get_idx(sem, fq); -// } -// -// TRACE_CUR("Acquired lock %d, queue %d\n", -// l->ident, replica); -// -//#ifdef CONFIG_LITMUS_AFFINITY_LOCKING -// if(sem->aff_obs) { -// return sem->aff_obs->ops->replica_to_resource(sem->aff_obs, fq); -// } -//#endif -// -// return replica; -//} - static void ikglp_move_donor_to_fq(struct ikglp_semaphore *sem, struct fifo_queue *fq, ikglp_wait_state_t *donor_info) -- cgit v1.2.2