From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 67C49A0C3F for ; Sat, 12 Jun 2021 01:05:08 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 32EBC4003F; Sat, 12 Jun 2021 01:05:08 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2088.outbound.protection.outlook.com [40.107.244.88]) by mails.dpdk.org (Postfix) with ESMTP id AE02F4003F for ; Sat, 12 Jun 2021 01:05:06 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SJ8b1wlk3N91k8Ej5BzYfNVgbd3/YDSzLMZweKWHB0H2ZO2NVYhyeVVbhDIYfsK2YgSBB7jQ2uPceGn5cualUdkyJJxYmUVczIew99LVBi3E8iGxtxcpUxozcEkyiiQGrN4bb9YEd9z0DtHFbkjrpBE10H1rmAKbjbL8ovPj3Zj/BEbD/9I/fGKiHLF0lMMJkYGc+zhq2E0BVqQCOQNJURIrdiRcs8lKJsghjncGYITc1NvmeXm31HXCnkmlCQHH9rjIlnORMaTrSxOg2ZCUSqTJm9b6Hw8xugcdDJL08FleGNgFREOQ1rsSoH1yBYKhjbLzvlStzSo0sg3JrR6Czw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AxLdCo7cXIUzShnCZnxT5B59lU07zlggEurDKTSlXko=; b=VY8/UzleR1/wQSTC2fxLbIy/3Swjrk9/wh/wHmQrx7N0uDbyoCaVgixmNlD3w5IOVextjxEKllDr9Rz709cZu7zbSPCsAzk4d+A6abmMQpP2ubvyCzLyiB6LnkS1mqfltktcSzKAsBCDBJGKzXtQMuTHzubQ6+d9KKro+lUBHIfz+BgG58grOv2mBOvQxCVSwDzRcpQS2tIG60dP64gYoeSx2acFfuHrFL5hThqm6h7KxV9cEp428zhKnimgz7HniUR+vfyGtuksDScFULouXZTCA1H0dGuf08wzAhkEHp2sUhexrIKFB6WKIZFfM4tICk5QSz8AIYAonsza+dkOVw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=6wind.com smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AxLdCo7cXIUzShnCZnxT5B59lU07zlggEurDKTSlXko=; b=KWbh0G9fidhdfAynCpnPylIXufyeDD1ANYInVjYC+GKoTV6rNGULnUiY/dLpICTXY6xg8CAN+nZJe2P5+c7AUz6ieoJ9Jwk2bn9GiLqeB+3Z1KTov9owv+l/1uB7DhOiIqnqJr3OCnTluxy2fN6ayyYTONBAnuynB/Z8znWg3priXO742cAbi7q0oFKAQkm2J9IOCZxCaKCWkDR8daZaPJiQFWmEyUB8Op+TbueSJHJShLOOYf6/6Vd5SnDsAs4xna+F+y+o02/3IGrRdDw7aGbwanFfkfSC9Zuk5g0/dt1ri3KTyG36jcbfuLuBpCC0JY39GzlGGg7rCtsRca7BgQ== Received: from MW4PR03CA0337.namprd03.prod.outlook.com (2603:10b6:303:dc::12) by DM5PR12MB4678.namprd12.prod.outlook.com (2603:10b6:4:a9::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.24; Fri, 11 Jun 2021 23:05:04 +0000 Received: from CO1NAM11FT056.eop-nam11.prod.protection.outlook.com (2603:10b6:303:dc:cafe::2c) by MW4PR03CA0337.outlook.office365.com (2603:10b6:303:dc::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.21 via Frontend Transport; Fri, 11 Jun 2021 23:05:04 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; 6wind.com; dkim=none (message not signed) header.d=none;6wind.com; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by CO1NAM11FT056.mail.protection.outlook.com (10.13.175.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4219.21 via Frontend Transport; Fri, 11 Jun 2021 23:05:04 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 11 Jun 2021 23:05:01 +0000 From: Xueming Li To: Stanislaw Kardach CC: Luca Boccassi , Olivier Matz , dpdk stable Date: Sat, 12 Jun 2021 07:01:35 +0800 Message-ID: <20210611230433.8208-1-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210510160258.30982-229-xuemingl@nvidia.com> References: <20210510160258.30982-229-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3c2d877e-9313-45f2-acb8-08d92d2d5921 X-MS-TrafficTypeDiagnostic: DM5PR12MB4678: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VQBLPeKz7P+DKqzH9rltFCI4G9+PwWy8lFwlgx73tgVKhPPzdRwEWHROuHUOWFF2v65trQUM6WupO1IyVYuYA86F0cFLH0xjxpiHzFMWReUnbRwkXZNlvfPMAo8a7UIgp7x4VROM4xA6yZvcyyxX5Jjc1/sekmwsvzyv4Gp04N+c8o+DNGsRlxbRT0XHOkJ1DohO3yhFxbPv1AOd1Lc5mEBjr8S2LyVlZVJo+5cj86uJd/KqfS2GSq30C2n652fIqMgsiqXqoQcnQxVdaz3S52dCegMzmJB9BzBx4yJfCRP7OBonuA8ljAF3Ue3MD9i//aHQdfNpuwO3sb+CWg3rf8ysvfZ6iQTPYur5XB57phNmlgCiYLOLmZXZuCylghaW+ZQG8OLXReg9qL/+dEPSc+ahMdMsYf+JciFSsdYqKNX9gz2Df+XY6tY5dcVst6o/3P6MK33qc0TIP8IeCnsC3AC8tqUjlOBWzzqvuQN21VivPbTZoaFSNvsM94X7DaabUsmlpvT0BBpHwl4V5+e1QfEmEgr2UbnBni/XST7eF9Ss1l5gg97sfnT6JrMcVxDVQRE+60hrJOQidTwR+XcSYPyndW6GZMgBm1XvBlS5Xwp8n+HerBGsvr1v8aPepO38XCWpuUyUe7gRE0CbqGWMS77gAg3qZQhvIvIIh3o/cGuEETSJFhHEbCpT0kdnCiGO5b6U0A/yTzvCFcU215fxnzSJ8I+c1wHXXjPKK800N3MxfzmEoSj3RfYdVSkZqriGoTiQD4euFbgPr1x74T1V84cvnuhPIcB8L+QeTIHKjeznk+BfELULO9A/MxKkcmv3 X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(376002)(39860400002)(346002)(136003)(396003)(36840700001)(46966006)(6286002)(53546011)(36756003)(8676002)(54906003)(83380400001)(6916009)(36860700001)(2616005)(47076005)(82310400003)(36906005)(8936002)(55016002)(26005)(356005)(186003)(426003)(5660300002)(16526019)(1076003)(7696005)(2906002)(478600001)(966005)(6666004)(70586007)(70206006)(316002)(86362001)(336012)(4326008)(7636003)(82740400003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jun 2021 23:05:04.0743 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3c2d877e-9313-45f2-acb8-08d92d2d5921 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT056.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB4678 Subject: [dpdk-stable] patch 'stack: allow lock-free only on relevant architectures' has been queued to stable release 20.11.2 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 20.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 06/14/21. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/steevenlee/dpdk This queued commit can be viewed at: https://github.com/steevenlee/dpdk/commit/cf948fe9c5295623a363453b48af3bb493fb77ba Thanks. Xueming Li --- >From cf948fe9c5295623a363453b48af3bb493fb77ba Mon Sep 17 00:00:00 2001 From: Stanislaw Kardach Date: Mon, 12 Apr 2021 10:28:59 +0200 Subject: [PATCH] stack: allow lock-free only on relevant architectures Cc: Luca Boccassi [ upstream commit 1abb185d6cd41f83cd91eb6b1816c31e4bce887a ] Since commit 7911ba0473e0 ("stack: enable lock-free implementation for aarch64"), lock-free stack is supported on arm64 but this description was missing from the doxygen for the flag. Currently it is impossible to detect programmatically 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. Use the 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. Fixes: 7911ba0473e0 ("stack: enable lock-free implementation for aarch64") Signed-off-by: Stanislaw Kardach Acked-by: Olivier Matz --- app/test/test_stack.c | 4 ++++ app/test/test_stack_perf.c | 4 ++++ lib/librte_stack/rte_stack.c | 4 +++- lib/librte_stack/rte_stack.h | 3 ++- lib/librte_stack/rte_stack_lf.h | 5 +++++ 5 files changed, 18 insertions(+), 2 deletions(-) diff --git a/app/test/test_stack.c b/app/test/test_stack.c index 02422a32d6..00efb38e2a 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 3590625c49..4ee40d5d19 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); diff --git a/lib/librte_stack/rte_stack.c b/lib/librte_stack/rte_stack.c index 8a51fba17f..10d3b2eeb3 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 395b9ef835..27640f87b2 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 @@ -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 eb106e64e6..f2b012cd0e 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 /** -- 2.25.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-06-12 06:53:56.746179000 +0800 +++ 0001-stack-allow-lock-free-only-on-relevant-architectures.patch 2021-06-12 06:53:56.000000000 +0800 @@ -1 +1 @@ -From 1abb185d6cd41f83cd91eb6b1816c31e4bce887a Mon Sep 17 00:00:00 2001 +From cf948fe9c5295623a363453b48af3bb493fb77ba Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Luca Boccassi + +[ upstream commit 1abb185d6cd41f83cd91eb6b1816c31e4bce887a ] @@ -38,7 +41,6 @@ - app/test/test_stack.c | 4 ++++ - app/test/test_stack_perf.c | 4 ++++ - doc/guides/rel_notes/release_21_05.rst | 4 ++++ - lib/stack/rte_stack.c | 4 +++- - lib/stack/rte_stack.h | 3 ++- - lib/stack/rte_stack_lf.h | 5 +++++ - 6 files changed, 22 insertions(+), 2 deletions(-) + app/test/test_stack.c | 4 ++++ + app/test/test_stack_perf.c | 4 ++++ + lib/librte_stack/rte_stack.c | 4 +++- + lib/librte_stack/rte_stack.h | 3 ++- + lib/librte_stack/rte_stack_lf.h | 5 +++++ + 5 files changed, 18 insertions(+), 2 deletions(-) @@ -78,16 +80 @@ -diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst -index b3224dc332..cd33898c55 100644 ---- a/doc/guides/rel_notes/release_21_05.rst -+++ b/doc/guides/rel_notes/release_21_05.rst -@@ -329,6 +329,10 @@ API Changes - ``policer_action_recolor_supported`` and ``policer_action_drop_supported`` - have been removed. - -+* stack: 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/stack/rte_stack.c b/lib/stack/rte_stack.c +diff --git a/lib/librte_stack/rte_stack.c b/lib/librte_stack/rte_stack.c @@ -95,2 +82,2 @@ ---- a/lib/stack/rte_stack.c -+++ b/lib/stack/rte_stack.c +--- a/lib/librte_stack/rte_stack.c ++++ b/lib/librte_stack/rte_stack.c @@ -110 +97 @@ -diff --git a/lib/stack/rte_stack.h b/lib/stack/rte_stack.h +diff --git a/lib/librte_stack/rte_stack.h b/lib/librte_stack/rte_stack.h @@ -112,2 +99,2 @@ ---- a/lib/stack/rte_stack.h -+++ b/lib/stack/rte_stack.h +--- a/lib/librte_stack/rte_stack.h ++++ b/lib/librte_stack/rte_stack.h @@ -131 +118 @@ -diff --git a/lib/stack/rte_stack_lf.h b/lib/stack/rte_stack_lf.h +diff --git a/lib/librte_stack/rte_stack_lf.h b/lib/librte_stack/rte_stack_lf.h @@ -133,2 +120,2 @@ ---- a/lib/stack/rte_stack_lf.h -+++ b/lib/stack/rte_stack_lf.h +--- a/lib/librte_stack/rte_stack_lf.h ++++ b/lib/librte_stack/rte_stack_lf.h