diff mbox series

[API-NEXT,v2,2/2] linux-gen: schedule: implements async ordered lock

Message ID 1517846409-7604-3-git-send-email-odpbot@yandex.ru
State Superseded
Headers show
Series [API-NEXT,v2,1/2] api: schedule: add asynchronous order lock | expand

Commit Message

Github ODP bot Feb. 5, 2018, 4 p.m. UTC
From: Balasubramanian Manoharan <bala.manoharan@linaro.org>


implements asynchronous order context lock

Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>

---
/** Email created from pull request 453 (bala-manoharan:async_order_lock)
 ** https://github.com/Linaro/odp/pull/453
 ** Patch: https://github.com/Linaro/odp/pull/453.patch
 ** Base sha: fa6d104f6031b9687ae5f60f87f5c2338ad9a83e
 ** Merge commit sha: a50f50ab2e9af13052f4d9dc7d962b8c0c111868
 **/
 platform/linux-generic/include/odp_schedule_if.h |  6 ++++++
 platform/linux-generic/odp_schedule.c            | 14 +++++++++++++-
 platform/linux-generic/odp_schedule_if.c         | 11 +++++++++++
 platform/linux-generic/odp_schedule_iquery.c     | 14 +++++++++++++-
 platform/linux-generic/odp_schedule_scalable.c   | 12 ++++++++++++
 platform/linux-generic/odp_schedule_sp.c         | 14 +++++++++++++-
 6 files changed, 68 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/platform/linux-generic/include/odp_schedule_if.h b/platform/linux-generic/include/odp_schedule_if.h
index 8605ca663..66e050438 100644
--- a/platform/linux-generic/include/odp_schedule_if.h
+++ b/platform/linux-generic/include/odp_schedule_if.h
@@ -41,6 +41,8 @@  typedef int (*schedule_term_local_fn_t)(void);
 typedef void (*schedule_order_lock_fn_t)(void);
 typedef void (*schedule_order_unlock_fn_t)(void);
 typedef void (*schedule_order_unlock_lock_fn_t)(void);
+typedef void (*schedule_order_lock_start_fn_t)(void);
+typedef void (*schedule_order_lock_wait_fn_t)(void);
 typedef uint32_t (*schedule_max_ordered_locks_fn_t)(void);
 typedef void (*schedule_save_context_fn_t)(uint32_t queue_index);
 
@@ -60,6 +62,8 @@  typedef struct schedule_fn_t {
 	schedule_term_local_fn_t    term_local;
 	schedule_order_lock_fn_t    order_lock;
 	schedule_order_unlock_fn_t  order_unlock;
+	schedule_order_lock_start_fn_t	start_order_lock;
+	schedule_order_lock_wait_fn_t	wait_order_lock;
 	schedule_order_unlock_lock_fn_t  order_unlock_lock;
 	schedule_max_ordered_locks_fn_t max_ordered_locks;
 
@@ -105,6 +109,8 @@  typedef struct {
 	void (*schedule_order_lock)(uint32_t);
 	void (*schedule_order_unlock)(uint32_t);
 	void (*schedule_order_unlock_lock)(uint32_t, uint32_t);
+	void (*schedule_order_lock_start)(uint32_t);
+	void (*schedule_order_lock_wait)(uint32_t);
 
 } schedule_api_t;
 
diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c
index c91a93380..a6581bed8 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -1152,6 +1152,16 @@  static void schedule_order_unlock_lock(uint32_t unlock_index,
 	schedule_order_lock(lock_index);
 }
 
+static void schedule_order_lock_start(uint32_t lock_index)
+{
+	(void)lock_index;
+}
+
+static void schedule_order_lock_wait(uint32_t lock_index)
+{
+	schedule_order_lock(lock_index);
+}
+
 static void schedule_pause(void)
 {
 	sched_local.pause = 1;
@@ -1438,5 +1448,7 @@  const schedule_api_t schedule_default_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
+	.schedule_order_unlock_lock    = schedule_order_unlock_lock,
+	.schedule_order_lock_start	= schedule_order_lock_start,
+	.schedule_order_lock_wait      = schedule_order_lock_wait
 };
diff --git a/platform/linux-generic/odp_schedule_if.c b/platform/linux-generic/odp_schedule_if.c
index e5f734aea..6a3b4e4ba 100644
--- a/platform/linux-generic/odp_schedule_if.c
+++ b/platform/linux-generic/odp_schedule_if.c
@@ -134,3 +134,14 @@  void odp_schedule_order_unlock_lock(uint32_t unlock_index, uint32_t lock_index)
 {
 	sched_api->schedule_order_unlock_lock(unlock_index, lock_index);
 }
+
+void odp_schedule_order_lock_start(uint32_t lock_index)
+{
+	sched_api->schedule_order_lock_start(lock_index);
+}
+
+void odp_schedule_order_lock_wait(uint32_t lock_index)
+{
+	sched_api->schedule_order_lock_wait(lock_index);
+}
+
diff --git a/platform/linux-generic/odp_schedule_iquery.c b/platform/linux-generic/odp_schedule_iquery.c
index 02396aa05..3ce85394e 100644
--- a/platform/linux-generic/odp_schedule_iquery.c
+++ b/platform/linux-generic/odp_schedule_iquery.c
@@ -1308,6 +1308,16 @@  static uint32_t schedule_max_ordered_locks(void)
 	return CONFIG_QUEUE_MAX_ORD_LOCKS;
 }
 
+static void schedule_order_lock_start(uint32_t lock_index)
+{
+	(void)lock_index;
+}
+
+static void schedule_order_lock_wait(uint32_t lock_index)
+{
+	schedule_order_lock(lock_index);
+}
+
 static inline bool is_atomic_queue(unsigned int queue_index)
 {
 	return (sched->queues[queue_index].sync == ODP_SCHED_SYNC_ATOMIC);
@@ -1376,7 +1386,9 @@  const schedule_api_t schedule_iquery_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
+	.schedule_order_unlock_lock    = schedule_order_unlock_lock,
+	.schedule_order_lock_start	= schedule_order_lock_start,
+	.schedule_order_lock_wait	= schedule_order_lock_wait
 };
 
 static void thread_set_interest(sched_thread_local_t *thread,
diff --git a/platform/linux-generic/odp_schedule_scalable.c b/platform/linux-generic/odp_schedule_scalable.c
index 761f93d3f..f5974442d 100644
--- a/platform/linux-generic/odp_schedule_scalable.c
+++ b/platform/linux-generic/odp_schedule_scalable.c
@@ -1186,6 +1186,16 @@  static void schedule_order_unlock_lock(uint32_t unlock_index,
 	schedule_order_lock(lock_index);
 }
 
+static void schedule_order_lock_start(uint32_t lock_index)
+{
+	(void)lock_index;
+}
+
+static void schedule_order_lock_wait(uint32_t lock_index)
+{
+	schedule_order_lock(lock_index);
+}
+
 static void schedule_release_atomic(void)
 {
 	sched_scalable_thread_state_t *ts;
@@ -2096,4 +2106,6 @@  const schedule_api_t schedule_scalable_api = {
 	.schedule_order_lock		= schedule_order_lock,
 	.schedule_order_unlock		= schedule_order_unlock,
 	.schedule_order_unlock_lock	= schedule_order_unlock_lock,
+	.schedule_order_lock_start	= schedule_order_lock_start,
+	.schedule_order_lock_wait	= schedule_order_lock_wait
 };
diff --git a/platform/linux-generic/odp_schedule_sp.c b/platform/linux-generic/odp_schedule_sp.c
index bad47cad9..e46ae4480 100644
--- a/platform/linux-generic/odp_schedule_sp.c
+++ b/platform/linux-generic/odp_schedule_sp.c
@@ -829,6 +829,16 @@  static void schedule_order_unlock_lock(uint32_t unlock_index,
 	(void)lock_index;
 }
 
+static void schedule_order_lock_start(uint32_t lock_index)
+{
+	(void)lock_index;
+}
+
+static void schedule_order_lock_wait(uint32_t lock_index)
+{
+	(void)lock_index;
+}
+
 static void order_lock(void)
 {
 }
@@ -879,5 +889,7 @@  const schedule_api_t schedule_sp_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
+	.schedule_order_unlock_lock	= schedule_order_unlock_lock,
+	.schedule_order_lock_start	= schedule_order_lock_start,
+	.schedule_order_lock_wait	= schedule_order_lock_wait
 };