From patchwork Tue Sep 12 15:00:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 112320 Delivered-To: patch@linaro.org Received: by 10.80.202.13 with SMTP id d13csp38748edi; Tue, 12 Sep 2017 08:02:00 -0700 (PDT) X-Google-Smtp-Source: AOwi7QBz6L5wKNknGJouxD3R8rDxi+0eGqacV4yzEP/8lkQN2xyBcO4FL0BoIzGnHuNG0p10IpUk X-Received: by 10.55.184.1 with SMTP id i1mr6654919qkf.236.1505228519936; Tue, 12 Sep 2017 08:01:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505228519; cv=none; d=google.com; s=arc-20160816; b=v6m41LUu2KypFbYL/R229Ni4C+WD/C/Qm/5EkjlPqW4vjIYIk9TiHeQgYyY8LyIoMD EPjHC1ev7igvk3GoQlbFp0uPVZnaTBe93B387NDonoK7YDxP+IJDJmQA4uJuZBY7z1Ti Yr6dIyZgX06CggdOEhCS29z3dEBjY9QnnxsDyje7NJ1k3SPv5MLCnvPBw8xscRJizCvT BUm3NYkvglXD62ZQuFqBbnQuYb3yc3xOcx3nZ6iKJPf7vo28uZWW5h8e2+P+EwCqA6zJ ow8cgrKe0Y74Gt9PqGkPhnZIC+mTUZiSyZATas5oVUraf2UWelDlE8btG+rAElbfgroV a9UQ== 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=dwnqbhkWHGf5Es0tf6OJ3t9dFABgrK7qW05qQjNlvFU=; b=Ho5eHlfTguSlCGwqs6Vlv27yyRLEhPXrYWbxiSxsRGf9aLF7/pKNRpu+NVmXq2nB6M Q/yyKWCzU9kYLKsj5Osms5vELK7WTmlUHpQz7w0j9BG50xzoyTP2b9bAVIJobk9jzDjl OW9BiQmiKa3Oq0dVPJ2nSD3UT5Ts9t1ejJVSsyKdSz9ZwsY/4fIWT20JKlKu3SUBE1ZZ JzNe+bHCkJB9JWJ2Eyn0xuhKunf/ybICkGRWDXjT6tZTQfsUeDQTDBMzG+1SGBj8xXB7 KTM1io1Wohp6z6qFaBBCqovqPuP4qKoyiIe1lKuMEsVNVtUZnLE23MrDnK52y6QNbXou XyhQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 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 (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id h135si12125075qka.544.2017.09.12.08.01.59; Tue, 12 Sep 2017 08:01:59 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 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 7B31762AE6; Tue, 12 Sep 2017 15:01:59 +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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,URIBL_BLOCKED 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 831D860880; Tue, 12 Sep 2017 15:01:08 +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 C2B5F6072B; Tue, 12 Sep 2017 15:00:55 +0000 (UTC) Received: from forward102j.mail.yandex.net (forward102j.mail.yandex.net [5.45.198.243]) by lists.linaro.org (Postfix) with ESMTPS id C13076071A for ; Tue, 12 Sep 2017 15:00:49 +0000 (UTC) Received: from mxback4j.mail.yandex.net (mxback4j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10d]) by forward102j.mail.yandex.net (Yandex) with ESMTP id 455D15604E23 for ; Tue, 12 Sep 2017 18:00:48 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback4j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 4739OB3sCr-0l4e61a3; Tue, 12 Sep 2017 18:00:48 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id PadAyxFNxx-0kH4AZMj; Tue, 12 Sep 2017 18:00:47 +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: Tue, 12 Sep 2017 18:00:27 +0300 Message-Id: <1505228428-32327-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1505228428-32327-1-git-send-email-odpbot@yandex.ru> References: <1505228428-32327-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 160 Subject: [lng-odp] [PATCH API-NEXT v6 1/2] api: schedule: add schedule order unlock lock api 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 Adds odp_schedule_order_unlock_lock() api. This API combines schedule order unlock and lock into a single api for performance optimization in HW. Signed-off-by: Balasubramanian Manoharan --- /** Email created from pull request 160 (bala-manoharan:api_sched_order_lock) ** https://github.com/Linaro/odp/pull/160 ** Patch: https://github.com/Linaro/odp/pull/160.patch ** Base sha: 6b6253c30f88c80bf632436ff06c1b000860a2f1 ** Merge commit sha: 14974ba25c29ba2d92eed93e083a4ce292b7602b **/ include/odp/api/spec/schedule.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/include/odp/api/spec/schedule.h b/include/odp/api/spec/schedule.h index 8244746d..1c7ef38a 100644 --- a/include/odp/api/spec/schedule.h +++ b/include/odp/api/spec/schedule.h @@ -347,6 +347,9 @@ int odp_schedule_group_info(odp_schedule_group_t group, * be protected by its own ordered lock. This promotes maximum parallelism by * allowing order to maintained on a more granular basis. If an ordered lock * is used multiple times in the same ordered context results are undefined. + * Only one ordered lock can be active in an ordered context at any given time. + * Resuls are undefined when multiple ordered locks are acquired in nested + * fashion within the same ordered context. * * @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() @@ -368,6 +371,31 @@ void odp_schedule_order_lock(unsigned lock_index); void odp_schedule_order_unlock(unsigned lock_index); /** + * Release existing ordered context lock and acquire a new lock + * + * This call is valid only when holding an ordered synchronization context. + * Release a previously locked ordered context lock and acquire a new ordered + * context lock. This call is valid only when there is a single ordered context + * lock active. Results are undefined if this call is made when multiple ordered + * context locks are acquired in nested fashion. + * This call does not release the existing ordered context and only switches + * from one ordered lock to another ordered lock within the same ordered + * context. + * + * @param unlock_index Index of the acquired ordered lock in the current + * context to be released. Results are undefined if the + * ordered lock with the given unlock_index is not held by + * this ordered context. + * @param lock_index Index of the ordered lock in the current context to be + * acquired. Previously acquired ordered lock is released. + * Must be in the range 0...odp_queue_lock_count() - 1. + * + * @see odp_schedule_order_lock(), odp_schedule_order_unlock() + * + */ +void odp_schedule_order_unlock_lock(uint32_t unlock_index, uint32_t lock_index); + +/** * @} */ From patchwork Tue Sep 12 15:00:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 112321 Delivered-To: patch@linaro.org Received: by 10.80.202.13 with SMTP id d13csp40159edi; Tue, 12 Sep 2017 08:02:54 -0700 (PDT) X-Google-Smtp-Source: AOwi7QDPTtORq8biKzpsQuUV95HUyseOfesxtRXK8mA1HlOvZb/RIx2E3QKB+60Q8xia3yMwVZLT X-Received: by 10.55.137.66 with SMTP id l63mr20689463qkd.249.1505228574251; Tue, 12 Sep 2017 08:02:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505228574; cv=none; d=google.com; s=arc-20160816; b=NKdGwTBy0Bu7EVMh8SL/EDvHEgt9SA0GPaYW8LQC29u5dnzM+CzX4ZoBDD+BOyrmn0 8K3yWUY+S/tZeBCGWOJRZ91//qIpjRc6rplRuOcGCMdju/rBsuoVRhJkbpmDwCLmM2/e 007Zy9mhzh9ZGPkgDLuGFXBaKJnnaXsnAFH6WDLpU+2cWYguRG1wp5urZxZLSPwrzKRy 8aF++29b1MqkkQESd19OWM3PFyf2PeQ5HYmL0ZO8lddeKw0kaMLP33FwKX6ntPt52cST TKsT6xxJOJSoUJ5/Vt17V3vBc63XoGXEu9fO3jlkBlSwRCEewoB+ek5fD83Z7QnQJHYs WFVw== 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=D7nKeCdoFDe1j22ElRzvuglkNnGKqtWbaWX/8Uqc+44=; b=SpO7bFVHzvAlu17fxYPUKPjUFuNxKP8qF31oF2xMUExZ3WFmN2npwvFFvnT3ScxsT6 0E9VTj5aZJiMg7d8ysMoHiT12eXTlsCrFl1W1zhYpwL8Lo3Y9ZoBJe+MaLoaMKf1QHOn kDMzJ423+gxkTGIfnX/Fl6TQPfkz45bSjsb6TdfbX3vjoJGFJomoec3DS/FI6rKX7t4Y kMH6Lh6ktN/aIz73m3b1J8iOCZSH9sEdy9XqFH8zxGpeAfUPz5huDcR+qZ6vSCZNaDS3 4alZqanj/8F8krfO3XOI074VKjZGRijpeOMDltBQ3w9itJ84znDiJ+EkVmZQ3sGOwTix kucQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 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 (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id i25si12165338qtg.42.2017.09.12.08.02.53; Tue, 12 Sep 2017 08:02:54 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 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 D50C86081B; Tue, 12 Sep 2017 15:02:53 +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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,URIBL_BLOCKED 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 C90E560911; Tue, 12 Sep 2017 15:01:15 +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 A1B796082B; Tue, 12 Sep 2017 15:00:55 +0000 (UTC) Received: from forward103j.mail.yandex.net (forward103j.mail.yandex.net [5.45.198.246]) by lists.linaro.org (Postfix) with ESMTPS id 60F906072B for ; Tue, 12 Sep 2017 15:00:50 +0000 (UTC) Received: from mxback6o.mail.yandex.net (mxback6o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::20]) by forward103j.mail.yandex.net (Yandex) with ESMTP id F015834C315F for ; Tue, 12 Sep 2017 18:00:48 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback6o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id xXwIwlG76E-0mCupI5r; Tue, 12 Sep 2017 18:00:48 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id PadAyxFNxx-0mHK7tEq; Tue, 12 Sep 2017 18:00:48 +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: Tue, 12 Sep 2017 18:00:28 +0300 Message-Id: <1505228428-32327-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1505228428-32327-1-git-send-email-odpbot@yandex.ru> References: <1505228428-32327-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 160 Subject: [lng-odp] [PATCH API-NEXT v6 2/2] linux-generic: schedule: implement schedule order unlock lock api 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 odp_schedule_order_unlock_lock() api. This api combines schedule order unlock and lock into a single api for performance optimization in HW. Signed-off-by: Balasubramanian Manoharan --- /** Email created from pull request 160 (bala-manoharan:api_sched_order_lock) ** https://github.com/Linaro/odp/pull/160 ** Patch: https://github.com/Linaro/odp/pull/160.patch ** Base sha: 6b6253c30f88c80bf632436ff06c1b000860a2f1 ** Merge commit sha: 14974ba25c29ba2d92eed93e083a4ce292b7602b **/ platform/linux-generic/include/odp_schedule_if.h | 1 + platform/linux-generic/odp_schedule.c | 10 +++++++++- platform/linux-generic/odp_schedule_if.c | 5 +++++ platform/linux-generic/odp_schedule_iquery.c | 10 +++++++++- platform/linux-generic/odp_schedule_scalable.c | 8 ++++++++ platform/linux-generic/odp_schedule_sp.c | 10 +++++++++- 6 files changed, 41 insertions(+), 3 deletions(-) diff --git a/platform/linux-generic/include/odp_schedule_if.h b/platform/linux-generic/include/odp_schedule_if.h index 657993b1..bf999adf 100644 --- a/platform/linux-generic/include/odp_schedule_if.h +++ b/platform/linux-generic/include/odp_schedule_if.h @@ -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)(uint32_t, uint32_t); } schedule_api_t; diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c index 5b940762..f9aa286b 100644 --- a/platform/linux-generic/odp_schedule.c +++ b/platform/linux-generic/odp_schedule.c @@ -1144,6 +1144,13 @@ static void schedule_order_unlock(unsigned lock_index) odp_atomic_store_rel_u64(ord_lock, sched_local.ordered.ctx + 1); } +static void schedule_order_unlock_lock(uint32_t unlock_index, + uint32_t lock_index) +{ + schedule_order_unlock(unlock_index); + schedule_order_lock(lock_index); +} + static void schedule_pause(void) { sched_local.pause = 1; @@ -1429,5 +1436,6 @@ const schedule_api_t schedule_default_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 }; diff --git a/platform/linux-generic/odp_schedule_if.c b/platform/linux-generic/odp_schedule_if.c index e56e3722..da339b6f 100644 --- a/platform/linux-generic/odp_schedule_if.c +++ b/platform/linux-generic/odp_schedule_if.c @@ -129,3 +129,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 unlock_index, uint32_t lock_index) +{ + sched_api->schedule_order_unlock_lock(unlock_index, lock_index); +} diff --git a/platform/linux-generic/odp_schedule_iquery.c b/platform/linux-generic/odp_schedule_iquery.c index b81e5dab..4f33b2c4 100644 --- a/platform/linux-generic/odp_schedule_iquery.c +++ b/platform/linux-generic/odp_schedule_iquery.c @@ -1296,6 +1296,13 @@ static void schedule_order_unlock(unsigned lock_index) odp_atomic_store_rel_u64(ord_lock, thread_local.ordered.ctx + 1); } +static void schedule_order_unlock_lock(uint32_t unlock_index, + uint32_t lock_index) +{ + schedule_order_unlock(unlock_index); + schedule_order_lock(lock_index); +} + static unsigned schedule_max_ordered_locks(void) { return CONFIG_QUEUE_MAX_ORD_LOCKS; @@ -1368,7 +1375,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, diff --git a/platform/linux-generic/odp_schedule_scalable.c b/platform/linux-generic/odp_schedule_scalable.c index 765326e8..d1bbebbb 100644 --- a/platform/linux-generic/odp_schedule_scalable.c +++ b/platform/linux-generic/odp_schedule_scalable.c @@ -1028,6 +1028,13 @@ static void schedule_order_unlock(unsigned lock_index) rctx->olock_flags |= 1U << lock_index; } +static void schedule_order_unlock_lock(uint32_t unlock_index, + uint32_t lock_index) +{ + schedule_order_unlock(unlock_index); + schedule_order_lock(lock_index); +} + static void schedule_release_atomic(void) { sched_scalable_thread_state_t *ts; @@ -1978,4 +1985,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, }; diff --git a/platform/linux-generic/odp_schedule_sp.c b/platform/linux-generic/odp_schedule_sp.c index 05241275..deb35d59 100644 --- a/platform/linux-generic/odp_schedule_sp.c +++ b/platform/linux-generic/odp_schedule_sp.c @@ -819,6 +819,13 @@ static void schedule_order_unlock(unsigned lock_index) (void)lock_index; } +static void schedule_order_unlock_lock(uint32_t unlock_index, + uint32_t lock_index) +{ + (void)unlock_index; + (void)lock_index; +} + static void order_lock(void) { } @@ -868,5 +875,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 };