From patchwork Tue Nov 21 14: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: 119363 Delivered-To: patch@linaro.org Received: by 10.80.225.132 with SMTP id k4csp5134000edl; Tue, 21 Nov 2017 06:03:55 -0800 (PST) X-Google-Smtp-Source: AGs4zMaPfAWVZ8ax7W6PJ7jHHDq0eoxq8m/SNsGbmAMHO2Et90AuN0VoTBgjQ4XXnPg/NTqPyCv1 X-Received: by 10.55.104.135 with SMTP id d129mr26712118qkc.349.1511273035271; Tue, 21 Nov 2017 06:03:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511273035; cv=none; d=google.com; s=arc-20160816; b=wFHFVs7dDYxinUzbnhduAB+qaNOToVFEViWFSG51vTjyHamF0KEnwWzdd7UClSa8YC Ok9/IeNFc4iOiFWWy0eMvb54tJ55wZamKZEXCkMMHQ6fQwbGxo8DqIgPq+CW96L6iERu sAVlLFgX+aoQkbM5pvZ5g+ASu8D3psSrXFNWKUnOT8lSYC+K0r5Ce0JX2GBHd0FEWxGA zhoRXMZ1JQ0Tli4raX/53z43JNnkBfyEh8mJsUHZH6C+6sT4wOIqcflBxCT6sbQG6Vvz dGkU8cVtOuOeVsGTJqtwBSCcGZKPuQYNw7DHyrMBz2jn91H7v7K2J/+xfMMYIerIIyyq hoKQ== 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=HxIWc1+wnb1QeR7dOmMGF1775YyruOf+WQZ5SjVLfZ4=; b=CqdkFh/KLty6ggp7MuKBmDRrnw+66IuDsHnY3bwKDNgIydMaRK5tymzLEQZSvNY9VE 6LZEkNCqHukzJthn5Ud8I3HVwDRp4YJ/caU9KbYBLBa/DOX6T/owQZNZecSt58WF+djK b4ksCUt2NG/YMWFV/7yC0QIh+mpMZl63JWxNeYwe5BotTWggo/lbWMfJxDJqjRBtCGfW u7lRIoaIZv2vNY9IK50uBjEcH0EeqNYNQYawuUqNSfr9sjO3c4uolOG/6IhjAyCooeLS nNk6g7BLZ8d5PDRqO8IrRTA3GOamHu8EOCK3JzdOhvtOxHAmoGegjTkBpLMtkvuSSBah fz/w== 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 r11si1122686qtc.154.2017.11.21.06.03.54; Tue, 21 Nov 2017 06:03:55 -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 A864F609A6; Tue, 21 Nov 2017 14:03:54 +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 F0E2F6088C; Tue, 21 Nov 2017 14:01:21 +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 797EF608DF; Tue, 21 Nov 2017 14:01:06 +0000 (UTC) Received: from forward100o.mail.yandex.net (forward100o.mail.yandex.net [37.140.190.180]) by lists.linaro.org (Postfix) with ESMTPS id 349A160879 for ; Tue, 21 Nov 2017 14:00:14 +0000 (UTC) Received: from mxback4j.mail.yandex.net (mxback4j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10d]) by forward100o.mail.yandex.net (Yandex) with ESMTP id CE16E2A227DE for ; Tue, 21 Nov 2017 17:00:12 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback4j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id Nk9nJibm4h-0ClqHekf; Tue, 21 Nov 2017 17:00:12 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 9eiNlUBoJ2-0CvCWMHL; Tue, 21 Nov 2017 17:00:12 +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, 21 Nov 2017 17:00:09 +0300 Message-Id: <1511272811-6276-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511272811-6276-1-git-send-email-odpbot@yandex.ru> References: <1511272811-6276-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 302 Subject: [lng-odp] [PATCH API-NEXT v1 1/3] api: queue: 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: d4b364849c4abb4c71e0c5260e1a793ebb8dc97d ** Merge commit sha: fc00736d09bd0388db2bde3a9177edfd995eec67 **/ include/odp/api/spec/queue.h | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/include/odp/api/spec/queue.h b/include/odp/api/spec/queue.h index 73598be06..7f2d7cb2e 100644 --- a/include/odp/api/spec/queue.h +++ b/include/odp/api/spec/queue.h @@ -96,6 +96,32 @@ typedef enum odp_queue_op_mode_t { } odp_queue_op_mode_t; +/** + * Blocking level + * + * Blocking level tells how operations behave when one of the threads using + * the same resource suspends. A blocking implementation may block other threads + * using the same resource for the entire time that one of the threads remain + * suspended. On the contrary, a lock-free implementation allows other threads + * to make progress while a thread is suspended. Blocking levels are listed from + * the weakest to the strongest guarantee of block freedom. + * + * Performance of non-blocking operations may be lower than blocking ones, but + * can be used safely e.g. between threads of real-time and non real-time parts + * of an application. + */ +typedef enum odp_blocking_level_t { + /** Operations may block. Other threads may be blocked while a thread + * is suspended. This is the lowest blocking level (no block freedom + * guarantees). */ + ODP_BLOCKING = 0, + + /** Lock-free operation. Other threads can make progress while a thread + * is suspended. */ + ODP_LOCKFREE + +} odp_blocking_level_t; + /** * Queue capabilities */ @@ -125,6 +151,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_blocking_level_t blocking_level; + } plain; /** Scheduled queue capabilities */ @@ -138,6 +168,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_blocking_level_t blocking_level; + } sched; } odp_queue_capability_t; @@ -178,6 +212,13 @@ typedef struct odp_queue_param_t { * ODP_QUEUE_TYPE_SCHED. */ odp_schedule_param_t sched; + /** 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_blocking_level_t blocking_level; + /** Queue context pointer * * User defined context pointer associated with the queue. The same