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 343EC457A1 for ; Mon, 12 Aug 2024 14:54:14 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3004040674; Mon, 12 Aug 2024 14:54:14 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2059.outbound.protection.outlook.com [40.107.93.59]) by mails.dpdk.org (Postfix) with ESMTP id 793594029C for ; Mon, 12 Aug 2024 14:54:13 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QqswtZU6HApTOXFQbOMQPcwEljy2q92O/U4Qzur5z/YRgAol86uUi9ufFX269+PNI9VwgfUFQVrJ6sXkUEiN2l6OD3KIGmz+ihvM1VS3UlpwmfHpiDgrFl1K1dtRPY4ftuORyqEzHLH2TGTlTx1DjdcuQKvTmVwy/YT2HYthmrcPzrWuJo4NrlIO+7MwtMRTcCWZGJB+jkp8lVLtTS7Dd6AWIPXze2TJfzmW9ZhREWGcsI7vE+sXq48mXYiZl2/bLRN6DNCKimwD46mKOIx7Qcnl3hpUALq8h9vepSngcNNmKkV8PlH7WJhDg1rmzAIpO0JJPDTNDyXY73mKuUgShw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=smnA6MJJHEdYa/tefqY0OYxphVQ+sxyJtZDZACxWZS8=; b=vf2Fi8nCB6PgNQNhWIEWq+LmDi9F9YflSX+wCuha9mgxXcuftsHJEhARiDzwtRHT7v9YzW4v/zm/AjVdrlPcblz2SwcoVxqj45iOp5yHdxHxZva5rEodkhE/0NE7X+H1eHew1oi3gPVjDjwWL0NI6mQQpGOF/fjHjOtWq+evu9nyaBU2gloTFOOy19CvqKBVNMYtgFzo+SUatf3/gtcKlKqdCzjHciYrbHvQe4PfxnGoOS+4VwOKw7sIy8baqnTyDBRVm4oxiaHTEhx4eEyrt+Bw/exPEGqpuWzE/i6tnoFTNeNTPimE2/hOp/XVxcGo3gFLY+RZQRBWW8yC2Yb0ZQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=intel.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=smnA6MJJHEdYa/tefqY0OYxphVQ+sxyJtZDZACxWZS8=; b=s2/QEsv1hAwPFV0WEaK3Vt1v0ifFWSwErt2o6knC9A/XwBrpRu/LOimNQ9HRKXARO2BJgRYKrvCY/FbivgBGl3sei6avVARnPO6baRqplJvzUpAm11Pv70xlIpBZ3bENPhRbdMvEpN2l1pz/e9v6R++fZ4hM0NB4dmpUEGpkduMlP0JDBKYwU66139UgnU/t9SQrRSQTk1k5QtBSOn9Qwi7lAEkCx8kqaq4O4mKQ1aJpcSOvhNXVdH57xFI7yB/Wc+WnBZ3NQuhwuIdL8ODpjZZLJnWGhxzK8PfTYWddDIn0M0ipwiBCi3ihXqa+2f+3ZgGSEDElkWH3J2H+Wpwzwg== Received: from SN6PR04CA0077.namprd04.prod.outlook.com (2603:10b6:805:f2::18) by DS7PR12MB6264.namprd12.prod.outlook.com (2603:10b6:8:94::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.20; Mon, 12 Aug 2024 12:54:10 +0000 Received: from SA2PEPF00003F63.namprd04.prod.outlook.com (2603:10b6:805:f2:cafe::1f) by SN6PR04CA0077.outlook.office365.com (2603:10b6:805:f2::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.22 via Frontend Transport; Mon, 12 Aug 2024 12:54:10 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by SA2PEPF00003F63.mail.protection.outlook.com (10.167.248.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.8 via Frontend Transport; Mon, 12 Aug 2024 12:54:10 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 12 Aug 2024 05:53:56 -0700 Received: from nvidia.com (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 12 Aug 2024 05:53:55 -0700 From: Xueming Li To: Anatoly Burakov CC: , Vipin Padmam Ramesh , "dpdk stable" Subject: patch 'fbarray: fix incorrect lookahead behavior' has been queued to stable release 23.11.2 Date: Mon, 12 Aug 2024 20:48:31 +0800 Message-ID: <20240812125035.389667-35-xuemingl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240812125035.389667-1-xuemingl@nvidia.com> References: <20240712110153.309690-23-xuemingl@nvidia.com> <20240812125035.389667-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00003F63:EE_|DS7PR12MB6264:EE_ X-MS-Office365-Filtering-Correlation-Id: 22631b49-ccc3-4915-c74a-08dcbacddc17 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|376014|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?96Un7aq2hWO1a6tcui6MNSNgzI5TULr8mZlODIMKIJOzzbEJ5WvGAvrf1xF0?= =?us-ascii?Q?jSJymga+EotWiSyy2mhpyWHtB2zk93WWdoFRaUMjcRnCPVadyYHG/fi9184O?= =?us-ascii?Q?OcE1opLZFsHm1kpeJUQk3Lq20uptYKUCfdQNcR6/G5k0LPCR9CsI3l5QkNe/?= =?us-ascii?Q?t/N7uQmwEO0bHKMGGYvlg0D5MvVL/QRG6fBTuIGrFNubmDrShu3tGtg68/QK?= =?us-ascii?Q?5l4ldQrmTgbTlmivgJzKGrVqsTbtIXm4VreTiMKp3Qmb1XjtmoAf/1/yIJmV?= =?us-ascii?Q?FP1A40zkiVjrBIDhP70RFOl7qE9lc9tEbRM88KTwizrD6E6Abz9GOxcFHXGB?= =?us-ascii?Q?qvzxgE7suzzZHSJSNyjrn8kOjkvEuVjWqhf//8K2bA27qvMBh3T9VmH6rbq2?= =?us-ascii?Q?7LNMB4kUvKveFBh1LDRtPq17UYILopmB/6lRWDYvcAx8nMEqTJ4WzcSPKdyw?= =?us-ascii?Q?Xbe4efZm6TDwt+llinftjgGR3p2uNgBrQyLLzfSsHExEdQiWpZGPfuDuFgyM?= =?us-ascii?Q?+zY0afl7BpaC5Dw01a7PDhhURZlNz87A6mQhcDlej6ehXSQEByNS8ytIJohw?= =?us-ascii?Q?pfVtSbWFP7uljdfpUHnwY0CqGBEr9+k+fa17E3IGs/w0MB5T8jjCPOKaG4W4?= =?us-ascii?Q?Xe3Vsr+hgBeGZY162Krb2kspmVEJtMT08i8tvE3ersI0kghrYajqHFGAHrWn?= =?us-ascii?Q?BYkN93cI60SoklvQOaoEUekVUGqDrehwMGThrircFAbcJwW7rxGF+yeyu7UW?= =?us-ascii?Q?mJ5+V+Ev5BRc385SSuWWUOrQHYq0zoYLzFPPYWqCyqbALMJzJn28xWPy1Sfs?= =?us-ascii?Q?luQ0zagYYfArH3O5HlYI1YXhld1uvgyar/HmL0wYFuhIeMcDpQUGMwH2N5Dq?= =?us-ascii?Q?x9+re0xzHgNqxy8cl/6ba2JMt4umnmRmGmzxCYgNGklJ/YIEaznikMOR8WD1?= =?us-ascii?Q?AvSg3BZTUeFht6Qa9VjrUCsb2ohGNPIx1Z9AMAIU92CNBYU9rlY2SR08kqQm?= =?us-ascii?Q?Fqwd7Ix892H0Rw25oeweJTmtu7gs4BkcUyChi+YQlBR2BwuanSIACzeH65W/?= =?us-ascii?Q?UG9gfSediv0ifKm2rkNm+sUkf4FvkDrfradw7Dnsn6+mSLpjQbXpwrfIH12x?= =?us-ascii?Q?HrIZLNY6x7Ie9bjZmuEkWZAPgklUnG/em4zKafSsR70QSjoklLa5o55eHgGu?= =?us-ascii?Q?E0iMvTOPcuFA23JiHggtMt4PzapYzNMefITHvlCHI3CAI3ccfIw211VAW3Fk?= =?us-ascii?Q?1WSMd5mgYqeYzw1CsMHPTcssEiCSRG93kubQDLXfvUOrQmquA8f4h8dVSMvW?= =?us-ascii?Q?8buICiy/CJHQJkAYqV2CeA36AC1rBhOwZ9qdvE6Sk4qTXKsin2hRObQuIPZY?= =?us-ascii?Q?G7hVJxOk4fPZSxEtEWgm7cz4Xec9UhnJS9ya80w0JVgroxaQebRtsGpkQZuG?= =?us-ascii?Q?ddZB23FZqXkm1X4F1lolTdcCoc5x+ehi?= X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230040)(82310400026)(376014)(36860700013)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Aug 2024 12:54:10.1969 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 22631b49-ccc3-4915-c74a-08dcbacddc17 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00003F63.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6264 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 Hi, FYI, your patch has been queued to stable release 23.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 08/14/24. 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://git.dpdk.org/dpdk-stable/log/?h=23.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=5e665905758fffbfc8ca37bd8a7eba7cfa7867a8 Thanks. Xueming Li --- >From 5e665905758fffbfc8ca37bd8a7eba7cfa7867a8 Mon Sep 17 00:00:00 2001 From: Anatoly Burakov Date: Mon, 8 Jul 2024 17:07:32 +0100 Subject: [PATCH] fbarray: fix incorrect lookahead behavior Cc: Xueming Li [ upstream commit 8c03a149ce957b10d7792a2a78339496dd156e9f ] Currently, whenever last bit of current index mask is set (meaning, there is potentially a run starting at the end of the mask), lookahead loop is entered. In that loop, if the first bit of lookahead mask is not set, the lookahead is stopped, and the current lookahead mask index is assigned to current index mask. However, because at that point we are inside a for-loop that increments current index mask after each iteration, this results in erroneous mask index increment. Fix lookahead to avoid erroneous increment, and add corresponding unit test. Fixes: c44d09811b40 ("eal: add shared indexed file-backed array") Signed-off-by: Vipin Padmam Ramesh Signed-off-by: Anatoly Burakov --- .mailmap | 1 + app/test/test_fbarray.c | 23 +++++++++++++++++++++++ lib/eal/common/eal_common_fbarray.c | 3 ++- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/.mailmap b/.mailmap index 8e5ee34a2f..12ed3d1e74 100644 --- a/.mailmap +++ b/.mailmap @@ -1510,6 +1510,7 @@ Vincent Jardin Vincent Li Vincent S. Cojot Vinh Tran +Vipin Padmam Ramesh Vipin Varghese Vipul Ashri Visa Hankala diff --git a/app/test/test_fbarray.c b/app/test/test_fbarray.c index 26a51e2a3e..bf89b99e5b 100644 --- a/app/test/test_fbarray.c +++ b/app/test/test_fbarray.c @@ -103,6 +103,14 @@ static int empty_msk_test_setup(void) return 0; } +static int lookahead_test_setup(void) +{ + /* set index 64 as used */ + param.start = 64; + param.end = 64; + return init_array(); +} + static int test_invalid(void) { struct rte_fbarray dummy; @@ -709,6 +717,20 @@ static int test_empty(void) return TEST_SUCCESS; } +static int test_lookahead(void) +{ + int ret; + + /* run regular test first */ + ret = test_find(); + if (ret != TEST_SUCCESS) + return ret; + + /* test if we can find free chunk while not starting with 0 */ + TEST_ASSERT_EQUAL(rte_fbarray_find_next_n_free(¶m.arr, 1, param.start), + param.start + 1, "Free chunk index is wrong\n"); + return TEST_SUCCESS; +} static struct unit_test_suite fbarray_test_suite = { .suite_name = "fbarray autotest", @@ -723,6 +745,7 @@ static struct unit_test_suite fbarray_test_suite = { TEST_CASE_ST(last_msk_test_setup, reset_array, test_find), TEST_CASE_ST(full_msk_test_setup, reset_array, test_find), TEST_CASE_ST(empty_msk_test_setup, reset_array, test_empty), + TEST_CASE_ST(lookahead_test_setup, reset_array, test_lookahead), TEST_CASES_END() } }; diff --git a/lib/eal/common/eal_common_fbarray.c b/lib/eal/common/eal_common_fbarray.c index 2055bfa57d..8a3e6fd290 100644 --- a/lib/eal/common/eal_common_fbarray.c +++ b/lib/eal/common/eal_common_fbarray.c @@ -236,7 +236,8 @@ find_next_n(const struct rte_fbarray *arr, unsigned int start, unsigned int n, * as well, so skip that on next iteration. */ ignore_msk = ~((1ULL << need) - 1); - msk_idx = lookahead_idx; + /* outer loop will increment msk_idx so add 1 */ + msk_idx = lookahead_idx - 1; break; } -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-08-12 20:44:03.625983911 +0800 +++ 0034-fbarray-fix-incorrect-lookahead-behavior.patch 2024-08-12 20:44:02.005069277 +0800 @@ -1 +1 @@ -From 8c03a149ce957b10d7792a2a78339496dd156e9f Mon Sep 17 00:00:00 2001 +From 5e665905758fffbfc8ca37bd8a7eba7cfa7867a8 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 8c03a149ce957b10d7792a2a78339496dd156e9f ] @@ -20 +22,0 @@ -Cc: stable@dpdk.org @@ -31 +33 @@ -index 74739ec9be..085e5f0004 100644 +index 8e5ee34a2f..12ed3d1e74 100644 @@ -34 +36 @@ -@@ -1534,6 +1534,7 @@ Vincent Jardin +@@ -1510,6 +1510,7 @@ Vincent Jardin @@ -91 +93 @@ -index 0fe5bcfe06..2680b34823 100644 +index 2055bfa57d..8a3e6fd290 100644