From patchwork Mon Sep 11 07:00:08 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: 112170 Delivered-To: patch@linaro.org Received: by 10.100.153.131 with SMTP id 3csp5357844pji; Mon, 11 Sep 2017 00:01:00 -0700 (PDT) X-Google-Smtp-Source: AOwi7QAIiDCd41LDDbMMgL50O10JpSsUBsGrDkupyG3J/2rzowG4037dVdNeX7pzd336Ko9BqPpq X-Received: by 10.200.47.114 with SMTP id k47mr15995822qta.109.1505113260739; Mon, 11 Sep 2017 00:01:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505113260; cv=none; d=google.com; s=arc-20160816; b=xj1iDpN/EXFBr3t0HXAuF5dxeeli6AseStfM9tZ58E4KYb+AWSkCPKher9rUk9X962 HiXjcQGH7mdBpFvMIuBjRlLIDEJmGtQImZJLY3Jq+HA+zVvX/BGOuRDqzRQwkzY2oC1V uINqfeK/K5TGkYU4yZ7o3gRFIwVyxb+nx7bo2Hh7NDNBbXhizn18KFH+Urhx+c7JZVOr zjizUzSSb1w45pejS3w3gf2xtfyRYpVPo2JkgMcEz5Ch3VMFfxNqgjG4iy9jVpEssHo8 Lce/ngaTdLf5d0lsi/om16V31+g4P0AhyV8ndae+KvCGU5q/EijsPFubjRWDVB6Kq5Td GTGA== 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=Qx+8A04BgeayutpT1SGdHW4FQGmvI8ps5drpMgxwTdk=; b=DMci6n9h6urO18qy3NkmOrgAwm28gvvIyamb/oBqfzKYB9S5OQab8LpCnuwnb0Wfpl isZUUHl2lUChJZf8KgWCnFZzypgMhhiJjkfsZDcNd6flLCYD3EFbVjg35EG1DHrjemgv 9GgMrAPxPruJWR5GyRhAeFsMLxTK/oeIatMC/EpwsEOaziu36Wq69UhwXZMEhWniY+Pk ohkDaJVh0U8RfMIrfsSqK7FTndV0/sGvKOCuLoRNaKDsRQUd4NoxMvDCxXk/y5992mtd Gn/xcSibS6h6QkxGi32ipCdZXs7xoOdkpCvqBpeN/2EQaIfUp3zYpPXj2iG2gjW+9EOh nysQ== 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 j89si6996225qtd.280.2017.09.11.00.01.00; Mon, 11 Sep 2017 00:01:00 -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 61C9760C4C; Mon, 11 Sep 2017 07:01:00 +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, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, 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 60BCB60BF7; Mon, 11 Sep 2017 07:00:28 +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 8EFEA60BE9; Mon, 11 Sep 2017 07:00:24 +0000 (UTC) Received: from forward100j.mail.yandex.net (forward100j.mail.yandex.net [5.45.198.240]) by lists.linaro.org (Postfix) with ESMTPS id 24E5C60BE0 for ; Mon, 11 Sep 2017 07:00:22 +0000 (UTC) Received: from mxback17j.mail.yandex.net (mxback17j.mail.yandex.net [IPv6:2a02:6b8:0:1619::93]) by forward100j.mail.yandex.net (Yandex) with ESMTP id 8230D5D8172D for ; Mon, 11 Sep 2017 10:00:20 +0300 (MSK) Received: from smtp1j.mail.yandex.net (smtp1j.mail.yandex.net [2a02:6b8:0:801::ab]) by mxback17j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id lZTnGDv2lF-0KPCq32V; Mon, 11 Sep 2017 10:00:20 +0300 Received: by smtp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id sdX4DJcyaU-0Jp4rqtZ; Mon, 11 Sep 2017 10:00:19 +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, 11 Sep 2017 10:00:08 +0300 Message-Id: <1505113209-1360-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1505113209-1360-1-git-send-email-odpbot@yandex.ru> References: <1505113209-1360-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 160 Subject: [lng-odp] [PATCH API-NEXT v5 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: 7fa8e2c97ed18f8dd6e95cbc78b7e668ccb98869 ** Merge commit sha: eeca3e8f8849d22500b6f87e1304c48f2d417d29 **/ include/odp/api/spec/schedule.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/include/odp/api/spec/schedule.h b/include/odp/api/spec/schedule.h index 8244746d7..6597e6c66 100644 --- a/include/odp/api/spec/schedule.h +++ b/include/odp/api/spec/schedule.h @@ -368,6 +368,27 @@ 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 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 lock_index); + +/** * @} */ From patchwork Mon Sep 11 07:00:09 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: 112171 Delivered-To: patch@linaro.org Received: by 10.100.153.131 with SMTP id 3csp5358545pji; Mon, 11 Sep 2017 00:01:38 -0700 (PDT) X-Google-Smtp-Source: AOwi7QC8Zj9dKKIqx4SqaLCFm2VQ4RYDJEfQZ1qr2aT2VXgwRBhUvlq43DCS04438dUoS3zq01CT X-Received: by 10.55.22.218 with SMTP id 87mr14039265qkw.248.1505113298449; Mon, 11 Sep 2017 00:01:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505113298; cv=none; d=google.com; s=arc-20160816; b=qvINJXlh1sa7j6/Np4RWxXMwjmhwgnz7gNLwZYXlky32E1ZI0xrUBBUAWxyyXroDa8 6/6Sb8BjK4wQNER7nk3IoyCcUsmXQBDbUHeaf8+afsum0tCnBwUlKb3F7htTc9zWhL58 t3DMpDvPm2S9mucoO32ARagL8UmGSLq57bw23CkhqDyXsBuScn4iBaMqt6ZPLLaKXHjw mPKYOc5wAS4tIcGrL3kVJDBE2BfD49wWdFsksiH7CajB+bZLEocf/qOzlErrJ/JIjTOO osomeT9khaFHw3oo1LAgbJlW0vkbXtZrMqDF3CdipOjqgQ79zGV+01fAbXoQ6jS+takf IW6Q== 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=nz7NPToBmRLgxH93tdZfTK/xwnXbB5w+g4tdGtBsbrk=; b=LK9zINBYadpSJrxPeH4YqXUxPWofrMIFgoGPY8hNSYpgW2AAWWVTG+tjFcurrcbIoz kbD1Mz+N2QHsaAyWGo9Iwk7CnEjzn4XPj19Cfyg+MuS9mjoNWOBYN4nLtvFPdM4sPR/Z DUMyE573WNDTgi85bfAMMgMwRr/KmZ5z5fHdPcJR9bCLL41BJ85FBlG+bq23zdFLr0Ra cDv7vKa5mnD4KVKmyipHn0faCVPfRiToi8RTsv9Eryf/4jfJaGyHxo4u/9wmtuLVuCY5 C7hzMtDNBvBiORbdC/LzjDxnEqpGRt4yJAe4tTANd7kTpThfkR8XlvAHkPOZYhI/APsW DObA== 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 j195si8641283qkj.334.2017.09.11.00.01.38; Mon, 11 Sep 2017 00:01:38 -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 1297760690; Mon, 11 Sep 2017 07:01:38 +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 B6B3760C2C; Mon, 11 Sep 2017 07: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 8E09460BE0; Mon, 11 Sep 2017 07:00:25 +0000 (UTC) Received: from forward106j.mail.yandex.net (forward106j.mail.yandex.net [5.45.198.249]) by lists.linaro.org (Postfix) with ESMTPS id AE37360BE8 for ; Mon, 11 Sep 2017 07:00:22 +0000 (UTC) Received: from mxback8g.mail.yandex.net (mxback8g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:169]) by forward106j.mail.yandex.net (Yandex) with ESMTP id 7085D18013CE for ; Mon, 11 Sep 2017 10:00:21 +0300 (MSK) Received: from smtp1j.mail.yandex.net (smtp1j.mail.yandex.net [2a02:6b8:0:801::ab]) by mxback8g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id Po0apYeM1b-0LZSZaOm; Mon, 11 Sep 2017 10:00:21 +0300 Received: by smtp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id sdX4DJcyaU-0KpqUPal; Mon, 11 Sep 2017 10:00:20 +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, 11 Sep 2017 10:00:09 +0300 Message-Id: <1505113209-1360-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1505113209-1360-1-git-send-email-odpbot@yandex.ru> References: <1505113209-1360-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 160 Subject: [lng-odp] [PATCH API-NEXT v5 2/2] linux-generic: api schedule unlock 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 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: 7fa8e2c97ed18f8dd6e95cbc78b7e668ccb98869 ** Merge commit sha: eeca3e8f8849d22500b6f87e1304c48f2d417d29 **/ platform/linux-generic/include/odp_schedule_if.h | 1 + platform/linux-generic/include/odp_schedule_scalable.h | 1 + platform/linux-generic/odp_schedule.c | 11 ++++++++++- platform/linux-generic/odp_schedule_if.c | 5 +++++ platform/linux-generic/odp_schedule_iquery.c | 11 ++++++++++- platform/linux-generic/odp_schedule_scalable.c | 8 ++++++++ platform/linux-generic/odp_schedule_sp.c | 8 +++++++- 7 files changed, 42 insertions(+), 3 deletions(-) diff --git a/platform/linux-generic/include/odp_schedule_if.h b/platform/linux-generic/include/odp_schedule_if.h index 657993b13..b0db67ab8 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)(unsigned); } schedule_api_t; diff --git a/platform/linux-generic/include/odp_schedule_scalable.h b/platform/linux-generic/include/odp_schedule_scalable.h index 8a2d70da0..41c614975 100644 --- a/platform/linux-generic/include/odp_schedule_scalable.h +++ b/platform/linux-generic/include/odp_schedule_scalable.h @@ -113,6 +113,7 @@ typedef struct { uint8_t tidx; uint8_t pad; uint32_t dequeued; /* Number of events dequeued from atomic queue */ + uint32_t lock_index; /* Index of the acquired ordered lock */ uint16_t pktin_next; /* Next pktin tag to poll */ uint16_t pktin_poll_cnts; uint16_t ticket; /* Ticket for atomic queue or TICKET_INVALID */ diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c index 5b9407624..27498ddb3 100644 --- a/platform/linux-generic/odp_schedule.c +++ b/platform/linux-generic/odp_schedule.c @@ -163,6 +163,7 @@ typedef struct { int stash_num; /**< Number of stashed enqueue operations */ uint8_t in_order; /**< Order status */ lock_called_t lock_called; /**< States of ordered locks */ + uint32_t lock_index; /**< Index of the acquired ordered lock */ /** Storage for stashed enqueue operations */ ordered_stash_t stash[MAX_ORDERED_STASH]; } ordered; @@ -1121,6 +1122,7 @@ static void schedule_order_lock(unsigned lock_index) if (lock_seq == sched_local.ordered.ctx) { sched_local.ordered.lock_called.u8[lock_index] = 1; + sched_local.ordered.lock_index = lock_index; return; } odp_cpu_pause(); @@ -1144,6 +1146,12 @@ 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(unsigned lock_index) +{ + schedule_order_unlock(sched_local.ordered.lock_index); + schedule_order_lock(lock_index); +} + static void schedule_pause(void) { sched_local.pause = 1; @@ -1429,5 +1437,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 e56e3722b..858c19490 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 lock_index) +{ + sched_api->schedule_order_unlock_lock(lock_index); +} diff --git a/platform/linux-generic/odp_schedule_iquery.c b/platform/linux-generic/odp_schedule_iquery.c index b81e5dab1..ca30cfd63 100644 --- a/platform/linux-generic/odp_schedule_iquery.c +++ b/platform/linux-generic/odp_schedule_iquery.c @@ -223,6 +223,7 @@ struct sched_thread_local { int stash_num; /**< Number of stashed enqueue operations */ uint8_t in_order; /**< Order status */ lock_called_t lock_called; /**< States of ordered locks */ + uint32_t lock_index; /**< Index of the acquired ordered lock */ /** Storage for stashed enqueue operations */ ordered_stash_t stash[MAX_ORDERED_STASH]; } ordered; @@ -1273,6 +1274,7 @@ static void schedule_order_lock(unsigned lock_index) if (lock_seq == thread_local.ordered.ctx) { thread_local.ordered.lock_called.u8[lock_index] = 1; + thread_local.ordered.lock_index = lock_index; return; } odp_cpu_pause(); @@ -1296,6 +1298,12 @@ 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(unsigned lock_index) +{ + schedule_order_unlock(thread_local.ordered.lock_index); + schedule_order_lock(lock_index); +} + static unsigned schedule_max_ordered_locks(void) { return CONFIG_QUEUE_MAX_ORD_LOCKS; @@ -1368,7 +1376,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 765326e8e..b714792f1 100644 --- a/platform/linux-generic/odp_schedule_scalable.c +++ b/platform/linux-generic/odp_schedule_scalable.c @@ -1008,6 +1008,7 @@ static void schedule_order_lock(unsigned lock_index) __ATOMIC_ACQUIRE) != rctx->sn) doze(); } + sched_ts->lock_index = lock_index; } static void schedule_order_unlock(unsigned lock_index) @@ -1028,6 +1029,12 @@ static void schedule_order_unlock(unsigned lock_index) rctx->olock_flags |= 1U << lock_index; } +static void schedule_order_unlock_lock(unsigned lock_index) +{ + schedule_order_unlock(sched_ts->lock_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 05241275d..d4dfbcaf0 100644 --- a/platform/linux-generic/odp_schedule_sp.c +++ b/platform/linux-generic/odp_schedule_sp.c @@ -819,6 +819,11 @@ static void schedule_order_unlock(unsigned lock_index) (void)lock_index; } +static void schedule_order_unlock_lock(unsigned lock_index) +{ + (void)lock_index; +} + static void order_lock(void) { } @@ -868,5 +873,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 };