patch 'fbarray: fix incorrect lookahead behavior' has been queued to stable release 21.11.8

Kevin Traynor ktraynor at redhat.com
Fri Aug 23 18:18:18 CEST 2024


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 <anatoly.burakov at intel.com>
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 <vipinp at vmware.com>
Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
---
 .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.mc.li at gmail.com>
 Vincent S. Cojot <vcojot at redhat.com>
 Vinh Tran <vinh.t.tran10 at gmail.com>
+Vipin Padmam Ramesh <vipinp at vmware.com>
 Vipin Varghese <vipin.varghese at amd.com> <vipin.varghese at intel.com>
 Vipul Ashri <vipul.ashri at oracle.com>
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(&param.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 at dpdk.org
@@ -31 +32 @@
-index 74739ec9be..085e5f0004 100644
+index 82e0e35a7d..8b2d737827 100644
@@ -34 +35 @@
-@@ -1535,4 +1535,5 @@ Vincent Li <vincent.mc.li at gmail.com>
+@@ -1449,4 +1449,5 @@ Vincent Li <vincent.mc.li at gmail.com>
@@ -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,



More information about the stable mailing list