From patchwork Mon Feb 5 15:00:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 126902 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2044826ljc; Mon, 5 Feb 2018 07:02:32 -0800 (PST) X-Google-Smtp-Source: AH8x227V0Q0ffFtgq1n6Y2cwKN00TchKOT+orsWL0zCZRzacqudhGsTv0Iiuegq/XoTFbRb/ytKq X-Received: by 10.202.8.215 with SMTP id 206mr12051165oii.249.1517842952711; Mon, 05 Feb 2018 07:02:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517842952; cv=none; d=google.com; s=arc-20160816; b=l/lh5q+8rpgTnYR+CorxmR92AvO2YeYt7Gk8JeGQ/YO1zuhfIqpG9tUhopVPLD7enK xXrfbgtY2VKMS3uNlU/hhUqkwfgwvfAghxWz9UbYz0vCfysQkaEdaZ/Phk4UnGPtTGji OKDyDqBOd9X/z6jOATsAi6giPgUDlRU1k1Kou/3YJU5eIa9B6Pd8PPgRdkF1egiRiIvp tB5WNe4cuDKmdUuGpT2EELlIJUVTXIbdZ026qevm7lq42tEZouZ1fU/qU850G8a8GYwC ufgjTG6o/B4Ip+BIaO4au9i3e/Am4xn9603Tnyq8lhTmpninQGLMK679dAMBh42nPSKY 8c3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=JMRiQYB33B4G4qEjo3ZR2gUDIw0Be0NTRtTHNrD+PKo=; b=BI3lecdqfn5u3zJaYvpwwyqAB9TJiRz6paePilUiMvDt76gztkIDJvTwGWUasgyLa/ c/VTgciYh5FF4pUMzaYeeroRl6isG91Ob6STlKnvkGr6dSDzSpA1GWRhu3a8x3P1hwiq JJDRFWw0h00wfx7avdoS8h4GWDq/CP51PVfsgg549VvYSrHSIJRQTBFGNhY/gkzK1efp sSFx1la1iVQT4tC51oDK5m6+uP/36iP6dd8g0MiSlO9k+gNC0rDvqEwHrUood2Hs1FAz t1/KBNFsvIRIIu4TV99BeWIsoUG6nZ2/9A5o8wafi4e8XOtmZcG745U7Km0wNqgw4UWE 1nsg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id k23si4231109qtb.326.2018.02.05.07.02.31; Mon, 05 Feb 2018 07:02:32 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 33C3861502; Mon, 5 Feb 2018 15:02:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id ABF2560887; Mon, 5 Feb 2018 15:02:19 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 50AD26095D; Mon, 5 Feb 2018 15:02:14 +0000 (UTC) Received: from forward100p.mail.yandex.net (forward100p.mail.yandex.net [77.88.28.100]) by lists.linaro.org (Postfix) with ESMTPS id F289060887 for ; Mon, 5 Feb 2018 15:00:34 +0000 (UTC) Received: from mxback10o.mail.yandex.net (mxback10o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::24]) by forward100p.mail.yandex.net (Yandex) with ESMTP id 051CA5101F70 for ; Mon, 5 Feb 2018 18:00:10 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback10o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id ey2hGKmeHw-09TmFG4C; Mon, 05 Feb 2018 18:00:09 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id kq2GQHioPu-09K0GDG5; Mon, 05 Feb 2018 18:00:09 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Mon, 5 Feb 2018 18:00:07 +0300 Message-Id: <1517842808-14190-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517842808-14190-1-git-send-email-odpbot@yandex.ru> References: <1517842808-14190-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 453 Subject: [lng-odp] [PATCH API-NEXT v1 1/2] api: schedule: add asynchronous order lock X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Balasubramanian Manoharan add asynchronous order lock api. schedule order context lock can be acquired asynchronously using two functions start and wait. application can utilize the cycles between these functions to increase performance. Signed-off-by: Balasubramanian Manoharan --- /** 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: d7a86f403522629f5e27827be080da34eec8d87a **/ include/odp/api/spec/schedule.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/include/odp/api/spec/schedule.h b/include/odp/api/spec/schedule.h index d493cc75f..54d0e1271 100644 --- a/include/odp/api/spec/schedule.h +++ b/include/odp/api/spec/schedule.h @@ -371,6 +371,32 @@ void odp_schedule_order_unlock(uint32_t lock_index); */ void odp_schedule_order_unlock_lock(uint32_t unlock_index, uint32_t lock_index); +/** Asynchronous ordered context lock + * Request an ordered context lock to be acquired. Starts to acquire an ordered + * context lock does not wait until the lock has been acquired. Application can + * use this call to potentially interleave some processing within waiting for + * this lock. Each start lock call must be paired with a wait call that blocks + * until the lock has been acquired. Locks cannot be acquired in nested fashion + * i.e each start call must follow a paring wait call before the next ordered + * context lock call (both sync and async). + * Implementation can acquire lock already in this phase. The same constraints + * apply as with odp_schedule_order_lock() + * + * @param lock_index Index of the ordered lock in the current context to be + * acquired. Must be in the range 0..odp_queue_lock_count() + * - 1. + * + */ +void odp_schedule_order_lock_start(uint32_t lock_index); + +/** Asynchronous ordered context lock wait + * wait for a previously started lock acquire operation to finish. + * Lock index must match with the previous start call. This may be a no + * operation, if implementation acquired the lock already during the start + * call. + */ +void odp_schedule_order_lock_wait(uint32_t lock_index); + /** * @} */ From patchwork Mon Feb 5 15:00:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 126901 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2043556ljc; Mon, 5 Feb 2018 07:01:24 -0800 (PST) X-Google-Smtp-Source: AH8x224FBsjBc7cVH+hjpJWh5AWLmBLPt5gSxXLW/Vj/nq90YS55CJ7rRZD6NIo9ShcYkiKkDb9w X-Received: by 10.55.15.149 with SMTP id 21mr30004946qkp.0.1517842876593; Mon, 05 Feb 2018 07:01:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517842876; cv=none; d=google.com; s=arc-20160816; b=ThELRpdf174ooUk9/8826hgcJOo/QxxRn8N+HOTWnFN+90OPqxr5hnxI4v2S+0hjfX i7aMsU6tmMT5q6sfGuSOElUxIJTCMK0uat8bXC2eB470kMgKs/CSwpn0z0CTuhPIR3VN lGC797IxZtPHlA56l9bd2AuzdbLBq2c2hbyBsOqOCec0d5V+oq8WGmkVmTSGvSNBpu4I dFLoRIQ1UzrXsDdX2nDVtbi3/1fZeo8dRAIvxgVtFH7SmEka9QIrhb9pROfcSuwrJrvD UcOo9uQsUMw4taRFz8I50FthNwtUCYVXe7Obpb1tW+4prahiBsw/SZ+zGLgr7HvYo5/s AcRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=816OJPjX+3aCUIENxU5RAgyoyOq68+lfCScnMzUhr/E=; b=NeooPRPd4O99cx3tyFx8QTqXdjt6hlX2Ea/XOkn80lUODNtjn4HYVfNxv5pXWbt2IY Yot3gKiGX738jCMc/i3d7PqvjVprGc9XZHsJCh/A/LdoZ/TN7by7pPtoXqtaqhN8pOWj wuvCZYU9lHADjf/kFeBwhKgy9wW9YYSs4XbhEvbb4Tc2Msr6o6oBh486XLn7IFI8v0A7 L5kR5OMh1sPz5DYgXi4fYonDg4k7/rS8KhwpLtLhTzJ0rRatAkrvsdM1SZDfJZBNRunO fHdJOceQrLm2b4DAl+jJ9ST88oWEjOrtzLSEkQ8WjiBrhtZGjog69eo73kI+ODkNTL9R CTQg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id s4si206215qta.222.2018.02.05.07.01.14; Mon, 05 Feb 2018 07:01:16 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 5F03361700; Mon, 5 Feb 2018 15:01:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 9E4E060949; Mon, 5 Feb 2018 15:00:31 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 85C9860887; Mon, 5 Feb 2018 15:00:21 +0000 (UTC) Received: from forward106o.mail.yandex.net (forward106o.mail.yandex.net [37.140.190.187]) by lists.linaro.org (Postfix) with ESMTPS id A670260887 for ; Mon, 5 Feb 2018 15:00:14 +0000 (UTC) Received: from mxback7j.mail.yandex.net (mxback7j.mail.yandex.net [IPv6:2a02:6b8:0:1619::110]) by forward106o.mail.yandex.net (Yandex) with ESMTP id B7106782D31 for ; Mon, 5 Feb 2018 18:00:10 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback7j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id VtVweooOIv-0Av8EaUW; Mon, 05 Feb 2018 18:00:10 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id kq2GQHioPu-0AKqBf99; Mon, 05 Feb 2018 18:00:10 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Mon, 5 Feb 2018 18:00:08 +0300 Message-Id: <1517842808-14190-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517842808-14190-1-git-send-email-odpbot@yandex.ru> References: <1517842808-14190-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 453 Subject: [lng-odp] [PATCH API-NEXT v1 2/2] linux-gen: schedule: implements async ordered lock X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Balasubramanian Manoharan implements asynchronous order context lock Signed-off-by: Balasubramanian Manoharan --- /** 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: d7a86f403522629f5e27827be080da34eec8d87a **/ 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 --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..4dfbef526 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) +{ + schedule_order_lock(lock_index); +} + +static void schedule_order_lock_wait(uint32_t lock_index) +{ + (void)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..b589037f2 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) +{ + schedule_order_lock(lock_index); +} + +static void schedule_order_lock_wait(uint32_t lock_index) +{ + (void)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..53a5e3e02 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) +{ + schedule_order_lock(lock_index); +} + +static void schedule_order_lock_wait(uint32_t lock_index) +{ + (void)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 };