From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 400D9A04C1 for ; Mon, 25 Nov 2019 04:36:58 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D2660CF3; Mon, 25 Nov 2019 04:36:57 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id C8944CF3; Mon, 25 Nov 2019 04:36:55 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 09102328; Sun, 24 Nov 2019 19:36:55 -0800 (PST) Received: from net-arm-thunderx2-01.test.ast.arm.com (net-arm-thunderx2-01.shanghai.arm.com [10.169.40.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 3C0D43F52E; Sun, 24 Nov 2019 19:36:53 -0800 (PST) From: Gavin Hu To: dev@dpdk.org Cc: nd@arm.com, thomas@monjalon.net, Honnappa.Nagarahalli@arm.com, dharmik.thakkar@arm.com, stable@dpdk.org Date: Mon, 25 Nov 2019 11:36:33 +0800 Message-Id: <1574652993-17755-1-git-send-email-gavin.hu@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1573450911-24317-2-git-send-email-gavin.hu@arm.com> References: <1573450911-24317-2-git-send-email-gavin.hu@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] [PATCH v4] test/rcu: fix build for small number of cores X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 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 Sender: "stable" If the RTE_MAX_LCORE is less than 10, a compilation error is generated: app/test/test_rcu_qsbr.c:234:10: error: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Werror=sign-compare] The cause is (RTE_MAX_LCORE - 10) results in a negative value. To fix, use rte_rand() to find a number between 0 and RTE_MAX_LCORE. Fixes: b87089b0bb19 ("test/rcu: add API and functional tests") Cc: stable@dpdk.org Signed-off-by: Gavin Hu Reviewed-by: Honnappa Nagarahalli Reviewed-by: Steve Capper Reviewed-by: Dharmik Thakkar --- v4: - separate from the N1SDP configuration patch series - fix the build for smaller number of cores(Thomas Monjalon) --- app/test/test_rcu_qsbr.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/test/test_rcu_qsbr.c b/app/test/test_rcu_qsbr.c index 85d80e0..b60dc50 100644 --- a/app/test/test_rcu_qsbr.c +++ b/app/test/test_rcu_qsbr.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include "test.h" @@ -168,6 +169,7 @@ test_rcu_qsbr_thread_unregister(void) { unsigned int num_threads[3] = {1, RTE_MAX_LCORE, 1}; unsigned int i, j; + unsigned int skip_thread_id; uint64_t token; int ret; @@ -227,10 +229,11 @@ test_rcu_qsbr_thread_unregister(void) token = rte_rcu_qsbr_start(t[0]); TEST_RCU_QSBR_RETURN_IF_ERROR( (token != (TEST_RCU_QSBR_CNT_INIT + 1)), "QSBR Start"); + skip_thread_id = rte_rand() % RTE_MAX_LCORE; /* Update quiescent state counter */ for (i = 0; i < num_threads[j]; i++) { /* Skip one update */ - if (i == (RTE_MAX_LCORE - 10)) + if ((j == 1) && (i == skip_thread_id)) continue; rte_rcu_qsbr_quiescent(t[0], (j == 2) ? (RTE_MAX_LCORE - 1) : i); @@ -242,7 +245,7 @@ test_rcu_qsbr_thread_unregister(void) TEST_RCU_QSBR_RETURN_IF_ERROR((ret == 0), "Non-blocking QSBR check"); /* Update the previously skipped thread */ - rte_rcu_qsbr_quiescent(t[0], RTE_MAX_LCORE - 10); + rte_rcu_qsbr_quiescent(t[0], skip_thread_id); } /* Validate the updates */ -- 2.7.4