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 E7DBD45B82 for ; Wed, 30 Oct 2024 21:32:49 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DD7404335B; Wed, 30 Oct 2024 21:32:49 +0100 (CET) Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by mails.dpdk.org (Postfix) with ESMTP id B5F524332C; Wed, 30 Oct 2024 21:32:47 +0100 (CET) Received: from mail.maildlp.com (unknown [172.18.186.231]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4XdzL76Vv6z6K5mS; Thu, 31 Oct 2024 04:31:27 +0800 (CST) Received: from frapeml500007.china.huawei.com (unknown [7.182.85.172]) by mail.maildlp.com (Postfix) with ESMTPS id ECCAE140B38; Thu, 31 Oct 2024 04:32:46 +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; Wed, 30 Oct 2024 21:32:46 +0100 From: Konstantin Ananyev To: CC: , , , , , , , , , Subject: [PATCH v7 1/7] test/ring: fix failure with custom number of lcores Date: Wed, 30 Oct 2024 17:22:58 -0400 Message-ID: <20241030212304.104180-2-konstantin.ananyev@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20241030212304.104180-1-konstantin.ananyev@huawei.com> References: <20241021174745.1843-1-konstantin.ananyev@huawei.com> <20241030212304.104180-1-konstantin.ananyev@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.220.239.45] 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 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