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 735C6457A1 for ; Mon, 12 Aug 2024 14:54:32 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 66ADD402C3; Mon, 12 Aug 2024 14:54:32 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2066.outbound.protection.outlook.com [40.107.243.66]) by mails.dpdk.org (Postfix) with ESMTP id 5D56C4029C for ; Mon, 12 Aug 2024 14:54:31 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=jv3V6kKulLonFveiq0iWCQpbT/DTvpdNv0V/tqZj2CFhrhW2Gw/0yL/JXceMM9v4+/z5OjLfYswXUzfTSPZNO2Hk3TyGHkD1NEJdtrXXjEVEBavk/+nJZZ8kzCulTQ4yXR3muSFxeXDKPtXuRou2LkVDUlTD51RNr6wiLb2jyZBHvGkDx3VQ2/YNT9ABuIOurhWC+HQT0w3MkAHODw8zVXhru6Gpx1U9DBTO2u3s/UWG1akUA8wqOVdd/9iBMLi6FrD78LTIQUKVgJpHCUYN+08JQvKXeZPEOnRnWJQwuy7GyDSyaFX/nan+uYD3chUu624Bzdk6VSqYIm0HH79j4A== 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=ZI0baA1q9yROfyFuVPF4qHlsnCE0Nd4SD03PbOHLm6Y=; b=ZRyAYLIq1wwyUpUtrRbyarb4u/bxC94a7h2ImDpm6EJzTKhyt1Jm4xglId+M9PQ0uAD4eobehYzAxjEampE2iFcLOFElbbl6rqE9UtKcfwNE2lCjgYVhb4kMJT56fYb6UPUN2eZm6v25rYVRV0vGJBypZKsfOHiHtz/o9vZEuk6gGiNnJU5IdimgE9t5jzZessL8/jscPnAWsorL40dnXn3wWwvWP03YCx7D8ZIDPknEQq1uVIG7DMMagFgFBbOnhrlm+3kfpX5IEBJU9T3DwWvy+tY6EsVuSTj6TeBjndbYZ81nwj5+JgxX6Yq9JEBXui5Pmg2ONqbuKLst5EwBWg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) 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=ZI0baA1q9yROfyFuVPF4qHlsnCE0Nd4SD03PbOHLm6Y=; b=RAEPK54virja5Ar+y7JLjkBuLa0naAu8fmiJRkeW84vvvWQLdnc5hjaokY07BC6b5IGJ29VqnX7onpCAvFXsVZVVzWV0OoLI6MezJYGW8v5xUUM74ksIsQWJfgrcsFF4bC0deoNVQzpN3eJcxC5OkQLgfkqFNsTLJqav+HqpW8W549kwM0AckLBfhj7trwP8OfxlNcSp0/DIW+uR0nhD2L1LVlXdLPU56jz3i6TZanbEVRUTnNkiSsyCthSmZd0WaFtgkpE7TRLVT7NxZP5A1evvu2YNy7k0Kxzg0GJP3ziaUR+wZJBCl6FEfagffTZ9T/jiRNPnPIJbOm9O3VZfWQ== Received: from DM6PR14CA0070.namprd14.prod.outlook.com (2603:10b6:5:18f::47) by SJ2PR12MB8876.namprd12.prod.outlook.com (2603:10b6:a03:539::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.22; Mon, 12 Aug 2024 12:54:27 +0000 Received: from DS1PEPF0001708F.namprd03.prod.outlook.com (2603:10b6:5:18f:cafe::38) by DM6PR14CA0070.outlook.office365.com (2603:10b6:5:18f::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.33 via Frontend Transport; Mon, 12 Aug 2024 12:54:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DS1PEPF0001708F.mail.protection.outlook.com (10.167.17.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.19 via Frontend Transport; Mon, 12 Aug 2024 12:54:26 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) 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:54:16 -0700 Received: from nvidia.com (10.126.230.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:54:14 -0700 From: Xueming Li To: Anatoly Burakov CC: , Vipin Padmam Ramesh , "dpdk stable" Subject: patch 'fbarray: fix incorrect lookbehind behavior' has been queued to stable release 23.11.2 Date: Mon, 12 Aug 2024 20:48:32 +0800 Message-ID: <20240812125035.389667-36-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.230.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: DS1PEPF0001708F:EE_|SJ2PR12MB8876:EE_ X-MS-Office365-Filtering-Correlation-Id: 31e70e5b-b478-40d6-9c82-08dcbacde5ed X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|36860700013|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?75LRQv6CTDj3v4gS7HvnB/P4zZcCc66Oehj9JlL3KVUrKHJ69yrB2gqGTAro?= =?us-ascii?Q?7RJK4mVlj9qeQUwCH8R8Aa43BgdMFHtg/IqBHpMtMy72ZVma/mUbk9Jp7i9r?= =?us-ascii?Q?PPQkvEGNQKRc7JoBUKiRY2/SjBhDEJh/QG3VE6WBmnapgQMO2IraklX5vo8s?= =?us-ascii?Q?ie6jhKbM8me+lKDpKse7Lkhud62Gi9FgwVlpfMaLfak+WsS3qeX7+xQ78JlB?= =?us-ascii?Q?UaD8yDM5+HgoCWhZeYfwcNim/Pdpc15NPSHsfE3eYBH+J6odyj4UoVT5ZM4k?= =?us-ascii?Q?9Kn2AHYQndTuZbQC4fe/0hKPBDBx7VY3ctITifMYxQ98SNrJQ+wY04ZxTfoH?= =?us-ascii?Q?EjSEDqnUpq3L8Crzey+W7E6ole2TsujAyANY4e8HkI8sv8fGmzllTsDrp12s?= =?us-ascii?Q?yCq+URQayuE8XOkVkVPxSHA21ci9OFqhvcmsvHmK9Uk8H+M80Aa8ngf55SSt?= =?us-ascii?Q?iwEIjk2lQRnfMSHsjFP0t3lfDf+PRzLNZOcXYVTMuaqcESemY2sdTfPf3+Pb?= =?us-ascii?Q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zWpfTn7wKIHU?= =?us-ascii?Q?SPoblZGBC09vRm9jax/dStREjJNfdpWB?= X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230040)(82310400026)(36860700013)(376014)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Aug 2024 12:54:26.6821 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 31e70e5b-b478-40d6-9c82-08dcbacde5ed 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.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF0001708F.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8876 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=24869bf93c44350879079bbd8c41d3d6b7bf5acc Thanks. Xueming Li --- >From 24869bf93c44350879079bbd8c41d3d6b7bf5acc Mon Sep 17 00:00:00 2001 From: Anatoly Burakov Date: Mon, 8 Jul 2024 17:07:33 +0100 Subject: [PATCH] fbarray: fix incorrect lookbehind behavior Cc: Xueming Li [ upstream commit 8e3712928716a1deb8857c971865aa15dc436b04 ] Currently, whenever first bit of current index mask is set (meaning, there is potentially a run starting at the start of the mask), lookbehind loop is entered. In that loop, if the last bit of lookbehind mask is not set, the lookbehind is stopped, and the current lookbehind mask index is assigned to current index mask. However, because at that point we are inside a while-loop that decrements current index mask after each iteration, this results in erroneous mask index decrement. Fix lookbehind to avoid erroneous decrement, and add corresponding unit test. Fixes: e1ca5dc86226 ("fbarray: add reverse finding of chunk") Signed-off-by: Vipin Padmam Ramesh Signed-off-by: Anatoly Burakov --- app/test/test_fbarray.c | 24 ++++++++++++++++++++++++ lib/eal/common/eal_common_fbarray.c | 3 ++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/app/test/test_fbarray.c b/app/test/test_fbarray.c index bf89b99e5b..147d6e2a07 100644 --- a/app/test/test_fbarray.c +++ b/app/test/test_fbarray.c @@ -111,6 +111,14 @@ static int lookahead_test_setup(void) return init_array(); } +static int lookbehind_test_setup(void) +{ + /* set index 63 as used */ + param.start = 63; + param.end = 63; + return init_array(); +} + static int test_invalid(void) { struct rte_fbarray dummy; @@ -732,6 +740,21 @@ static int test_lookahead(void) return TEST_SUCCESS; } +static int test_lookbehind(void) +{ + int ret, free_len = 2; + + /* run regular test first */ + ret = test_find(); + if (ret != TEST_SUCCESS) + return ret; + + /* test if we can find free chunk while crossing mask boundary */ + TEST_ASSERT_EQUAL(rte_fbarray_find_prev_n_free(¶m.arr, param.start + 1, free_len), + param.start - free_len, "Free chunk index is wrong\n"); + return TEST_SUCCESS; +} + static struct unit_test_suite fbarray_test_suite = { .suite_name = "fbarray autotest", .setup = autotest_setup, @@ -746,6 +769,7 @@ static struct unit_test_suite fbarray_test_suite = { 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_CASE_ST(lookbehind_test_setup, reset_array, test_lookbehind), TEST_CASES_END() } }; diff --git a/lib/eal/common/eal_common_fbarray.c b/lib/eal/common/eal_common_fbarray.c index 8a3e6fd290..6d9b95006c 100644 --- a/lib/eal/common/eal_common_fbarray.c +++ b/lib/eal/common/eal_common_fbarray.c @@ -512,7 +512,8 @@ find_prev_n(const struct rte_fbarray *arr, unsigned int start, unsigned int n, * as well, so skip that on next iteration. */ ignore_msk = UINT64_MAX << need; - msk_idx = lookbehind_idx; + /* outer loop will decrement msk_idx so add 1 */ + msk_idx = lookbehind_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.655940709 +0800 +++ 0035-fbarray-fix-incorrect-lookbehind-behavior.patch 2024-08-12 20:44:02.005069277 +0800 @@ -1 +1 @@ -From 8e3712928716a1deb8857c971865aa15dc436b04 Mon Sep 17 00:00:00 2001 +From 24869bf93c44350879079bbd8c41d3d6b7bf5acc Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 8e3712928716a1deb8857c971865aa15dc436b04 ] @@ -20 +22,0 @@ -Cc: stable@dpdk.org @@ -79 +81 @@ -index 2680b34823..b4f0b0b0c3 100644 +index 8a3e6fd290..6d9b95006c 100644