Commit e67c71d8 authored by Philippe Gerum's avatar Philippe Gerum
Browse files

evl/wait: remove more recursively (nk)locked paths



Signed-off-by: Philippe Gerum's avatarPhilippe Gerum <rpm@xenomai.org>
parent 19070b87
......@@ -134,6 +134,8 @@ struct evl_thread *evl_wake_up_head(struct evl_wait_queue *wq)
return evl_wake_up(wq, NULL);
}
void evl_flush_wait_locked(struct evl_wait_queue *wq, int reason);
void evl_flush_wait(struct evl_wait_queue *wq, int reason);
void evl_abort_wait(struct evl_thread *thread,
......
......@@ -51,12 +51,13 @@ void evl_up(struct evl_ksem *sem)
{
unsigned long flags;
if (evl_wake_up_head(&sem->wait_queue))
evl_schedule();
else {
xnlock_get_irqsave(&nklock, flags);
xnlock_get_irqsave(&nklock, flags);
if (!evl_wake_up_head(&sem->wait_queue))
sem->value++;
xnlock_put_irqrestore(&nklock, flags);
}
xnlock_put_irqrestore(&nklock, flags);
evl_schedule();
}
EXPORT_SYMBOL_GPL(evl_up);
......@@ -147,7 +147,7 @@ static void wakeup_waiters(struct evl_monitor *event)
if ((state->flags & EVL_MONITOR_SIGNALED) &&
evl_wait_active(&event->wait_queue)) {
if (bcast)
evl_flush_wait(&event->wait_queue, 0);
evl_flush_wait_locked(&event->wait_queue, 0);
else if (state->flags & EVL_MONITOR_TARGETED) {
evl_for_each_waiter_safe(waiter, n,
&event->wait_queue) {
......
......@@ -35,6 +35,7 @@ void evl_destroy_wait(struct evl_wait_queue *wq)
}
EXPORT_SYMBOL_GPL(evl_destroy_wait);
/* nklock held, irqs off */
void evl_add_wait_queue(struct evl_wait_queue *wq, ktime_t timeout,
enum evl_tmode timeout_mode)
{
......@@ -56,13 +57,10 @@ void evl_add_wait_queue(struct evl_wait_queue *wq, ktime_t timeout,
}
EXPORT_SYMBOL_GPL(evl_add_wait_queue);
/* nklock held, irqs off */
struct evl_thread *evl_wake_up(struct evl_wait_queue *wq,
struct evl_thread *waiter)
{
unsigned long flags;
xnlock_get_irqsave(&nklock, flags);
trace_evl_wait_wakeup(wq);
if (list_empty(&wq->wait_list))
......@@ -74,18 +72,14 @@ struct evl_thread *evl_wake_up(struct evl_wait_queue *wq,
evl_wakeup_thread(waiter, T_PEND, 0);
}
xnlock_put_irqrestore(&nklock, flags);
return waiter;
}
EXPORT_SYMBOL_GPL(evl_wake_up);
void evl_flush_wait(struct evl_wait_queue *wq, int reason)
/* nklock held, irqs off */
void evl_flush_wait_locked(struct evl_wait_queue *wq, int reason)
{
struct evl_thread *waiter, *tmp;
unsigned long flags;
xnlock_get_irqsave(&nklock, flags);
trace_evl_wait_flush(wq);
......@@ -94,7 +88,15 @@ void evl_flush_wait(struct evl_wait_queue *wq, int reason)
&wq->wait_list, wait_next)
evl_wakeup_thread(waiter, T_PEND, reason);
}
}
EXPORT_SYMBOL_GPL(evl_flush_wait_locked);
void evl_flush_wait(struct evl_wait_queue *wq, int reason)
{
unsigned long flags;
xnlock_get_irqsave(&nklock, flags);
evl_flush_wait_locked(wq, reason);
xnlock_put_irqrestore(&nklock, flags);
}
EXPORT_SYMBOL_GPL(evl_flush_wait);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment