From: Balasubramanian Manoharan <[email protected]>

Implementation for odp_schedule_order_unlock_lock() function.

Signed-off-by: Balasubramanian Manoharan <[email protected]>
---
/** Email created from pull request 129 (bala-manoharan:api_sched_order_lock)
 ** https://github.com/Linaro/odp/pull/129
 ** Patch: https://github.com/Linaro/odp/pull/129.patch
 ** Base sha: 3547226b19e6982bf74fc8c258b89db2c5f6a39c
 ** Merge commit sha: bc70981ada1c2036b39488e85df1fe350acb718d
 **/
 platform/linux-generic/include/odp_schedule_if.h |  1 +
 platform/linux-generic/odp_schedule_if.c         |  6 ++++++
 platform/linux-generic/odp_schedule_iquery.c     |  1 +
 platform/linux-generic/odp_schedule_scalable.c   | 22 ++++++++++++++++++++++
 platform/linux-generic/odp_schedule_sp.c         |  5 +++++
 5 files changed, 35 insertions(+)

diff --git a/platform/linux-generic/include/odp_schedule_if.h 
b/platform/linux-generic/include/odp_schedule_if.h
index 657993b1..e54727a8 100644
--- a/platform/linux-generic/include/odp_schedule_if.h
+++ b/platform/linux-generic/include/odp_schedule_if.h
@@ -81,6 +81,7 @@ typedef struct {
        void (*schedule_resume)(void);
        void (*schedule_release_atomic)(void);
        void (*schedule_release_ordered)(void);
+       void (*schedule_release_context)(void);
        void (*schedule_prefetch)(int);
        int (*schedule_num_prio)(void);
        odp_schedule_group_t (*schedule_group_create)(const char *,
diff --git a/platform/linux-generic/odp_schedule_if.c 
b/platform/linux-generic/odp_schedule_if.c
index 2f07aafe..e2d33d58 100644
--- a/platform/linux-generic/odp_schedule_if.c
+++ b/platform/linux-generic/odp_schedule_if.c
@@ -127,3 +127,9 @@ 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_release_context();
+       sched_api->schedule_order_lock(lock_index);
+}
diff --git a/platform/linux-generic/odp_schedule_iquery.c 
b/platform/linux-generic/odp_schedule_iquery.c
index 86f5d53e..8a5976c4 100644
--- a/platform/linux-generic/odp_schedule_iquery.c
+++ b/platform/linux-generic/odp_schedule_iquery.c
@@ -1356,6 +1356,7 @@ const schedule_api_t schedule_iquery_api = {
        .schedule_resume          = schedule_resume,
        .schedule_release_atomic  = schedule_release_atomic,
        .schedule_release_ordered = schedule_release_ordered,
+       .schedule_release_context = schedule_release_context,
        .schedule_prefetch        = schedule_prefetch,
        .schedule_num_prio        = number_of_priorites,
        .schedule_group_create    = schedule_group_create,
diff --git a/platform/linux-generic/odp_schedule_scalable.c 
b/platform/linux-generic/odp_schedule_scalable.c
index 78159b53..3cd9722f 100644
--- a/platform/linux-generic/odp_schedule_scalable.c
+++ b/platform/linux-generic/odp_schedule_scalable.c
@@ -1055,6 +1055,27 @@ static void schedule_release_ordered(void)
                _schedule_release_ordered(ts);
 }
 
+static void schedule_release_context(void)
+{
+       sched_scalable_thread_state_t *ts;
+
+       ts = sched_ts;
+       if (ts->rctx != NULL)
+               _schedule_release_ordered(ts);
+       else if (odp_likely(ts->atomq != NULL)) {
+#ifdef CONFIG_QSCHST_LOCK
+               sched_elem_t *atomq;
+
+               atomq = ts->atomq;
+               LOCK(&atomq->qschlock);
+#endif
+               _schedule_release_atomic(ts);
+#ifdef CONFIG_QSCHST_LOCK
+               UNLOCK(&atomq->qschlock);
+#endif
+       }
+}
+
 static int schedule_multi(odp_queue_t *from, uint64_t wait, odp_event_t ev[],
                          int num)
 {
@@ -1966,6 +1987,7 @@ const schedule_api_t schedule_scalable_api = {
        .schedule_resume                = schedule_resume,
        .schedule_release_atomic        = schedule_release_atomic,
        .schedule_release_ordered       = schedule_release_ordered,
+       .schedule_release_context       = schedule_release_context,
        .schedule_prefetch              = schedule_prefetch,
        .schedule_num_prio              = schedule_num_prio,
        .schedule_group_create          = schedule_group_create,
diff --git a/platform/linux-generic/odp_schedule_sp.c 
b/platform/linux-generic/odp_schedule_sp.c
index 9829acc5..47e99c1b 100644
--- a/platform/linux-generic/odp_schedule_sp.c
+++ b/platform/linux-generic/odp_schedule_sp.c
@@ -608,6 +608,10 @@ static void schedule_release_ordered(void)
 {
 }
 
+static void schedule_release_context(void)
+{
+}
+
 static void schedule_prefetch(int num)
 {
        (void)num;
@@ -856,6 +860,7 @@ const schedule_api_t schedule_sp_api = {
        .schedule_resume          = schedule_resume,
        .schedule_release_atomic  = schedule_release_atomic,
        .schedule_release_ordered = schedule_release_ordered,
+       .schedule_release_context = schedule_release_context,
        .schedule_prefetch        = schedule_prefetch,
        .schedule_num_prio        = schedule_num_prio,
        .schedule_group_create    = schedule_group_create,

Reply via email to