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 0B21F45804 for ; Fri, 23 Aug 2024 18:22:14 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 066B84338F; Fri, 23 Aug 2024 18:22:14 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id BA4494337B for ; Fri, 23 Aug 2024 18:22:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724430132; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EhkiiywMPM+ngp6K2BxCtM39vX6q9JWfy77fMZt3b+s=; b=FYWFGGutuQix49B5aRw9X6djccxUpCF4gdnSf+MCzTAqdJPoJ+UFHKCk96ejfRsCJJi272 GYFaWHjUZhJBIFKS1pkHAVkxo2l9VSd/IWUtbHembYvy7J+t2gOe/NhcAgQ0rPllrRbFOf Q07VW7ymW5OiFfStuoBhUBaSqg+lfoI= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-396-xNP7REzMM-aRFdFDZO1wIA-1; Fri, 23 Aug 2024 12:22:09 -0400 X-MC-Unique: xNP7REzMM-aRFdFDZO1wIA-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E181E1955D45; Fri, 23 Aug 2024 16:22:07 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.193.224]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5D3AF1955F44; Fri, 23 Aug 2024 16:22:06 +0000 (UTC) From: Kevin Traynor To: Anatoly Burakov Cc: Vipin Padmam Ramesh , dpdk stable Subject: patch 'fbarray: fix incorrect lookahead behavior' has been queued to stable release 21.11.8 Date: Fri, 23 Aug 2024 17:18:18 +0100 Message-ID: <20240823161929.1004778-70-ktraynor@redhat.com> In-Reply-To: <20240823161929.1004778-1-ktraynor@redhat.com> References: <20240823161929.1004778-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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 21.11.8 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/28/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://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/922deb0e231f10820b75bbb1eed3e74f25b8005b Thanks. Kevin --- >From 922deb0e231f10820b75bbb1eed3e74f25b8005b 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 [ 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 82e0e35a7d..8b2d737827 100644 --- a/.mailmap +++ b/.mailmap @@ -1449,4 +1449,5 @@ Vincent Li Vincent S. Cojot Vinh Tran +Vipin Padmam Ramesh Vipin Varghese Vipul Ashri diff --git a/app/test/test_fbarray.c b/app/test/test_fbarray.c index a691bf4458..fff44816a1 100644 --- a/app/test/test_fbarray.c +++ b/app/test/test_fbarray.c @@ -104,4 +104,12 @@ static int empty_msk_test_setup(void) } +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) { @@ -710,4 +718,18 @@ static int test_empty(void) } +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 = { @@ -724,4 +746,5 @@ 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_CASES_END() } diff --git a/lib/eal/common/eal_common_fbarray.c b/lib/eal/common/eal_common_fbarray.c index 5903474355..b59dd68d3e 100644 --- a/lib/eal/common/eal_common_fbarray.c +++ b/lib/eal/common/eal_common_fbarray.c @@ -240,5 +240,6 @@ find_next_n(const struct rte_fbarray *arr, unsigned int start, unsigned int n, */ 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.46.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-08-23 17:18:11.894956514 +0100 +++ 0070-fbarray-fix-incorrect-lookahead-behavior.patch 2024-08-23 17:18:09.749430207 +0100 @@ -1 +1 @@ -From 8c03a149ce957b10d7792a2a78339496dd156e9f Mon Sep 17 00:00:00 2001 +From 922deb0e231f10820b75bbb1eed3e74f25b8005b Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 8c03a149ce957b10d7792a2a78339496dd156e9f ] + @@ -20 +21,0 @@ -Cc: stable@dpdk.org @@ -31 +32 @@ -index 74739ec9be..085e5f0004 100644 +index 82e0e35a7d..8b2d737827 100644 @@ -34 +35 @@ -@@ -1535,4 +1535,5 @@ Vincent Li +@@ -1449,4 +1449,5 @@ Vincent Li @@ -41 +42 @@ -index 26a51e2a3e..bf89b99e5b 100644 +index a691bf4458..fff44816a1 100644 @@ -83 +84 @@ -index 0fe5bcfe06..2680b34823 100644 +index 5903474355..b59dd68d3e 100644 @@ -86 +87 @@ -@@ -237,5 +237,6 @@ find_next_n(const struct rte_fbarray *arr, unsigned int start, unsigned int n, +@@ -240,5 +240,6 @@ find_next_n(const struct rte_fbarray *arr, unsigned int start, unsigned int n,