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 B85A9455AD for ; Mon, 15 Jul 2024 17:28:35 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AEAB340A75; Mon, 15 Jul 2024 17:28:35 +0200 (CEST) Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) by mails.dpdk.org (Postfix) with ESMTP id 1314D402DD for ; Mon, 15 Jul 2024 17:28:34 +0200 (CEST) Received: by mail-lj1-f172.google.com with SMTP id 38308e7fff4ca-2eeb1ba040aso58435901fa.1 for ; Mon, 15 Jul 2024 08:28:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721057313; x=1721662113; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FbIColhR9z+35Agvwiw+9O+1e+Dltov60wCx/V7EmT4=; b=l13jW8ct7fzmNKMPdm6oOWHPkYQI95IXiNnq3HL7JaMwbSsHuGlOnTtot+I023zWlk zcXvFrXgH9YyvIMde13TkoE4Q0NM5GiMvP7KzJyHFnjH19LBvW6yQttZMx/prba6Awwp ZggLo9Ih87RzjaR7xP1Dmp11QfWSobpuuX/C717imtKmEQQED/egRlgiefemNMFO46UQ Dfgmvza+WAD6SBUmagnDHeBOyIX5u5+FTIwG5lTfhrMFbBfc2dydWwSPS9ORX+nOO+iv 17yKCH2rLKN8n5BuwONdf1w7GcsOxNdcCOQLK9PRvz6kDSHpLfs1zmT5CafJ7jyteEuj gP4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721057313; x=1721662113; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FbIColhR9z+35Agvwiw+9O+1e+Dltov60wCx/V7EmT4=; b=fwfDdzc5L1+xRpsARPuBdEumNHo7RYZQ0aY6/SPwp8IYVEdDA4Z+jW8V9c3ZuddMyR vw9XsfYAK/sL6bFDO5q1IUXzAKgED8g//NaT4BazGE0gpOat+egfUdhk1dhdkcAP/We4 +ewJvqoAuUMyEZyJdy7cOytqH+FJ9kbGAiZjwAkfNaJ7tDxnjDEPlyeH9E3Syd8t6dgU e8a0YYZ9dEp3vP5jiMwqZ/odQAZm8lUO95dx3JnlIlJdkLhKahfnXdy9J1KJnPIkIJP5 zGk6Z8ZvV9jdcgzTIghBoZW6SkuBrmqaoGBUlNmEVQFYrk7J6msSHYTsXbFLfQEG09i3 hG3Q== X-Forwarded-Encrypted: i=1; AJvYcCWcyJmdqYNQeziVBmY3RLy5TeuI3YTavjYyT3OKzyo45xK44yW37oQWD8hHa0ojCo/GNTkajE205dgXUUE3t38= X-Gm-Message-State: AOJu0YxBAXscOAY3bJHz/vj2OwbrhGuSxlPrnCt/FOaNo5Q1n753IkXR 2awmkBAAmeKxP2kMrIuOi2153lxENVKAJ1m4YGvDn8MwooN/sIXu X-Google-Smtp-Source: AGHT+IGZc58Ctkwx/Vs9tfjibHttrNghXc9UOAmCvBqLllFAGjOQI5uNfwTdMqcutRptPW/5ZuLIBQ== X-Received: by 2002:a2e:96cb:0:b0:2ec:5518:9550 with SMTP id 38308e7fff4ca-2eef2d6f1bamr1730461fa.10.1721057313474; Mon, 15 Jul 2024 08:28:33 -0700 (PDT) Received: from localhost ([137.220.120.171]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3680dabefa6sm6687583f8f.44.2024.07.15.08.28.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jul 2024 08:28:32 -0700 (PDT) From: luca.boccassi@gmail.com To: Anatoly Burakov Cc: Vipin Padmam Ramesh , dpdk stable Subject: patch 'fbarray: fix incorrect lookahead behavior' has been queued to stable release 22.11.6 Date: Mon, 15 Jul 2024 16:26:05 +0100 Message-Id: <20240715152704.2229503-27-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240715152704.2229503-1-luca.boccassi@gmail.com> References: <20240624235907.885628-81-luca.boccassi@gmail.com> <20240715152704.2229503-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 22.11.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 07/17/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/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/e67654ca812a801dbb5665b36aeeedc1665336ee Thanks. Luca Boccassi --- >From e67654ca812a801dbb5665b36aeeedc1665336ee 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 0798312a63..95826dac6c 100644 --- a/.mailmap +++ b/.mailmap @@ -1448,6 +1448,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 a691bf4458..fff44816a1 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 169e66e04b..842073ae1c 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.39.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-07-15 16:19:36.102188106 +0100 +++ 0027-fbarray-fix-incorrect-lookahead-behavior.patch 2024-07-15 16:19:34.520205439 +0100 @@ -1 +1 @@ -From 8c03a149ce957b10d7792a2a78339496dd156e9f Mon Sep 17 00:00:00 2001 +From e67654ca812a801dbb5665b36aeeedc1665336ee 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 0798312a63..95826dac6c 100644 @@ -34 +35 @@ -@@ -1534,6 +1534,7 @@ Vincent Jardin +@@ -1448,6 +1448,7 @@ Vincent Jardin @@ -43 +44 @@ -index 26a51e2a3e..bf89b99e5b 100644 +index a691bf4458..fff44816a1 100644 @@ -91 +92 @@ -index 0fe5bcfe06..2680b34823 100644 +index 169e66e04b..842073ae1c 100644