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 F13BF45B95 for ; Mon, 21 Oct 2024 19:48:23 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D980B40612; Mon, 21 Oct 2024 19:48:23 +0200 (CEST) Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by mails.dpdk.org (Postfix) with ESMTP id E3913402DA; Mon, 21 Oct 2024 19:48:20 +0200 (CEST) Received: from mail.maildlp.com (unknown [172.18.186.231]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4XXN2k5Yr3z6L761; Tue, 22 Oct 2024 01:43:42 +0800 (CST) Received: from frapeml500007.china.huawei.com (unknown [7.182.85.172]) by mail.maildlp.com (Postfix) with ESMTPS id 7EFDB1409EA; Tue, 22 Oct 2024 01:48:20 +0800 (CST) Received: from A2111108189.huawei.com (10.206.138.73) by frapeml500007.china.huawei.com (7.182.85.172) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 21 Oct 2024 19:48:19 +0200 From: Konstantin Ananyev To: CC: , , , , , , , , , Phanendra Vukkisala Subject: [PATCH v6 1/7] test/ring: fix failure with custom number of lcores Date: Mon, 21 Oct 2024 18:47:39 +0100 Message-ID: <20241021174745.1843-2-konstantin.ananyev@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241021174745.1843-1-konstantin.ananyev@huawei.com> References: <20241015130111.826-1-konstantin.v.ananyev@yandex.ru> <20241021174745.1843-1-konstantin.ananyev@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.206.138.73] X-ClientProxiedBy: frapeml100006.china.huawei.com (7.182.85.201) To frapeml500007.china.huawei.com (7.182.85.172) 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 ring_stress_autotest fails to initialize the ring when RTE_MAX_LCORE value is not a number of 2. There is a flaw in calculation required number of elements in the ring. Fix it by aligning number of elements to next power of 2. Fixes: bf28df24e915 ("test/ring: add contention stress test") Cc: stable@dpdk.org Reported-by: Phanendra Vukkisala Signed-off-by: Konstantin Ananyev --- app/test/test_ring_stress_impl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/test/test_ring_stress_impl.h b/app/test/test_ring_stress_impl.h index 8b0bfb11fe..ee5274aeef 100644 --- a/app/test/test_ring_stress_impl.h +++ b/app/test/test_ring_stress_impl.h @@ -297,7 +297,7 @@ mt1_init(struct rte_ring **rng, void **data, uint32_t num) *data = elm; /* alloc ring */ - nr = 2 * num; + nr = rte_align32pow2(2 * num); sz = rte_ring_get_memsize(nr); r = rte_zmalloc(NULL, sz, alignof(typeof(*r))); if (r == NULL) { -- 2.35.3