From patchwork Sun Aug 9 13:24:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 52102 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by patches.linaro.org (Postfix) with ESMTPS id D0B462152A for ; Sun, 9 Aug 2015 13:31:08 +0000 (UTC) Received: by lbsm2 with SMTP id m2sf17499890lbs.1 for ; Sun, 09 Aug 2015 06:31:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:date :message-id:in-reply-to:references:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :mime-version:content-type:content-transfer-encoding:errors-to :sender:x-original-sender:x-original-authentication-results :mailing-list; bh=OS2ycD/ihXvBl7MdE4sGwIK0ad1R3CQhr/uO80M6pw8=; b=VPbZuZmnE92MTWU4JXaGLqn+cnGmJjjUBfuZUwBKUMP6TniGliW3jSCbk++P45J5qa 1uTeJvv6qmPDn42Y9QPbkxtPl2rMr0HP7CgnwPhtWe9MSP3DgbxGCkTvCT8Jmj3/NV7s wmW1qgqUu/qh6mG6k5zNLu9+X31zaw5NrEXxxY2ewYc2GgXytZ0insd31YHXrnWvsTv9 KeTHrWr/XaTkVQDizS3/Q0YNmj5/NAZYGfjkcT9vGdMo+BA0/1VsoayAfoZuQJ8piwtX GsX5abPtFaLjzZ0cOauP/N7kNtOFHRwp2zZC1VuWDoDbdLtoolf9jqdGFFiwWXdjxsBz t9Yw== X-Gm-Message-State: ALoCoQkFoOijF1hWjF5pNZ3XJaoxaO4vNn6bn6bhOY41BUe4nNH9qE9XMsPqW7RS9IambWVS7aOF X-Received: by 10.194.179.42 with SMTP id dd10mr4899222wjc.7.1439127067657; Sun, 09 Aug 2015 06:31:07 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.120.198 with SMTP id le6ls578848lab.56.gmail; Sun, 09 Aug 2015 06:31:07 -0700 (PDT) X-Received: by 10.112.160.73 with SMTP id xi9mr16139267lbb.92.1439127067495; Sun, 09 Aug 2015 06:31:07 -0700 (PDT) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id a5si12016351lbq.168.2015.08.09.06.31.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 09 Aug 2015 06:31:07 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by labd1 with SMTP id d1so28440059lab.1 for ; Sun, 09 Aug 2015 06:31:07 -0700 (PDT) X-Received: by 10.112.199.133 with SMTP id jk5mr16876650lbc.32.1439127067053; Sun, 09 Aug 2015 06:31:07 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.7.198 with SMTP id l6csp1429950lba; Sun, 9 Aug 2015 06:31:05 -0700 (PDT) X-Received: by 10.55.51.79 with SMTP id z76mr30718741qkz.32.1439127065400; Sun, 09 Aug 2015 06:31:05 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id i9si28911131qgf.23.2015.08.09.06.31.04; Sun, 09 Aug 2015 06:31:05 -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; Received: by lists.linaro.org (Postfix, from userid 109) id A590261E67; Sun, 9 Aug 2015 13:31:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from ip-10-142-244-252.ec2.internal (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 4477E620BE; Sun, 9 Aug 2015 13:26:50 +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 6BF6461CE9; Sun, 9 Aug 2015 13:25:44 +0000 (UTC) Received: from mail-oi0-f49.google.com (mail-oi0-f49.google.com [209.85.218.49]) by lists.linaro.org (Postfix) with ESMTPS id 3DD7361F5D for ; Sun, 9 Aug 2015 13:24:57 +0000 (UTC) Received: by oiev193 with SMTP id v193so45699496oie.3 for ; Sun, 09 Aug 2015 06:24:56 -0700 (PDT) X-Received: by 10.202.185.133 with SMTP id j127mr14855542oif.9.1439126696699; Sun, 09 Aug 2015 06:24:56 -0700 (PDT) Received: from localhost.localdomain (cpe-24-28-70-239.austin.res.rr.com. [24.28.70.239]) by smtp.gmail.com with ESMTPSA id rg1sm10096074oeb.11.2015.08.09.06.24.55 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 09 Aug 2015 06:24:56 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Sun, 9 Aug 2015 08:24:39 -0500 Message-Id: <1439126687-19932-6-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1439126687-19932-1-git-send-email-bill.fischofer@linaro.org> References: <1439126687-19932-1-git-send-email-bill.fischofer@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCHv13 05/13] api: schedule: add odp_schedule_order_lock/unlock X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: bill.fischofer@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Additional scheduler APIs: odp_schedule_order_lock() odp_schedule_order_unlock() Signed-off-by: Bill Fischofer --- include/odp/api/schedule.h | 81 +++++++++++----------- .../include/odp/plat/schedule_types.h | 2 - 2 files changed, 42 insertions(+), 41 deletions(-) diff --git a/include/odp/api/schedule.h b/include/odp/api/schedule.h index 61d3b16..f715144 100644 --- a/include/odp/api/schedule.h +++ b/include/odp/api/schedule.h @@ -174,6 +174,41 @@ void odp_schedule_release_atomic(void); int odp_schedule_release_ordered(odp_event_t ev); /** + * Ordered event lock + * + * Provide reusable in-order serialization for scheduled ordered events. Upon + * return the caller is in order with respect to other events originating from + * the current ordered context and will retain order until a subsequent + * odp_schedule_order_unlock() call is made, or until order is resolved for + * the event via a call to odp_queue_enq() or odp_schedule_release_ordered(). + * If the caller holds multiple events, e.g., as received from + * odp_schedule_multi(), then the list of events may only be locked in their + * received order to avoid deadlock. That is, if the caller received events + * 1, 2, and 3 from odp_schedule_multi(), it is an error to attempt to lock + * event 2 before locking and unlocking event 1 or otherwise resolving event + * 1's order. + * + * @param ev The event whose order is to be locked. This event MUST have + * originated from an ordered queue. + */ +void odp_schedule_order_lock(odp_event_t ev); + +/** + * Ordered event unlock + * + * Release an ordered lock previously acquired by odp_schedule_order_lock(). + * It is an error to attempt to release a lock that had not been previously + * acquired for the specified event. Following this call, the thread will + * exit the critical section protected by the ordered lock and will resume + * parallel execution until the next call to odp_schedule_order_lock() for + * that event, or until the event's order is resolved by a call to + * odp_queue_enq() or odp_schedule_release_ordered(). + * + * @param ev The event whose order is to be unlocked. + */ +void odp_schedule_order_unlock(odp_event_t ev); + +/** * Copy order from one event to another * * This call copies the order associated with an event originating from an @@ -181,14 +216,19 @@ int odp_schedule_release_ordered(odp_event_t ev); * associated ordering at input to the call. If the target is ordered, the * prior ordering must first be released by an odp_schedule_release_ordered() * call. Successfuly copying an order implicitly sets the order sustain - * attribute for the src_event as if odp_schedule_order_sustain() were called - * for it. + * attribute for the src_event as if odp_schedule_order_sustain_set() were + * called for it. * * @param src_event Event whose ordering is to be copied * @param dst_event Event to receive the same ordering as src_event. * * @retval 0 Success * @retval <0 Failure. Order not copied. + * + * @note If multiple events share the same order as a result of + * odp_schedule_order_copy(), only one of them should attempt to lock the + * order via calls to odp_schedule_order_lock(). Results are undefined if this + * restriction is not observed. */ int odp_schedule_order_copy(odp_event_t src_event, odp_event_t dst_event); @@ -336,43 +376,6 @@ int odp_schedule_group_leave(odp_schedule_group_t group, int odp_schedule_group_count(odp_schedule_group_t group); /** - * Initialize ordered context lock - * - * Initialize an ordered queue context lock. The lock can be associated only - * with ordered queues and used only within an ordered synchronization context. - * - * @param queue Ordered queue - * @param lock Ordered context lock - * - * @retval 0 on success - * @retval <0 on failure - */ -int odp_schedule_olock_init(odp_queue_t queue, odp_schedule_olock_t *lock); - -/** - * Acquire ordered context lock - * - * This call is valid only when holding an ordered synchronization context. The - * lock is used to protect a critical section that is executed within an - * ordered context. Threads enter the critical section in the order determined - * by the context (source queue). Lock ordering is automatically skipped for - * threads that release the context instead of calling the lock. - * - * @param lock Ordered context lock - */ -void odp_schedule_olock_lock(odp_schedule_olock_t *lock); - -/** - * Release ordered context lock - * - * This call is valid only when holding an ordered synchronization context. - * Release a previously locked ordered context lock. - * - * @param lock Ordered context lock - */ -void odp_schedule_olock_unlock(odp_schedule_olock_t *lock); - -/** * @} */ diff --git a/platform/linux-generic/include/odp/plat/schedule_types.h b/platform/linux-generic/include/odp/plat/schedule_types.h index 91e62e7..bc25c8c 100644 --- a/platform/linux-generic/include/odp/plat/schedule_types.h +++ b/platform/linux-generic/include/odp/plat/schedule_types.h @@ -48,8 +48,6 @@ typedef int odp_schedule_group_t; #define ODP_SCHED_GROUP_NAME_LEN 32 -typedef int odp_schedule_olock_t; - /** * @} */