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 2017845CE9; Mon, 11 Nov 2024 14:29:02 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0418F4278D; Mon, 11 Nov 2024 14:29:02 +0100 (CET) Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by mails.dpdk.org (Postfix) with ESMTP id C640040E0C; Mon, 11 Nov 2024 14:29:00 +0100 (CET) Received: from mail.maildlp.com (unknown [172.18.186.216]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Xn9M005L3z6K5ll; Mon, 11 Nov 2024 21:27:08 +0800 (CST) Received: from frapeml500007.china.huawei.com (unknown [7.182.85.172]) by mail.maildlp.com (Postfix) with ESMTPS id 957FA140B67; Mon, 11 Nov 2024 21:28:59 +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; Mon, 11 Nov 2024 14:28:59 +0100 From: Konstantin Ananyev To: CC: , , , , , , , , , , Phanendra Vukkisala Subject: [PATCH v10 1/7] test/ring: fix failure with custom number of lcores Date: Mon, 11 Nov 2024 09:19:04 -0500 Message-ID: <20241111141910.40604-2-konstantin.ananyev@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20241111141910.40604-1-konstantin.ananyev@huawei.com> References: <20241111122535.6214-1-konstantin.ananyev@huawei.com> <20241111141910.40604-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: frapeml500005.china.huawei.com (7.182.85.13) To frapeml500007.china.huawei.com (7.182.85.172) X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-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