[v3,1/3] test/rcu: fix the compiling error for armv8.2

Message ID 1573450911-24317-2-git-send-email-gavin.hu@arm.com (mailing list archive)
State Rejected, archived
Delegated to: Thomas Monjalon
Headers
Series add arm N1SDP and A76 configurations |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-compilation success Compile Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK

Commit Message

Gavin Hu Nov. 11, 2019, 5:41 a.m. UTC
  With "-march=armv8.2-a" specified, a compiling error generated:
app/test/test_rcu_qsbr.c:234:10: error: comparison of integer
expressions of different signedness: ‘unsigned int’ and ‘int’
[-Werror=sign-compare]

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>
---
 app/test/test_rcu_qsbr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Thomas Monjalon Nov. 20, 2019, 10:18 p.m. UTC | #1
11/11/2019 06:41, Gavin Hu:
> With "-march=armv8.2-a" specified, a compiling error generated:
> app/test/test_rcu_qsbr.c:234:10: error: comparison of integer
> expressions of different signedness: ‘unsigned int’ and ‘int’
> [-Werror=sign-compare]
> 
> 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>
> ---
> --- a/app/test/test_rcu_qsbr.c
> +++ b/app/test/test_rcu_qsbr.c
>  			/* Skip one update */
> -			if (i == (RTE_MAX_LCORE - 10))
> +			if (i == (unsigned int)(RTE_MAX_LCORE - 10))

For N1 SDP, RTE_MAX_LCORE = 4.
So this test weird.
Why not using rand() to find a number between 0 and max ?

You are hiding a real failure with a forced type casting.

Please reviewers, explain why you think it is the right thing to do?
  
Gavin Hu Nov. 21, 2019, 11:23 a.m. UTC | #2
> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Thursday, November 21, 2019 6:19 AM
> To: Gavin Hu (Arm Technology China) <Gavin.Hu@arm.com>; Honnappa
> Nagarahalli <Honnappa.Nagarahalli@arm.com>; Steve Capper
> <Steve.Capper@arm.com>
> Cc: stable@dpdk.org; dev@dpdk.org; nd <nd@arm.com>;
> david.marchand@redhat.com
> Subject: Re: [dpdk-stable] [PATCH v3 1/3] test/rcu: fix the compiling error for
> armv8.2
> 
> 11/11/2019 06:41, Gavin Hu:
> > With "-march=armv8.2-a" specified, a compiling error generated:
> > app/test/test_rcu_qsbr.c:234:10: error: comparison of integer
> > expressions of different signedness: ‘unsigned int’ and ‘int’
> > [-Werror=sign-compare]
> >
> > 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>
> > ---
> > --- a/app/test/test_rcu_qsbr.c
> > +++ b/app/test/test_rcu_qsbr.c
> >  			/* Skip one update */
> > -			if (i == (RTE_MAX_LCORE - 10))
> > +			if (i == (unsigned int)(RTE_MAX_LCORE - 10))
> 
> For N1 SDP, RTE_MAX_LCORE = 4.
> So this test weird.
> Why not using rand() to find a number between 0 and max ?
> 
> You are hiding a real failure with a forced type casting.
> 
> Please reviewers, explain why you think it is the right thing to do?
> 
Thanks for pointing out this issue, will fix in next release.
  

Patch

diff --git a/app/test/test_rcu_qsbr.c b/app/test/test_rcu_qsbr.c
index 85d80e0..19229ac 100644
--- a/app/test/test_rcu_qsbr.c
+++ b/app/test/test_rcu_qsbr.c
@@ -230,7 +230,7 @@  test_rcu_qsbr_thread_unregister(void)
 		/* Update quiescent state counter */
 		for (i = 0; i < num_threads[j]; i++) {
 			/* Skip one update */
-			if (i == (RTE_MAX_LCORE - 10))
+			if (i == (unsigned int)(RTE_MAX_LCORE - 10))
 				continue;
 			rte_rcu_qsbr_quiescent(t[0],
 				(j == 2) ? (RTE_MAX_LCORE - 1) : i);