[1/2] test/rcu: increase the size of num cores variable

Message ID 20190628034406.5399-1-honnappa.nagarahalli@arm.com
State Superseded, archived
Delegated to: Thomas Monjalon
Headers show
Series
  • [1/2] test/rcu: increase the size of num cores variable
Related show

Checks

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

Commit Message

Honnappa Nagarahalli June 28, 2019, 3:44 a.m.
num_cores is of type uint8_t. This results in the following
compilation error.

test_rcu_qsbr_perf.c:649:16: error: comparison is always false
due to limited range of data type [-Werror=type-limits]
  if (num_cores >= RTE_MAX_LCORE) {
                ^~

RTE_MAX_LCORE is set to 256 for armv8 config.

Fixes: e6a14121f4ae ("test/rcu: remove arbitrary limit on max core count")
Cc: stable@dpdk.org

Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 app/test/test_rcu_qsbr.c      | 4 ++--
 app/test/test_rcu_qsbr_perf.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

David Marchand June 28, 2019, 9:09 a.m. | #1
On Fri, Jun 28, 2019 at 5:44 AM Honnappa Nagarahalli <
honnappa.nagarahalli@arm.com> wrote:

> num_cores is of type uint8_t. This results in the following
> compilation error.
>
> test_rcu_qsbr_perf.c:649:16: error: comparison is always false
> due to limited range of data type [-Werror=type-limits]
>   if (num_cores >= RTE_MAX_LCORE) {
>                 ^~
>
> RTE_MAX_LCORE is set to 256 for armv8 config.
>


Weird I did not see this error in travis.
Just tried again:
https://travis-ci.com/david-marchand/dpdk/jobs/211768426



> Fixes: e6a14121f4ae ("test/rcu: remove arbitrary limit on max core count")
> Cc: stable@dpdk.org
>
> Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> ---
>  app/test/test_rcu_qsbr.c      | 4 ++--
>  app/test/test_rcu_qsbr_perf.c | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/app/test/test_rcu_qsbr.c b/app/test/test_rcu_qsbr.c
> index 943a1e370..0c6267ee9 100644
> --- a/app/test/test_rcu_qsbr.c
> +++ b/app/test/test_rcu_qsbr.c
> @@ -27,7 +27,7 @@
>  #define TEST_RCU_QSBR_CNT_INIT 1
>
>  uint16_t enabled_core_ids[RTE_MAX_LCORE];
> -uint8_t num_cores;
> +uint16_t num_cores;
>

If we want to be closer to the eal API, those should be unsigned int.



>  static uint32_t *keys;
>  #define TOTAL_ENTRY (1024 * 8)
> @@ -891,7 +891,7 @@ static int
>  test_rcu_qsbr_mw_mv_mqs(void)
>  {
>         int i, j;
> -       uint8_t test_cores;
> +       uint16_t test_cores;
>
>         writer_done = 0;
>         test_cores = num_cores / 4;
> diff --git a/app/test/test_rcu_qsbr_perf.c b/app/test/test_rcu_qsbr_perf.c
> index 363365f46..b1a910423 100644
> --- a/app/test/test_rcu_qsbr_perf.c
> +++ b/app/test/test_rcu_qsbr_perf.c
> @@ -17,7 +17,7 @@
>
>  /* Check condition and return an error if true. */
>  static uint16_t enabled_core_ids[RTE_MAX_LCORE];
> -static uint8_t num_cores;
> +static uint16_t num_cores;
>
>  static uint32_t *keys;
>  #define TOTAL_ENTRY (1024 * 8)
> --
> 2.17.1
>
Thomas Monjalon June 28, 2019, 1:34 p.m. | #2
28/06/2019 11:09, David Marchand:
> On Fri, Jun 28, 2019 at 5:44 AM Honnappa Nagarahalli
> > --- a/app/test/test_rcu_qsbr.c
> > +++ b/app/test/test_rcu_qsbr.c
> > @@ -27,7 +27,7 @@
> >  #define TEST_RCU_QSBR_CNT_INIT 1
> >
> >  uint16_t enabled_core_ids[RTE_MAX_LCORE];
> > -uint8_t num_cores;
> > +uint16_t num_cores;
> 
> If we want to be closer to the eal API, those should be unsigned int.

I agree, please use unsigned int where relevant.
Honnappa Nagarahalli June 28, 2019, 4:38 p.m. | #3
> 
> 28/06/2019 11:09, David Marchand:
> > On Fri, Jun 28, 2019 at 5:44 AM Honnappa Nagarahalli
> > > --- a/app/test/test_rcu_qsbr.c
> > > +++ b/app/test/test_rcu_qsbr.c
> > > @@ -27,7 +27,7 @@
> > >  #define TEST_RCU_QSBR_CNT_INIT 1
> > >
> > >  uint16_t enabled_core_ids[RTE_MAX_LCORE]; -uint8_t num_cores;
> > > +uint16_t num_cores;
> >
> > If we want to be closer to the eal API, those should be unsigned int.
> 
> I agree, please use unsigned int where relevant.
Sent v2. There are other similar cases, may be in a follow up patch.

> 
>

Patch

diff --git a/app/test/test_rcu_qsbr.c b/app/test/test_rcu_qsbr.c
index 943a1e370..0c6267ee9 100644
--- a/app/test/test_rcu_qsbr.c
+++ b/app/test/test_rcu_qsbr.c
@@ -27,7 +27,7 @@ 
 #define TEST_RCU_QSBR_CNT_INIT 1
 
 uint16_t enabled_core_ids[RTE_MAX_LCORE];
-uint8_t num_cores;
+uint16_t num_cores;
 
 static uint32_t *keys;
 #define TOTAL_ENTRY (1024 * 8)
@@ -891,7 +891,7 @@  static int
 test_rcu_qsbr_mw_mv_mqs(void)
 {
 	int i, j;
-	uint8_t test_cores;
+	uint16_t test_cores;
 
 	writer_done = 0;
 	test_cores = num_cores / 4;
diff --git a/app/test/test_rcu_qsbr_perf.c b/app/test/test_rcu_qsbr_perf.c
index 363365f46..b1a910423 100644
--- a/app/test/test_rcu_qsbr_perf.c
+++ b/app/test/test_rcu_qsbr_perf.c
@@ -17,7 +17,7 @@ 
 
 /* Check condition and return an error if true. */
 static uint16_t enabled_core_ids[RTE_MAX_LCORE];
-static uint8_t num_cores;
+static uint16_t num_cores;
 
 static uint32_t *keys;
 #define TOTAL_ENTRY (1024 * 8)