@@ -95,6 +95,7 @@ typedef struct {
odp_schedule_group_info_t *);
void (*schedule_order_lock)(unsigned);
void (*schedule_order_unlock)(unsigned);
+ void (*schedule_order_unlock_lock)(unsigned);
} schedule_api_t;
@@ -127,3 +127,8 @@ void odp_schedule_order_unlock(unsigned lock_index)
{
return sched_api->schedule_order_unlock(lock_index);
}
+
+void odp_schedule_order_unlock_lock(uint32_t lock_index)
+{
+ sched_api->schedule_order_unlock_lock(lock_index);
+}
@@ -1294,6 +1294,32 @@ static void schedule_order_unlock(unsigned lock_index)
odp_atomic_store_rel_u64(ord_lock, thread_local.ordered.ctx + 1);
}
+static inline uint8_t powerof2(uint32_t n)
+{
+ return n && (! (n & (n - 1)));
+}
+
+static void schedule_order_unlock_lock(unsigned lock_index)
+{
+ uint32_t queue_index;
+ unsigned acquired_lock = 0;
+ uint32_t i;
+
+ queue_index = thread_local.ordered.src_queue;
+
+ ODP_ASSERT(queue_index != NULL_INDEX);
+
+ if (!powerof2(thread_local.ordered.lock_called.all))
+ return;
+
+ for (i = 0; i < CONFIG_QUEUE_MAX_ORD_LOCKS; i++)
+ if (1 == thread_local.ordered.lock_called.u8[i])
+ acquired_lock = i;
+
+ schedule_order_unlock(acquired_lock);
+ schedule_order_lock(lock_index);
+}
+
static unsigned schedule_max_ordered_locks(void)
{
return CONFIG_QUEUE_MAX_ORD_LOCKS;
@@ -1366,7 +1392,8 @@ const schedule_api_t schedule_iquery_api = {
.schedule_group_thrmask = schedule_group_thrmask,
.schedule_group_info = schedule_group_info,
.schedule_order_lock = schedule_order_lock,
- .schedule_order_unlock = schedule_order_unlock
+ .schedule_order_unlock = schedule_order_unlock,
+ .schedule_order_unlock_lock = schedule_order_unlock_lock
};
static void thread_set_interest(sched_thread_local_t *thread,
@@ -1027,6 +1027,11 @@ static void schedule_order_unlock(unsigned lock_index)
rctx->olock_flags |= 1U << lock_index;
}
+static void schedule_order_unlock_lock(unsigned lock_index)
+{
+ (void) lock_index;
+}
+
static void schedule_release_atomic(void)
{
sched_scalable_thread_state_t *ts;
@@ -1977,4 +1982,5 @@ const schedule_api_t schedule_scalable_api = {
.schedule_group_info = schedule_group_info,
.schedule_order_lock = schedule_order_lock,
.schedule_order_unlock = schedule_order_unlock,
+ .schedule_order_unlock_lock = schedule_order_unlock_lock,
};
@@ -817,6 +817,11 @@ static void schedule_order_unlock(unsigned lock_index)
(void)lock_index;
}
+static void schedule_order_unlock_lock(unsigned lock_index)
+{
+ (void)lock_index;
+}
+
static void order_lock(void)
{
}
@@ -866,5 +871,6 @@ const schedule_api_t schedule_sp_api = {
.schedule_group_thrmask = schedule_group_thrmask,
.schedule_group_info = schedule_group_info,
.schedule_order_lock = schedule_order_lock,
- .schedule_order_unlock = schedule_order_unlock
+ .schedule_order_unlock = schedule_order_unlock,
+ .schedule_order_unlock_lock = schedule_order_unlock_lock
};