From patchwork Mon Feb 5 16: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: 126910 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2091139ljc; Mon, 5 Feb 2018 08:01:35 -0800 (PST) X-Google-Smtp-Source: AH8x226ryq/buXvBG05LvwxbNfEGjdjPyoHjgyB+ubFpQdiYkxW28aSVoYhav9sLniY1QYRidK1N X-Received: by 10.237.63.165 with SMTP id s34mr81017212qth.312.1517846495627; Mon, 05 Feb 2018 08:01:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517846495; cv=none; d=google.com; s=arc-20160816; b=bWeLPJSYokyYoMdVR0yQlQbkoCVmzsgkd9ziBhWvwrTaiSC2l1vvT+msyygkr+E3JA xORls/fdEox842NziycqEoV1eSGucKrj+bIjbEjA6R6DMUdUoR0hRDezZyyvL19NkFdc ynIlPEhiF2I2CitzvXavx1F/GNC8dnMWzYoO0lAOK11IOvva1V7qG8CX3E2fbaNQUZvN 4IcuZSVhxLR7Tp0IuZ53sUsw2ExabB19YcZECTFNLizja/WbYfEZNuzkQsnRnlvsrevU tpMhTD29jKSK/OyuSfPa5fe+a8S8NBE2KglWr9S08ZCBC64YznLamNkpILOlmArLVxiR g8qg== 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=Hx2HaO1aSJmxQydwM0ZEZt+kY9a6rriCgDAFlciPj90=; b=ofnDRLKY6pW9q19FN+2UcmKoL9V7XONVVDaJOjAO8fqWaBQ2xFd8BxXi9NDxxTxatx lnO35cLJoRbDj3SeERPulKEZmIwYCJrb7n3WMoMS21Md1BpwZ0QV7B5NTk50ZRlsaY2T xzOm/AWlkpcdIGcqCM6Vm8J7vTV08+WscHuW/PEkX32tcrEpe/XnI+lbjgeJ0K/0Q0r6 yiGOhem7x7mbI03YZmzrNG4KZCS4KlsXFAVeJn/78f95RHaTHggpUPFNJtAtIeXxCX9K 5BM7kQdaGNykEh42604mHMn/AChgqV9PG6/febWz+MxhPVO+ImYAFTJhh+YyEgK/fPTz 21iQ== 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 o64si124805qte.77.2018.02.05.08.01.35; Mon, 05 Feb 2018 08:01:35 -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 45CAE619C0; Mon, 5 Feb 2018 16:01:35 +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_H2 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 3A8B36068C; Mon, 5 Feb 2018 16:00:30 +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 5EC5260881; Mon, 5 Feb 2018 16:00:19 +0000 (UTC) Received: from forward100o.mail.yandex.net (forward100o.mail.yandex.net [37.140.190.180]) by lists.linaro.org (Postfix) with ESMTPS id 9C7746068C for ; Mon, 5 Feb 2018 16:00:12 +0000 (UTC) Received: from mxback3g.mail.yandex.net (mxback3g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:164]) by forward100o.mail.yandex.net (Yandex) with ESMTP id 1FE9F2A22421 for ; Mon, 5 Feb 2018 19:00:11 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback3g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id RJy4QceqM9-0BDmbrnx; Mon, 05 Feb 2018 19:00:11 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 8Xr539C9Ni-0ANKY1Rf; Mon, 05 Feb 2018 19: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 19:00:08 +0300 Message-Id: <1517846409-7604-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517846409-7604-1-git-send-email-odpbot@yandex.ru> References: <1517846409-7604-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 453 Subject: [lng-odp] [PATCH API-NEXT v2 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: a50f50ab2e9af13052f4d9dc7d962b8c0c111868 **/ include/odp/api/spec/schedule.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/include/odp/api/spec/schedule.h b/include/odp/api/spec/schedule.h index d493cc75f..ef8de9415 100644 --- a/include/odp/api/spec/schedule.h +++ b/include/odp/api/spec/schedule.h @@ -371,6 +371,30 @@ 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). + * 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. Ordered lock acquisition + * will be completed during this call. + */ +void odp_schedule_order_lock_wait(uint32_t lock_index); + /** * @} */ From patchwork Mon Feb 5 16:00:09 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: 126911 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2092129ljc; Mon, 5 Feb 2018 08:02:29 -0800 (PST) X-Google-Smtp-Source: AH8x225Ocg/p4fk36oFdnxEhUS2SCCwtXAVGdNM5qr42YP0b1odkM0oFI2QtlYjUPe/4t9gjbUlU X-Received: by 10.55.146.195 with SMTP id u186mr12378485qkd.278.1517846549729; Mon, 05 Feb 2018 08:02:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517846549; cv=none; d=google.com; s=arc-20160816; b=NOYWCJyaVLZtpiuIhM3NR31dqYAwUEK7f1wnr5g2Dn8OOMpC5QyTXYYvVc8lhL1TXU GQYQKkzbfkRGIZDZ15HGOtHujrF5t7PcJG1wS3YlpCqvYSOhNsjVxUnAyArqtgULZ1zM x+4KFNh4n0chx5wL6taUaiAYW0VGB+8TLVe63sbmyA+S9DT4CH4OvBQMTFOjf0cfh8s4 8cTlRtQdkq9DUn9a7BIiUURvhSex6Bt/J7xT772J47dv4XoLUTpL+XpV47YXa/KCk298 HaW5TPSSrNKE2/gIcrhY4IZ5af+sshy5qxH2ZNGuVXwDAU4+mgtWuIurtNfkCK1EziC3 VotQ== 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=qdzvNyHUGkQDS/dKm3gIrUbYDWGGWFlOcswJcAxBduk=; b=TCxQiCGDnTYbRJH/ApUhtg9etoXJBdPSdLcZsATEhRnPna+LL4mrLFqEUazVp1o8J9 2/i4Gw82GCKMTj626rl8kl8H6dE5HZj+AkyZJkwqknCx36r/04g4IN1KUJoPPOAZbjKK LQji19weU7WZVOKubDgE905hG4Zg0pcl2KqDN98VKYCiQDQCBLFfREVIbYFqzH6dFszc rrOBZVSPVBMf2OqBCj0FNhODwX9LwB3rmcTARLA4Sc/RI3OiZRF6pOnRtWeJUSoe8t2Z mzvIbjgM5xnuK4GzWwrgwh08XpsMVMbWPxBFuNjv/HUuiR545vN5o7ON1aoWKB2SPVAj VlXQ== 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 r9si1432668qtm.387.2018.02.05.08.02.28; Mon, 05 Feb 2018 08:02:29 -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 9A03E61836; Mon, 5 Feb 2018 16:02:28 +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_H2 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 B1C7E6179A; Mon, 5 Feb 2018 16:00:33 +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 617CD616FF; Mon, 5 Feb 2018 16:00:24 +0000 (UTC) Received: from forward102p.mail.yandex.net (forward102p.mail.yandex.net [77.88.28.102]) by lists.linaro.org (Postfix) with ESMTPS id 7F235607D5 for ; Mon, 5 Feb 2018 16:00:13 +0000 (UTC) Received: from mxback10g.mail.yandex.net (mxback10g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:171]) by forward102p.mail.yandex.net (Yandex) with ESMTP id 05A4B43022C2 for ; Mon, 5 Feb 2018 19:00:12 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback10g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id BaoqMkubTf-0Bp0Yku7; Mon, 05 Feb 2018 19:00:12 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 8Xr539C9Ni-0BNCghuL; Mon, 05 Feb 2018 19:00:11 +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 19:00:09 +0300 Message-Id: <1517846409-7604-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517846409-7604-1-git-send-email-odpbot@yandex.ru> References: <1517846409-7604-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 453 Subject: [lng-odp] [PATCH API-NEXT v2 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: 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 --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 };