From patchwork Tue Jul 17 04:52:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honnappa Nagarahalli X-Patchwork-Id: 142104 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp3193803ljj; Mon, 16 Jul 2018 21:53:11 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcOmX52m2YhPUm4/pvLtZRSgDlBPgOmx8MrbhTLxxaqWWr0WDlA3ceuOkjb2Y2mIJd0mwMo X-Received: by 2002:adf:9051:: with SMTP id h75-v6mr49050wrh.65.1531803191409; Mon, 16 Jul 2018 21:53:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531803191; cv=none; d=google.com; s=arc-20160816; b=PMXz6I+fHX4hcvRJZWDOxW8BcxLFqYIlWbg4bu5OcNAY4Ck6RYuPldB1c0t5eu17bx jmhvA2Bcjy8pw5SAIkehrUkib4mtMv6g+disZZnTPM3E8g0AZuaQI/mk1mpzd5jE/j44 bNAEp2UGSiUlbJNsj4LO/jlOf6PwAadGrh1N2XlC1D4Dn4YbOiRzLwQQRNpIg2bFmLbt 8fqFAw+yLvwLDJBYkSNf9wxFf7ZMDE9xTBBKj6pXPMPNrFWp5GYTU7BW3m5dPb5mby8Z b1FK76J+G/xVDOn2bmRzdlD7hlOe6CnxpzwSuf3UYV2vgDnNU4D1DeizmqGcRoaOzNt2 6fog== 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:message-id:date:cc:to :from:arc-authentication-results; bh=Li3bWZmEbhXbT3lDQwbIv5koDAN8+bgL0Lgjt/CBWyA=; b=TKzsNuzCO+ujDlbVhdRjItsW1ddLIx2A2Q1Mu/MnpbWp3Cp4TxPbTwx5HhYx4szE+h NiuGUPQQsTADhPgD8ovFENsE9q1ApukiMhD6iqbkPq8PJYZlUvISBoEZMECRvJaxRPJN jO1S/qYkH7unAx55JFm5tuYUTk0hd0t/q4le55hN1HLj9bb4ivY2lRcWpsISFQn/9v4M u62W3q6tVHu7uCGK4fFmLhG/Kc1Pvd3cbNF8PS9WxFoaTd7c0xH01noUdGxkGj5lkKQp mCqPywZWy1e0BnscvpEGX+NzyQ4UNlGGBR1+o6JGXU9MO5xjZBslB6ZdTahTwpn8boHY MAsg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id y65-v6si210956wmb.136.2018.07.16.21.53.10; Mon, 16 Jul 2018 21:53:11 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2238A23C; Tue, 17 Jul 2018 06:53:08 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.101.70]) by dpdk.org (Postfix) with ESMTP id 0B4EA16E for ; Tue, 17 Jul 2018 06:53:05 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0EBA27A9; Mon, 16 Jul 2018 21:53:05 -0700 (PDT) Received: from ubuntu.localdomain (unknown [10.119.48.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8B61E3F5A0; Mon, 16 Jul 2018 21:53:04 -0700 (PDT) From: Honnappa Nagarahalli To: honnappa.nagarahalli@arm.com, olivier.matz@6wind.com, anatoly.burakov@intel.com Cc: dev@dpdk.org, nd@arm.com Date: Mon, 16 Jul 2018 23:52:44 -0500 Message-Id: <1531803164-46516-1-git-send-email-honnappa.nagarahalli@arm.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH v4] rte_ring: clarify preemptible nature of ring algorithm X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" rte_ring implementation is not preemptible only under certain circumstances. This clarification is helpful for data plane and control plane communication using rte_ring. Signed-off-by: Honnappa Nagarahalli Reviewed-by: Gavin Hu Reviewed-by: Ola Liljedahl --- v4: * Undo few changes (Anatoly, Oliver) v3: * Corrected known issues for rte_ring * Referred to known issues in rte_ring.h (Anatoly, Oliver) v2: * Fixed checkpatch warnings doc/guides/prog_guide/env_abstraction_layer.rst | 12 ++++++++---- lib/librte_ring/rte_ring.h | 5 +++-- 2 files changed, 11 insertions(+), 6 deletions(-) -- 2.7.4 Acked-by: Olivier Matz diff --git a/doc/guides/prog_guide/env_abstraction_layer.rst b/doc/guides/prog_guide/env_abstraction_layer.rst index a22640d..99d259f 100644 --- a/doc/guides/prog_guide/env_abstraction_layer.rst +++ b/doc/guides/prog_guide/env_abstraction_layer.rst @@ -445,13 +445,17 @@ Known Issues Bypassing this constraint may cause the 2nd pthread to spin until the 1st one is scheduled again. Moreover, if the 1st pthread is preempted by a context that has an higher priority, it may even cause a dead lock. - This does not mean it cannot be used, simply, there is a need to narrow down the situation when it is used by multi-pthread on the same core. + This means, use cases involving preemptible pthreads should consider using rte_ring carefully. - 1. It CAN be used for any single-producer or single-consumer situation. + 1. It CAN be used for preemptible single-producer and single-consumer use case. - 2. It MAY be used by multi-producer/consumer pthread whose scheduling policy are all SCHED_OTHER(cfs). User SHOULD be aware of the performance penalty before using it. + 2. It CAN be used for non-preemptible multi-producer and preemptible single-consumer use case. - 3. It MUST not be used by multi-producer/consumer pthreads, whose scheduling policies are SCHED_FIFO or SCHED_RR. + 3. It CAN be used for preemptible single-producer and non-preemptible multi-consumer use case. + + 4. It MAY be used by preemptible multi-producer and/or preemptible multi-consumer pthreads whose scheduling policy are all SCHED_OTHER(cfs), SCHED_IDLE or SCHED_BATCH. User SHOULD be aware of the performance penalty before using it. + + 5. It MUST not be used by multi-producer/consumer pthreads, whose scheduling policies are SCHED_FIFO or SCHED_RR. + rte_timer diff --git a/lib/librte_ring/rte_ring.h b/lib/librte_ring/rte_ring.h index 1245822..e680101 100644 --- a/lib/librte_ring/rte_ring.h +++ b/lib/librte_ring/rte_ring.h @@ -26,8 +26,9 @@ * - Bulk dequeue. * - Bulk enqueue. * - * Note: the ring implementation is not preemptable. A lcore must not - * be interrupted by another task that uses the same ring. + * Note: the ring implementation is not preemptible. Refer to Programmer's + * guide/Environment Abstraction Layer/Multiple pthread/Known Issues/rte_ring + * for more information. * */