From patchwork Thu Nov 30 11:00:11 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: 120132 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp513474qgn; Thu, 30 Nov 2017 03:02:01 -0800 (PST) X-Google-Smtp-Source: AGs4zMZ5m8g2O8iVKWmxvOX74nrJv2D2kHXtn8oNqmKHkbcmkNCOavmTg50Hqk5j6mCCBzGPIbvS X-Received: by 10.200.1.20 with SMTP id e20mr2572014qtg.97.1512039721463; Thu, 30 Nov 2017 03:02:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512039721; cv=none; d=google.com; s=arc-20160816; b=ugsWengMx+k1GwBgbWtWZBlv3MhHXCRCyXtNOKeT2wZrztYiULeIHoGrzAzUgFcLKO KMbdZ+D3rD2Fht+9i4UlAh5BpZ1bhzz7zpeXeLuEaOONbxu8eWGyVHqwjLPaitQfugZt bZPKI3FboaGA1ai/rRTmt++hb+bvZDtU3tCBjQT8jbxUfFyL/E6p4c2bKmoyE/58URzz NR3xXTA5I4v4sZt1TLSNnKXpXUrVWOTmUDnEuJq8r/qR7rWerjTIFfUdtqC0ojV8EMDV mrWXfHGPaxT7Jk4Nhyq2Ru4iYApXScGz0WTvl8K/PrTcN21xZVwpb2z6koxC7vDqqJno 2PFg== 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=WUtDlQ1L2YlkPt+K07EGhjRFvOVH6hNpyWmpOd9Y1Ng=; b=ONu/GD3ep/jwdNVIPWNBghxSX0O552/wgXD9mWKYYX58tR2uf4V3pTWP/2yMhpffoN REQ5cWIRixwIdKszu9YuJf2QxNu70N7V6ISpj9hSCt2PylnEnGg4MlRmB8irkdCdrK4Z Zr6XrMDZG57L+CJ85SLV0fgTKrBPc9INEYXhqOa99CU/pFwR03rOwb1Wslea5qupJV4o 3eXbsvpVlRFgSSGjXh+/uWJnD4E72gWpC3JEBd/mEIBiBHGT9fEjewNIad3iCuhk3sqw ZaO7dZS5SWxZkIBK670dJfEBwZbsfls0DUWxMpvRaWB1ETxHPrSEiW2E9AeZmHuinULS Q5GA== 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 r7si3036853qtd.259.2017.11.30.03.02.01; Thu, 30 Nov 2017 03:02:01 -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 16DB960676; Thu, 30 Nov 2017 11:02:01 +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_H3,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 EE49460927; Thu, 30 Nov 2017 11:00:36 +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 EBD3E6092C; Thu, 30 Nov 2017 11:00:25 +0000 (UTC) Received: from forward105j.mail.yandex.net (forward105j.mail.yandex.net [5.45.198.248]) by lists.linaro.org (Postfix) with ESMTPS id 3B1A060905 for ; Thu, 30 Nov 2017 11:00:17 +0000 (UTC) Received: from mxback9j.mail.yandex.net (mxback9j.mail.yandex.net [IPv6:2a02:6b8:0:1619::112]) by forward105j.mail.yandex.net (Yandex) with ESMTP id DFA6718643F for ; Thu, 30 Nov 2017 14:00:15 +0300 (MSK) Received: from smtp1j.mail.yandex.net (smtp1j.mail.yandex.net [2a02:6b8:0:801::ab]) by mxback9j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id LiXjK55aaN-0FYaDA9S; Thu, 30 Nov 2017 14:00:15 +0300 Received: by smtp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id TjYY9mZD4X-0E2q7iuX; Thu, 30 Nov 2017 14:00:14 +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: Thu, 30 Nov 2017 14:00:11 +0300 Message-Id: <1512039613-7090-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512039613-7090-1-git-send-email-odpbot@yandex.ru> References: <1512039613-7090-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 302 Subject: [lng-odp] [PATCH API-NEXT v2 1/3] api: queue: non-blocking level parameter 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: Petri Savolainen Add queue parameter and capability to indicate queue operation blocking level. This guarantee of non-blocking is important for real-time applications. HW based implementations may be always non-blocking. Where as, SW based implementation need to trade-off between block freedom and performance. Signed-off-by: Petri Savolainen --- /** Email created from pull request 302 (psavol:next-lockfree-queue) ** https://github.com/Linaro/odp/pull/302 ** Patch: https://github.com/Linaro/odp/pull/302.patch ** Base sha: 4cb02e1caccb9179575e95448fd46979e17d0905 ** Merge commit sha: 2fb581ec76ff776f788da097894cb3f6b63ae23d **/ include/odp/api/spec/queue.h | 63 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/include/odp/api/spec/queue.h b/include/odp/api/spec/queue.h index 73598be06..8069cf08d 100644 --- a/include/odp/api/spec/queue.h +++ b/include/odp/api/spec/queue.h @@ -96,6 +96,54 @@ typedef enum odp_queue_op_mode_t { } odp_queue_op_mode_t; +/** + * Non-blocking level + * + * A non-blocking level defines implementation guarantees for application + * progress when multiple threads operate on the same resource (e.g. a queue) + * simultaneously. The first level (ODP_BLOCKING) does not have any block + * freedom guarantees, but a suspending thread may block the other threads for + * the entire time it remains suspended (infinitely if crashed). + * On the contrary, actual non-blocking levels provide guarantees of progress: + * + * ODP_NONBLOCKING_LF: A non-blocking and lock-free implementation guarantees + * that at least one of the threads successfully completes + * its operations, regardless of what other threads do. + * Application progress is guaranteed, but individual + * threads may starve while trying to execute their + * operations on the shared resource. + * + * ODP_NONBLOCKING_WF: A non-blocking and wait-free implementation guarantees + * application progress with starvation freedom. All + * threads are guaranteed to complete their operations in + * a bounded number of steps, regardless of what other + * threads do. + * + * Non-blocking levels are listed from the weakest to the strongest guarantee of + * block freedom. Performance of a non-blocking implementation may be lower than + * the blocking one. Non-blocking guarantees are important e.g. for real-time + * applications when real-time and non real-time threads share a resource. + */ +typedef enum odp_nonblocking_t { + /** Blocking implementation. A suspeding thread may block all other + * threads, i.e. no block freedom guarantees. This is the lowest level. + */ + ODP_BLOCKING = 0, + + /** Non-blocking and lock-free implementation. Other threads can make + * progress while a thread is suspended. Starvation freedom is not + * guaranteed. + */ + ODP_NONBLOCKING_LF, + + /** Non-blocking and wait-free implementation. Other threads can make + * progress while a thread is suspended. Starvation freedom is + * guaranteed. + */ + ODP_NONBLOCKING_WF + +} odp_nonblocking_t; + /** * Queue capabilities */ @@ -125,6 +173,10 @@ typedef struct odp_queue_capability_t { * store all available events. */ uint32_t max_size; + /** The strongest guarantee of block freedom that is supported + * for plain queues. */ + odp_nonblocking_t nonblocking; + } plain; /** Scheduled queue capabilities */ @@ -138,6 +190,10 @@ typedef struct odp_queue_capability_t { * store all available events. */ uint32_t max_size; + /** The strongest guarantee of block freedom that is supported + * for scheduled queues. */ + odp_nonblocking_t nonblocking; + } sched; } odp_queue_capability_t; @@ -178,6 +234,13 @@ typedef struct odp_queue_param_t { * ODP_QUEUE_TYPE_SCHED. */ odp_schedule_param_t sched; + /** Non-blocking level + * + * Queue implementation must guarantee at least this level of block + * freedom for queue enqueue and dequeue/schedule operations. + * The default value is ODP_BLOCKING. */ + odp_nonblocking_t nonblocking; + /** Queue context pointer * * User defined context pointer associated with the queue. The same