patches for DPDK stable branches
 help / color / Atom feed
From: Gavin Hu <gavin.hu@arm.com>
To: dev@dpdk.org
Cc: nd@arm.com, thomas@monjalon.net, Honnappa.Nagarahalli@arm.com,
	dharmik.thakkar@arm.com, stable@dpdk.org
Subject: [dpdk-stable] [PATCH v4] test/rcu: fix build for small number of cores
Date: Mon, 25 Nov 2019 11:36:33 +0800
Message-ID: <1574652993-17755-1-git-send-email-gavin.hu@arm.com> (raw)
In-Reply-To: <1573450911-24317-2-git-send-email-gavin.hu@arm.com>

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 <gavin.hu@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Steve Capper <steve.capper@arm.com>
Reviewed-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
---
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 <rte_hash_crc.h>
 #include <rte_malloc.h>
 #include <rte_cycles.h>
+#include <rte_random.h>
 #include <unistd.h>
 
 #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


  parent reply index

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1564616902-13861-1-git-send-email-gavin.hu@arm.com>
2019-07-31 23:32 ` [dpdk-stable] [PATCH 1/2] test/rcu: fix the compiling error for armv8.2 Gavin Hu
2019-07-31 23:48   ` [dpdk-stable] [PATCH v2 1/3] " Gavin Hu
2019-11-11  5:41   ` [dpdk-stable] [PATCH v3 " Gavin Hu
2019-11-20 22:18     ` Thomas Monjalon
2019-11-21 11:23       ` Gavin Hu (Arm Technology China)
2019-11-25  3:36     ` Gavin Hu [this message]
2019-11-25 22:40       ` [dpdk-stable] [PATCH v4] test/rcu: fix build for small number of cores Thomas Monjalon

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1574652993-17755-1-git-send-email-gavin.hu@arm.com \
    --to=gavin.hu@arm.com \
    --cc=Honnappa.Nagarahalli@arm.com \
    --cc=dev@dpdk.org \
    --cc=dharmik.thakkar@arm.com \
    --cc=nd@arm.com \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

patches for DPDK stable branches

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ http://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/ public-inbox