From patchwork Mon Aug 28 13:00:19 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: 111156 Delivered-To: patch@linaro.org Received: by 10.37.128.210 with SMTP id c18csp4800927ybm; Mon, 28 Aug 2017 06:04:05 -0700 (PDT) X-Received: by 10.55.155.6 with SMTP id d6mr696132qke.256.1503925444955; Mon, 28 Aug 2017 06:04:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503925444; cv=none; d=google.com; s=arc-20160816; b=gmHv6TpdTVVgH+oszl4g86n2/Kd5/u60ALlVN36SltMqCMM3ymkliFbOfahX/0/M0m FLlnm79x5gHKcBb/eKX//zMggzfCxfOgnuMBbhNasarZCVeeEDVhgBUIZJvF3Wqa3GIp cflHsCbLQE+mxe9/muEh2EZ8CbueNCqOLruKEEW3ntyyiMQyfMVTRZnYlzwCtv/Dki20 jRLpoax5RhQeoK8luEnaVVnfsPwWTy1bWGHxGg6xoeEWWp7l6h4JuIkwnAGB/OK6kOjx qhXhDzDPvNuagKqQHEmjWYbvfTFhUZ2i25ZD3xk9vVbbcElu49pKl8L2/ZhdE/jsxJSl fbww== 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=1C/4Qf4s2V/F5D+mVXlIiDzysrKFcRf+9iOwIhbuzNY=; b=KFLRSC4Z2M1UNN1hbqjI2gyRFs5YfgE27E2ojeZ2g/X6/wd3z6g2rHho8T/pdtYrNI hD2qwcN6OrUuyBp99PP87YdazFRl2P6kZBiXgPJ6hqwB+RHJgD+j6Eb3WC+wSfumULQ8 c5x0HKTnTW+bmGmDDX98XtX9IOid1QmnAoJTdz6R6aL4ft0Kyi6cGyn7cFfiPYJNDvrZ boEu+8YFlWcN1/9SGR7L7zcEVgstIgF6DiRhQLQekEsztwL3EGPobR5RNF4BUJKFd18w qteJW3sz4R7qHggSvwKWBdBcPb06jeZxRSZ04g0yBPwfJrZKX6zk/iSbCzmZex4C4tnZ W6yQ== 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 x4si310855qkx.114.2017.08.28.06.04.04; Mon, 28 Aug 2017 06:04:04 -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 946ED608CD; Mon, 28 Aug 2017 13:04:04 +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 1B5FB6095D; Mon, 28 Aug 2017 13: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 EC52D609BA; Mon, 28 Aug 2017 13:02:10 +0000 (UTC) Received: from forward104j.mail.yandex.net (forward104j.mail.yandex.net [5.45.198.247]) by lists.linaro.org (Postfix) with ESMTPS id A1A8E608BB for ; Mon, 28 Aug 2017 13:00:54 +0000 (UTC) Received: from mxback8j.mail.yandex.net (mxback8j.mail.yandex.net [IPv6:2a02:6b8:0:1619::111]) by forward104j.mail.yandex.net (Yandex) with ESMTP id E9B0F435BC for ; Mon, 28 Aug 2017 16:00:52 +0300 (MSK) Received: from smtp1j.mail.yandex.net (smtp1j.mail.yandex.net [2a02:6b8:0:801::ab]) by mxback8j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id ZEAF6x5KYE-0qcir1Mi; Mon, 28 Aug 2017 16:00:52 +0300 Received: by smtp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id YUwz5caNS3-0qsWTNcj; Mon, 28 Aug 2017 16:00:52 +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, 28 Aug 2017 16:00:19 +0300 Message-Id: <1503925219-13793-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1503925219-13793-1-git-send-email-odpbot@yandex.ru> References: <1503925219-13793-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 129 Subject: [lng-odp] [PATCH API-NEXT v2 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 129 (bala-manoharan:api_sched_order_lock) ** https://github.com/Linaro/odp/pull/129 ** Patch: https://github.com/Linaro/odp/pull/129.patch ** Base sha: 859293ad9b3c862264bb0fbfe8e7037b5e04d084 ** Merge commit sha: 039de688a242ee44f5495e97b35637c173ef459f **/ platform/linux-generic/include/odp_schedule_if.h | 1 + platform/linux-generic/odp_schedule_if.c | 5 ++++ platform/linux-generic/odp_schedule_iquery.c | 29 +++++++++++++++++++++++- platform/linux-generic/odp_schedule_scalable.c | 6 +++++ platform/linux-generic/odp_schedule_sp.c | 8 ++++++- 5 files changed, 47 insertions(+), 2 deletions(-) diff --git a/platform/linux-generic/include/odp_schedule_if.h b/platform/linux-generic/include/odp_schedule_if.h index 657993b1..b0db67ab 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/odp_schedule_if.c b/platform/linux-generic/odp_schedule_if.c index 2f07aafe..35e34b03 100644 --- a/platform/linux-generic/odp_schedule_if.c +++ b/platform/linux-generic/odp_schedule_if.c @@ -127,3 +127,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 86f5d53e..777bfe24 100644 --- a/platform/linux-generic/odp_schedule_iquery.c +++ b/platform/linux-generic/odp_schedule_iquery.c @@ -1294,6 +1294,32 @@ static void schedule_order_unlock(unsigned lock_index) odp_atomic_store_rel_u64(ord_lock, thread_local.ordered.ctx + 1); } +static inline uint8_t powerof2(uint32_t n) +{ + return n && (! (n & (n - 1))); +} + +static void schedule_order_unlock_lock(unsigned lock_index) +{ + uint32_t queue_index; + unsigned acquired_lock = 0; + uint32_t i; + + queue_index = thread_local.ordered.src_queue; + + ODP_ASSERT(queue_index != NULL_INDEX); + + if (!powerof2(thread_local.ordered.lock_called.all)) + return; + + for (i = 0; i < CONFIG_QUEUE_MAX_ORD_LOCKS; i++) + if (1 == thread_local.ordered.lock_called.u8[i]) + acquired_lock = i; + + schedule_order_unlock(acquired_lock); + schedule_order_lock(lock_index); +} + static unsigned schedule_max_ordered_locks(void) { return CONFIG_QUEUE_MAX_ORD_LOCKS; @@ -1366,7 +1392,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 78159b53..5868f1dd 100644 --- a/platform/linux-generic/odp_schedule_scalable.c +++ b/platform/linux-generic/odp_schedule_scalable.c @@ -1027,6 +1027,11 @@ static void schedule_order_unlock(unsigned lock_index) rctx->olock_flags |= 1U << lock_index; } +static void schedule_order_unlock_lock(unsigned lock_index) +{ + (void) lock_index; +} + static void schedule_release_atomic(void) { sched_scalable_thread_state_t *ts; @@ -1977,4 +1982,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 9829acc5..fb54dd7a 100644 --- a/platform/linux-generic/odp_schedule_sp.c +++ b/platform/linux-generic/odp_schedule_sp.c @@ -817,6 +817,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) { } @@ -866,5 +871,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 };