From patchwork Mon Apr 12 08:28:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanislaw Kardach X-Patchwork-Id: 91101 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6D0BFA0C44; Mon, 12 Apr 2021 10:29:36 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0CEB0140FAC; Mon, 12 Apr 2021 10:29:32 +0200 (CEST) Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) by mails.dpdk.org (Postfix) with ESMTP id E999B4014E for ; Mon, 12 Apr 2021 10:29:29 +0200 (CEST) Received: by mail-lf1-f48.google.com with SMTP id b14so20012032lfv.8 for ; Mon, 12 Apr 2021 01:29:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=530x2oyCfvbSNQ8C3lTAdc7PFNj7IhZ66GiYWMPKQ9Q=; b=xNPOQkhDALbBmKTAtrky4S6qJSmFeammSUor81ypI5zX6jNshf2UvqfJuFZkn0LmXc nch1ZCpq+xneMSGSOxdBQ113iPKQjO28CF6kMufuTJK4cn7711Mn30EnKI+fLYc2JA0N V0l+V/VEji8gQikJ5KAMhzw0nucdjZfDqJQ+RO/84POPqX1fKQoHzJUaAaeMm+ttp13V qr4KG2kjXR8J0CO6lkdmYpsvMLJnwhjQkB4wn/gfihIZ3FRshxaP6C8RPnV25DHU05fc 2oHw2uhY+ZVw09vvvlamE6jG/+9UxrJTckSyuPMKXJbnUGdU83l3jbQNgVGDvRa5E8bz +VYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=530x2oyCfvbSNQ8C3lTAdc7PFNj7IhZ66GiYWMPKQ9Q=; b=FCq5262k4wdjxwASys3eFswgOa8TYb5YlQUSk6tzfQsBgBUNRw0DK8lH7EwpiSHBON Pn2Rh1hkAGK5Um2gklRGDxp2JV4uux73F/lQjuMgpFnBPd+bvjDpnXSjHyf+bvNDsb+h KOQlyaPrhMtieQQzCSxm79WNRG2WuZss6tub3rMvwGQ2IWu2ZsBLlxt4c/AyIgs2b7Vd 9X6A2XFt375zXXnD2UMYAKhsJJPBhk96w2D0ACkP0tpKSMpKMXV5YER+fAXEzlkXl1TA 6GSG5x4WyzOA9UgkDbYJ1Y7irmSI6F7L3glNd9eL3IV3Nq2C3YzFLtTJms8KnxOxfZF+ x1hQ== X-Gm-Message-State: AOAM530NExGNMJX61UE3JTwEqxdYIoeyni9zUJM8zSm86GMwY7/YEGFy AVmSg4Dgr7RK1YMFzfbcXvGEoQ== X-Google-Smtp-Source: ABdhPJw5Znmhjt31rBFELNtPqVtbV99ZdfXwtL7PGK8h1A0sPV4zfIwSnJs2rfyBbKlOE/XqDTwxAg== X-Received: by 2002:ac2:4909:: with SMTP id n9mr9148022lfi.242.1618216169577; Mon, 12 Apr 2021 01:29:29 -0700 (PDT) Received: from toster.semihalf.com (host-193.106.246.139.static.3s.pl. [193.106.246.139]) by smtp.gmail.com with ESMTPSA id x4sm2691118ljd.112.2021.04.12.01.29.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Apr 2021 01:29:29 -0700 (PDT) From: Stanislaw Kardach To: Olivier Matz Cc: dev@dpdk.org, Stanislaw Kardach , phil.yang@arm.com, stable@dpdk.org Date: Mon, 12 Apr 2021 10:28:59 +0200 Message-Id: <20210412082901.652736-2-kda@semihalf.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210412082901.652736-1-kda@semihalf.com> References: <20210412082901.652736-1-kda@semihalf.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 1/3] stack: update lock-free supported archs X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" Since 7911ba047 lock-free stack is supported on arm64 but this description was missing from the doxygen for the flag. Signed-off-by: Stanislaw Kardach Fixes: 7911ba0473e0 ("stack: enable lock-free implementation for aarch64") Cc: phil.yang@arm.com Cc: stable@dpdk.org Acked-by: Olivier Matz --- lib/librte_stack/rte_stack.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_stack/rte_stack.h b/lib/librte_stack/rte_stack.h index 395b9ef83..b82c74e72 100644 --- a/lib/librte_stack/rte_stack.h +++ b/lib/librte_stack/rte_stack.h @@ -89,7 +89,7 @@ struct rte_stack { /** * The stack uses lock-free push and pop functions. This flag is only - * supported on x86_64 platforms, currently. + * supported on x86_64 or arm64 platforms, currently. */ #define RTE_STACK_F_LF 0x0001 From patchwork Mon Apr 12 08:29:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanislaw Kardach X-Patchwork-Id: 91102 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4151CA0C44; Mon, 12 Apr 2021 10:29:43 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 95DD1140FC0; Mon, 12 Apr 2021 10:29:33 +0200 (CEST) Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) by mails.dpdk.org (Postfix) with ESMTP id AB1794014E for ; Mon, 12 Apr 2021 10:29:30 +0200 (CEST) Received: by mail-lf1-f51.google.com with SMTP id b14so20012078lfv.8 for ; Mon, 12 Apr 2021 01:29:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tU24hPsZkZ7o3h6ovCZ80IvRq1RBxTdPMb3w7zVoAkc=; b=BpLIOCmzsCmBL5p54jA06Bd43maHRwhb6CEdIuwTQCe0KtExXD+pxJlnTsrhv+WpW8 1l9CrLWtA6u8YJFmns/tqG7aQKfVbjN7eY4iAD/vEjUqnufFtxNKGAE9vzhay0vdMmN1 iAM9tQv8JHHRxdnHxq4n61anLdmlsGfH32BzxbFlR9Zt0DfvD/XSczf4LxJCImCJsj6U 57t5RxGz50GdGFyE7m2k+bjKPLGLQGf8jzCq3taJ/gqzYrq9WYGu/PUdje6DqC/GfmFV Q67pRiz7ZuHmiW7K3pXf0gZ+i3t9VZqWFwLWOLbvse0jqvoZvz5DcHoUNsfhlYbt/4k+ YeBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tU24hPsZkZ7o3h6ovCZ80IvRq1RBxTdPMb3w7zVoAkc=; b=lVLGMayW3eWRxUQnyx3u7zq6krfMlIalciM5JYRPvIxWQeQCqGnEPjEe1QioheTPWO KIfKu/NeUKdtzPpDTWeUssS5Cf/ueLjvh17Jugbc/Ka4WcO/mNLRd96JY5Y2J7wp2oRg a2ib70li9H5dnUCJNt02ZjG6ATQHTMK5KhOLsU3t2vbQW/iAVej3NUmY3FRqKn9kvkD8 MtT6gA4ND8V0vgY0VsdGoZokw9kCHqrpmbse9wrWrvLajFguOwNphme0+XnLRTCOwf03 atZ5mrcBMmAdib1r7L7xKJXrQqG0++eUFJxeFnSHi9wDq+TVDjEQ4SLf9XuI+h0rC1F1 m8CA== X-Gm-Message-State: AOAM533NK+oBRo4HVbDXLJ+v6qlU9sAf5W8fBtPlIYZ9GxG7rGhORavT F+Of/bkejv3VuhUDYZEU15Sq7g== X-Google-Smtp-Source: ABdhPJxSs01v2e3I1MmYolWILMTd5PUkcLnLddkRGMfrvwU3P6W7mwRQMwlmv36ZobWklcIFy3A2cA== X-Received: by 2002:ac2:5a4e:: with SMTP id r14mr10030220lfn.78.1618216170281; Mon, 12 Apr 2021 01:29:30 -0700 (PDT) Received: from toster.semihalf.com (host-193.106.246.139.static.3s.pl. [193.106.246.139]) by smtp.gmail.com with ESMTPSA id x4sm2691118ljd.112.2021.04.12.01.29.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Apr 2021 01:29:30 -0700 (PDT) From: Stanislaw Kardach To: Olivier Matz Cc: dev@dpdk.org, Stanislaw Kardach , phil.yang@arm.com, stable@dpdk.org Date: Mon, 12 Apr 2021 10:29:00 +0200 Message-Id: <20210412082901.652736-3-kda@semihalf.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210412082901.652736-1-kda@semihalf.com> References: <20210412082901.652736-1-kda@semihalf.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 2/3] stack: add lock-free support indication X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" Currently it is impossible to detect programatically whether lock-free implementation of rte_stack is supported. One could check whether the header guard for lock-free stubs is defined (_RTE_STACK_LF_STUBS_H_) but that's an unstable implementation detail. Because of that currently all lock-free ring creations silently succeed (as long as the stack header is 16B long) which later leads to push and pop operations being NOPs. The observable effect is that stack_lf_autotest fails on platforms not supporting the lock-free. Instead it should just skip the lock-free test altogether. This commit adds a new errno value (ENOTSUP) that may be returned by rte_stack_create() to indicate that a given combination of flags is not supported on a current platform. This is detected by checking a compile-time flag in the include logic in rte_stack_lf.h which may be used by applications to check the lock-free support at compile time. Signed-off-by: Stanislaw Kardach Fixes: 7911ba0473e0 ("stack: enable lock-free implementation for aarch64") Cc: phil.yang@arm.com Cc: stable@dpdk.org Acked-by: Olivier Matz --- doc/guides/rel_notes/release_21_05.rst | 4 ++++ lib/librte_stack/rte_stack.c | 4 +++- lib/librte_stack/rte_stack.h | 1 + lib/librte_stack/rte_stack_lf.h | 5 +++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst index 6f5858c8f..42ed60da8 100644 --- a/doc/guides/rel_notes/release_21_05.rst +++ b/doc/guides/rel_notes/release_21_05.rst @@ -166,6 +166,10 @@ API Changes * pci: The value ``PCI_ANY_ID`` is marked as deprecated and can be replaced with ``RTE_PCI_ANY_ID``. +* Lock-free ``rte_stack`` no longer silently ignores push and pop when it's not + supported on the current platform. Instead ``rte_stack_create()`` fails and + ``rte_errno`` is set to ``ENOTSUP``. + ABI Changes ----------- diff --git a/lib/librte_stack/rte_stack.c b/lib/librte_stack/rte_stack.c index 8a51fba17..10d3b2eeb 100644 --- a/lib/librte_stack/rte_stack.c +++ b/lib/librte_stack/rte_stack.c @@ -64,9 +64,11 @@ rte_stack_create(const char *name, unsigned int count, int socket_id, #ifdef RTE_ARCH_64 RTE_BUILD_BUG_ON(sizeof(struct rte_stack_lf_head) != 16); -#else +#endif +#if !defined(RTE_STACK_LF_SUPPORTED) if (flags & RTE_STACK_F_LF) { STACK_LOG_ERR("Lock-free stack is not supported on your platform\n"); + rte_errno = ENOTSUP; return NULL; } #endif diff --git a/lib/librte_stack/rte_stack.h b/lib/librte_stack/rte_stack.h index b82c74e72..27640f87b 100644 --- a/lib/librte_stack/rte_stack.h +++ b/lib/librte_stack/rte_stack.h @@ -205,6 +205,7 @@ rte_stack_free_count(struct rte_stack *s) * - EEXIST - a stack with the same name already exists * - ENOMEM - insufficient memory to create the stack * - ENAMETOOLONG - name size exceeds RTE_STACK_NAMESIZE + * - ENOTSUP - platform does not support given flags combination. */ struct rte_stack * rte_stack_create(const char *name, unsigned int count, int socket_id, diff --git a/lib/librte_stack/rte_stack_lf.h b/lib/librte_stack/rte_stack_lf.h index eb106e64e..f2b012cd0 100644 --- a/lib/librte_stack/rte_stack_lf.h +++ b/lib/librte_stack/rte_stack_lf.h @@ -13,6 +13,11 @@ #else #include "rte_stack_lf_generic.h" #endif + +/** + * Indicates that RTE_STACK_F_LF is supported. + */ +#define RTE_STACK_LF_SUPPORTED #endif /** From patchwork Mon Apr 12 08:29:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanislaw Kardach X-Patchwork-Id: 91103 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5DF24A0C44; Mon, 12 Apr 2021 10:29:48 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C7C80140FCB; Mon, 12 Apr 2021 10:29:34 +0200 (CEST) Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) by mails.dpdk.org (Postfix) with ESMTP id 45B2B4068E for ; Mon, 12 Apr 2021 10:29:31 +0200 (CEST) Received: by mail-lf1-f41.google.com with SMTP id x13so9878853lfr.2 for ; Mon, 12 Apr 2021 01:29:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=t/LKaw7ZprrV6RprHoR1PQbQcTZerd28mzYHOegWeAI=; b=w0KYhLC8ePuyZMCahtiFrCWnmZjnXO1aCCWNWf65vKyzVnNHzjdh0OjrTRlTXhLn8V 5vIfKGd87rHwFUNM8/b4lyEI3jkTkmarkSIb21VgmWVtr2l2Y+EJKgG7VzdQjT+W0FyK 9Ln/F4fv90CqTrh3Nyt1WuBCL0FluESMX5lAUuk+bseySy50ZEsehCehwnwV/FCwLHSH e7237JTl/42uInzRekx1gIQ1a40eELxMwhqdlMBvAlwtcEh+O5lrR27AbqENHKBI1A1K Qc/N75nEl2LaKteOohZjIp9eryUnY9H+sg8jj1EbX1T0UsihtLU4VCsP2kUITAU/yDlz EOJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=t/LKaw7ZprrV6RprHoR1PQbQcTZerd28mzYHOegWeAI=; b=Bm+3+10gPjj8Z3nAaRgfT0y1yeQYEbtVzQ36q4Isoac+aFBwfqupzw08gGRi6HHr2k K75/mub1FJ7dhEue9Ujg+WtpZPOnrkHvJmiLr1yRdvQKO9mSTMt4zJyOOk7AWEREU6/3 87qLFadP/tw3bvIK4GrqHS5xElV+mD9Nln4sX/2wcXdZ2kxpxARWvV4386jyfoxtUiuV A9h9cNNQq5ZFzndsnmctudF0LflpgfGx6f0EdvdBDbUyL6UOJuHvEoZ1onT1x3HM43LZ RC+gY8ioSGi/sDEIdxcA3yiLLiwFa5p6uLL7nPTKq2eAhY867UiInS33kgX0RPuMg7YX psww== X-Gm-Message-State: AOAM531UMixQAt95FKa/5ETs/ct329agxtzPVCTfqtht0pJngvrX+NRR PYPQ4mCY7RLvDcq3+rv6Zo/elQ== X-Google-Smtp-Source: ABdhPJzezmmY/qdSe+fH0nUzHcHH1LUvR6UBQ8MYnTE6qAlOD/AtsbqVazG0xoriKIcls1vi1ErHog== X-Received: by 2002:a05:6512:3d04:: with SMTP id d4mr18436704lfv.102.1618216170832; Mon, 12 Apr 2021 01:29:30 -0700 (PDT) Received: from toster.semihalf.com (host-193.106.246.139.static.3s.pl. [193.106.246.139]) by smtp.gmail.com with ESMTPSA id x4sm2691118ljd.112.2021.04.12.01.29.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Apr 2021 01:29:30 -0700 (PDT) From: Stanislaw Kardach To: Olivier Matz Cc: dev@dpdk.org, Stanislaw Kardach , stable@dpdk.org Date: Mon, 12 Apr 2021 10:29:01 +0200 Message-Id: <20210412082901.652736-4-kda@semihalf.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210412082901.652736-1-kda@semihalf.com> References: <20210412082901.652736-1-kda@semihalf.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 3/3] test: run lock-free stack tests when supported X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" Use the recently added RTE_STACK_LF_SUPPORTED flag to disable the lock-free stack tests at the compile time. Perf test doesn't fail because rte_ring_create() succeeds, however marking this test as skipped gives a better indication of what actually was tested. Signed-off-by: Stanislaw Kardach Cc: stable@dpdk.org Acked-by: Olivier Matz --- app/test/test_stack.c | 4 ++++ app/test/test_stack_perf.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/app/test/test_stack.c b/app/test/test_stack.c index 02422a32d..00efb38e2 100644 --- a/app/test/test_stack.c +++ b/app/test/test_stack.c @@ -373,7 +373,11 @@ test_stack(void) static int test_lf_stack(void) { +#if defined(RTE_STACK_LF_SUPPORTED) return __test_stack(RTE_STACK_F_LF); +#else + return TEST_SKIPPED; +#endif } REGISTER_TEST_COMMAND(stack_autotest, test_stack); diff --git a/app/test/test_stack_perf.c b/app/test/test_stack_perf.c index 3590625c4..4ee40d5d1 100644 --- a/app/test/test_stack_perf.c +++ b/app/test/test_stack_perf.c @@ -349,7 +349,11 @@ test_stack_perf(void) static int test_lf_stack_perf(void) { +#if defined(RTE_STACK_LF_SUPPORTED) return __test_stack_perf(RTE_STACK_F_LF); +#else + return TEST_SKIPPED; +#endif } REGISTER_TEST_COMMAND(stack_perf_autotest, test_stack_perf);