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 850F945CA6 for ; Thu, 7 Nov 2024 18:34:26 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 58C8C43272; Thu, 7 Nov 2024 18:34:26 +0100 (CET) Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by mails.dpdk.org (Postfix) with ESMTP id 59A6D43270; Thu, 7 Nov 2024 18:34:23 +0100 (CET) Received: from mail.maildlp.com (unknown [172.18.186.231]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Xkpyq1pP4z6K5xw; Fri, 8 Nov 2024 01:31:31 +0800 (CST) Received: from frapeml500007.china.huawei.com (unknown [7.182.85.172]) by mail.maildlp.com (Postfix) with ESMTPS id 5349F1400CA; Fri, 8 Nov 2024 01:34:22 +0800 (CST) Received: from localhost.localdomain (10.220.239.45) 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; Thu, 7 Nov 2024 18:34:21 +0100 From: Konstantin Ananyev To: CC: , , , , , , , , , , Phanendra Vukkisala Subject: [PATCH v8 1/7] test/ring: fix failure with custom number of lcores Date: Thu, 7 Nov 2024 13:24:23 -0500 Message-ID: <20241107182429.60406-2-konstantin.ananyev@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20241107182429.60406-1-konstantin.ananyev@huawei.com> References: <20241030212304.104180-1-konstantin.ananyev@huawei.com> <20241107182429.60406-1-konstantin.ananyev@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.220.239.45] X-ClientProxiedBy: frapeml500006.china.huawei.com (7.182.85.219) 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 Acked-by: Morten Brørup Acked-by: Stephen Hemminger --- 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