* [dpdk-dev] [PATCH 1/2] test/rcu: fix array subscript is above array bounds
@ 2020-10-16 6:03 ` Honnappa Nagarahalli
2020-10-16 6:03 ` [dpdk-dev] [PATCH 2/2] examples/performance-thread: fix undef behavior Honnappa Nagarahalli
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Honnappa Nagarahalli @ 2020-10-16 6:03 UTC (permalink / raw)
To: dev, honnappa.nagarahalli, john.mcnamara
Cc: ruifeng.wang, juraj.linkes, david.marchand, nd, stable
When RTE_MAX_LCORE value is small, following compiler errors
are observed.
../app/test/test_rcu_qsbr.c:296:54: error: iteration 2 invokes
undefined behavior [-Werror=aggressive-loop-optimizations]
../app/test/test_rcu_qsbr.c:315:55: error: array subscript is above
array bounds [-Werror=array-bounds]
Fixes: b87089b0bb19 ("test/rcu: add API and functional tests")
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 | 56 +++++++++++++++++++++++-----------------
1 file changed, 33 insertions(+), 23 deletions(-)
diff --git a/app/test/test_rcu_qsbr.c b/app/test/test_rcu_qsbr.c
index 0a9e5ecd1..848a68092 100644
--- a/app/test/test_rcu_qsbr.c
+++ b/app/test/test_rcu_qsbr.c
@@ -286,13 +286,13 @@ static int
test_rcu_qsbr_start(void)
{
uint64_t token;
- int i;
+ unsigned int i;
printf("\nTest rte_rcu_qsbr_start()\n");
rte_rcu_qsbr_init(t[0], RTE_MAX_LCORE);
- for (i = 0; i < 3; i++)
+ for (i = 0; i < num_cores; i++)
rte_rcu_qsbr_thread_register(t[0], enabled_core_ids[i]);
token = rte_rcu_qsbr_start(t[0]);
@@ -306,14 +306,18 @@ test_rcu_qsbr_check_reader(void *arg)
{
struct rte_rcu_qsbr *temp;
uint8_t read_type = (uint8_t)((uintptr_t)arg);
+ unsigned int i;
temp = t[read_type];
/* Update quiescent state counter */
- rte_rcu_qsbr_quiescent(temp, enabled_core_ids[0]);
- rte_rcu_qsbr_quiescent(temp, enabled_core_ids[1]);
- rte_rcu_qsbr_thread_unregister(temp, enabled_core_ids[2]);
- rte_rcu_qsbr_quiescent(temp, enabled_core_ids[3]);
+ for (i = 0; i < num_cores; i++) {
+ if (i % 2 == 0)
+ rte_rcu_qsbr_quiescent(temp, enabled_core_ids[i]);
+ else
+ rte_rcu_qsbr_thread_unregister(temp,
+ enabled_core_ids[i]);
+ }
return 0;
}
@@ -324,7 +328,8 @@ test_rcu_qsbr_check_reader(void *arg)
static int
test_rcu_qsbr_check(void)
{
- int i, ret;
+ int ret;
+ unsigned int i;
uint64_t token;
printf("\nTest rte_rcu_qsbr_check()\n");
@@ -342,7 +347,7 @@ test_rcu_qsbr_check(void)
ret = rte_rcu_qsbr_check(t[0], token, true);
TEST_RCU_QSBR_RETURN_IF_ERROR((ret == 0), "Blocking QSBR check");
- for (i = 0; i < 3; i++)
+ for (i = 0; i < num_cores; i++)
rte_rcu_qsbr_thread_register(t[0], enabled_core_ids[i]);
ret = rte_rcu_qsbr_check(t[0], token, false);
@@ -357,7 +362,7 @@ test_rcu_qsbr_check(void)
/* Threads are offline, hence this should pass */
TEST_RCU_QSBR_RETURN_IF_ERROR((ret == 0), "Non-blocking QSBR check");
- for (i = 0; i < 3; i++)
+ for (i = 0; i < num_cores; i++)
rte_rcu_qsbr_thread_unregister(t[0], enabled_core_ids[i]);
ret = rte_rcu_qsbr_check(t[0], token, true);
@@ -365,7 +370,7 @@ test_rcu_qsbr_check(void)
rte_rcu_qsbr_init(t[0], RTE_MAX_LCORE);
- for (i = 0; i < 4; i++)
+ for (i = 0; i < num_cores; i++)
rte_rcu_qsbr_thread_register(t[0], enabled_core_ids[i]);
token = rte_rcu_qsbr_start(t[0]);
@@ -928,7 +933,7 @@ test_rcu_qsbr_dq_functional(int32_t size, int32_t esize, uint32_t flags)
static int
test_rcu_qsbr_dump(void)
{
- int i;
+ unsigned int i;
printf("\nTest rte_rcu_qsbr_dump()\n");
@@ -945,7 +950,7 @@ test_rcu_qsbr_dump(void)
rte_rcu_qsbr_thread_register(t[0], enabled_core_ids[0]);
- for (i = 1; i < 3; i++)
+ for (i = 1; i < num_cores; i++)
rte_rcu_qsbr_thread_register(t[1], enabled_core_ids[i]);
rte_rcu_qsbr_dump(stdout, t[0]);
@@ -1095,7 +1100,7 @@ test_rcu_qsbr_sw_sv_3qs(void)
{
uint64_t token[3];
uint32_t c;
- int i;
+ int i, num_readers;
int32_t pos[3];
writer_done = 0;
@@ -1118,7 +1123,11 @@ test_rcu_qsbr_sw_sv_3qs(void)
thread_info[0].ih = 0;
/* Reader threads are launched */
- for (i = 0; i < 4; i++)
+ /* Keep the number of reader threads low to reduce
+ * the execution time.
+ */
+ num_readers = num_cores < 4 ? num_cores : 4;
+ for (i = 0; i < num_readers; i++)
rte_eal_remote_launch(test_rcu_qsbr_reader, &thread_info[0],
enabled_core_ids[i]);
@@ -1151,7 +1160,7 @@ test_rcu_qsbr_sw_sv_3qs(void)
/* Check the quiescent state status */
rte_rcu_qsbr_check(t[0], token[0], true);
- for (i = 0; i < 4; i++) {
+ for (i = 0; i < num_readers; i++) {
c = hash_data[0][0][enabled_core_ids[i]];
if (c != COUNTER_VALUE && c != 0) {
printf("Reader lcore %d did not complete #0 = %d\n",
@@ -1169,7 +1178,7 @@ test_rcu_qsbr_sw_sv_3qs(void)
/* Check the quiescent state status */
rte_rcu_qsbr_check(t[0], token[1], true);
- for (i = 0; i < 4; i++) {
+ for (i = 0; i < num_readers; i++) {
c = hash_data[0][3][enabled_core_ids[i]];
if (c != COUNTER_VALUE && c != 0) {
printf("Reader lcore %d did not complete #3 = %d\n",
@@ -1187,7 +1196,7 @@ test_rcu_qsbr_sw_sv_3qs(void)
/* Check the quiescent state status */
rte_rcu_qsbr_check(t[0], token[2], true);
- for (i = 0; i < 4; i++) {
+ for (i = 0; i < num_readers; i++) {
c = hash_data[0][6][enabled_core_ids[i]];
if (c != COUNTER_VALUE && c != 0) {
printf("Reader lcore %d did not complete #6 = %d\n",
@@ -1206,7 +1215,7 @@ test_rcu_qsbr_sw_sv_3qs(void)
writer_done = 1;
/* Wait and check return value from reader threads */
- for (i = 0; i < 4; i++)
+ for (i = 0; i < num_readers; i++)
if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
goto error;
rte_hash_free(h[0]);
@@ -1236,6 +1245,12 @@ test_rcu_qsbr_mw_mv_mqs(void)
unsigned int i, j;
unsigned int test_cores;
+ if (RTE_MAX_LCORE < 5 || num_cores < 4) {
+ printf("Not enough cores for %s, expecting at least 5\n",
+ __func__);
+ return TEST_SKIPPED;
+ }
+
writer_done = 0;
test_cores = num_cores / 4;
test_cores = test_cores * 4;
@@ -1321,11 +1336,6 @@ test_rcu_qsbr_main(void)
{
uint16_t core_id;
- if (rte_lcore_count() < 5) {
- printf("Not enough cores for rcu_qsbr_autotest, expecting at least 5\n");
- return TEST_SKIPPED;
- }
-
num_cores = 0;
RTE_LCORE_FOREACH_SLAVE(core_id) {
enabled_core_ids[num_cores] = core_id;
--
2.17.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [dpdk-dev] [PATCH 2/2] examples/performance-thread: fix undef behavior
2020-10-16 6:03 ` [dpdk-dev] [PATCH 1/2] test/rcu: fix array subscript is above array bounds Honnappa Nagarahalli
@ 2020-10-16 6:03 ` Honnappa Nagarahalli
2020-10-20 22:46 ` Lukasz Wojciechowski
2020-10-30 14:26 ` David Marchand
2020-10-20 0:06 ` [dpdk-dev] [PATCH 1/2] test/rcu: fix array subscript is above array bounds Lukasz Wojciechowski
2020-10-30 14:44 ` David Marchand
2 siblings, 2 replies; 8+ messages in thread
From: Honnappa Nagarahalli @ 2020-10-16 6:03 UTC (permalink / raw)
To: dev, honnappa.nagarahalli, john.mcnamara
Cc: ruifeng.wang, juraj.linkes, david.marchand, nd, ian.betts, stable
When the value of RTE_MAX_LCORE is small, it results in the
following compilation error.
../examples/performance-thread/l3fwd-thread/main.c:2338:34: error:
iteration 4 invokes undefined behavior
[-Werror=aggressive-loop-optimizations]
Fixes: d48415e1fee3 ("examples/performance-thread: add l3fwd-thread app")
Cc: ian.betts@intel.com
Cc: stable@dpdk.org
Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
examples/performance-thread/l3fwd-thread/main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c
index 818e483d2..dc34d4893 100644
--- a/examples/performance-thread/l3fwd-thread/main.c
+++ b/examples/performance-thread/l3fwd-thread/main.c
@@ -599,8 +599,8 @@ struct thread_rx_conf rx_thread[MAX_RX_THREAD];
struct thread_tx_conf {
struct thread_conf conf;
- uint16_t tx_queue_id[RTE_MAX_LCORE];
- struct mbuf_table tx_mbufs[RTE_MAX_LCORE];
+ uint16_t tx_queue_id[RTE_MAX_ETHPORTS];
+ struct mbuf_table tx_mbufs[RTE_MAX_ETHPORTS];
struct rte_ring *ring;
struct lthread_cond **ready;
--
2.17.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [dpdk-dev] [PATCH 1/2] test/rcu: fix array subscript is above array bounds
2020-10-16 6:03 ` [dpdk-dev] [PATCH 1/2] test/rcu: fix array subscript is above array bounds Honnappa Nagarahalli
2020-10-16 6:03 ` [dpdk-dev] [PATCH 2/2] examples/performance-thread: fix undef behavior Honnappa Nagarahalli
@ 2020-10-20 0:06 ` Lukasz Wojciechowski
2020-10-20 16:26 ` Honnappa Nagarahalli
2020-10-30 14:44 ` David Marchand
2 siblings, 1 reply; 8+ messages in thread
From: Lukasz Wojciechowski @ 2020-10-20 0:06 UTC (permalink / raw)
To: Honnappa Nagarahalli, dev, john.mcnamara
Cc: ruifeng.wang, juraj.linkes, david.marchand, nd, stable,
"'Lukasz Wojciechowski'",
Hi Honnappa,
I verified building and testing and all the warnings/errors disappear
for RTE_MAX_LCORE >= 2 and tests pass.
I wonder, if it is possible to set RTE_MAX_LCORE = 1 ?
In such case there are still few places with array bounds exceedings:
Compiling C object 'app/test/3062f5d@@dpdk-test@exe/test_rcu_qsbr.c.o'.
../app/test/test_rcu_qsbr.c: In function ‘test_rcu_qsbr_check_reader’:
../app/test/test_rcu_qsbr.c:319:24: warning: array subscript is above
array bounds [-Warray-bounds]
enabled_core_ids[i]);
~~~~~~~~~~~~~~~~^~~
../app/test/test_rcu_qsbr.c: In function ‘test_rcu_qsbr_main’:
../app/test/test_rcu_qsbr.c:946:2: warning: array subscript is above
array bounds [-Warray-bounds]
rte_rcu_qsbr_init(t[1], RTE_MAX_LCORE);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../app/test/test_rcu_qsbr.c:954:3: warning: array subscript is above
array bounds [-Warray-bounds]
rte_rcu_qsbr_thread_register(t[1], enabled_core_ids[i]);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../app/test/test_rcu_qsbr.c:957:2: warning: array subscript is above
array bounds [-Warray-bounds]
rte_rcu_qsbr_dump(stdout, t[1]);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../app/test/test_rcu_qsbr.c:486:53: warning: array subscript is above
array bounds [-Warray-bounds]
rte_rcu_qsbr_thread_register(t[0], enabled_core_ids[1]);
~~~~~~~~~~~~~~~~^~~
...and few more in other files.
Best regards
Lukasz
W dniu 16.10.2020 o 08:03, Honnappa Nagarahalli pisze:
> When RTE_MAX_LCORE value is small, following compiler errors
> are observed.
>
> ../app/test/test_rcu_qsbr.c:296:54: error: iteration 2 invokes
> undefined behavior [-Werror=aggressive-loop-optimizations]
>
> ../app/test/test_rcu_qsbr.c:315:55: error: array subscript is above
> array bounds [-Werror=array-bounds]
>
> Fixes: b87089b0bb19 ("test/rcu: add API and functional tests")
> 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 | 56 +++++++++++++++++++++++-----------------
> 1 file changed, 33 insertions(+), 23 deletions(-)
>
> diff --git a/app/test/test_rcu_qsbr.c b/app/test/test_rcu_qsbr.c
> index 0a9e5ecd1..848a68092 100644
> --- a/app/test/test_rcu_qsbr.c
> +++ b/app/test/test_rcu_qsbr.c
> @@ -286,13 +286,13 @@ static int
> test_rcu_qsbr_start(void)
> {
> uint64_t token;
> - int i;
> + unsigned int i;
>
> printf("\nTest rte_rcu_qsbr_start()\n");
>
> rte_rcu_qsbr_init(t[0], RTE_MAX_LCORE);
>
> - for (i = 0; i < 3; i++)
> + for (i = 0; i < num_cores; i++)
> rte_rcu_qsbr_thread_register(t[0], enabled_core_ids[i]);
>
> token = rte_rcu_qsbr_start(t[0]);
> @@ -306,14 +306,18 @@ test_rcu_qsbr_check_reader(void *arg)
> {
> struct rte_rcu_qsbr *temp;
> uint8_t read_type = (uint8_t)((uintptr_t)arg);
> + unsigned int i;
>
> temp = t[read_type];
>
> /* Update quiescent state counter */
> - rte_rcu_qsbr_quiescent(temp, enabled_core_ids[0]);
> - rte_rcu_qsbr_quiescent(temp, enabled_core_ids[1]);
> - rte_rcu_qsbr_thread_unregister(temp, enabled_core_ids[2]);
> - rte_rcu_qsbr_quiescent(temp, enabled_core_ids[3]);
> + for (i = 0; i < num_cores; i++) {
> + if (i % 2 == 0)
> + rte_rcu_qsbr_quiescent(temp, enabled_core_ids[i]);
> + else
> + rte_rcu_qsbr_thread_unregister(temp,
> + enabled_core_ids[i]);
> + }
> return 0;
> }
>
> @@ -324,7 +328,8 @@ test_rcu_qsbr_check_reader(void *arg)
> static int
> test_rcu_qsbr_check(void)
> {
> - int i, ret;
> + int ret;
> + unsigned int i;
> uint64_t token;
>
> printf("\nTest rte_rcu_qsbr_check()\n");
> @@ -342,7 +347,7 @@ test_rcu_qsbr_check(void)
> ret = rte_rcu_qsbr_check(t[0], token, true);
> TEST_RCU_QSBR_RETURN_IF_ERROR((ret == 0), "Blocking QSBR check");
>
> - for (i = 0; i < 3; i++)
> + for (i = 0; i < num_cores; i++)
> rte_rcu_qsbr_thread_register(t[0], enabled_core_ids[i]);
>
> ret = rte_rcu_qsbr_check(t[0], token, false);
> @@ -357,7 +362,7 @@ test_rcu_qsbr_check(void)
> /* Threads are offline, hence this should pass */
> TEST_RCU_QSBR_RETURN_IF_ERROR((ret == 0), "Non-blocking QSBR check");
>
> - for (i = 0; i < 3; i++)
> + for (i = 0; i < num_cores; i++)
> rte_rcu_qsbr_thread_unregister(t[0], enabled_core_ids[i]);
>
> ret = rte_rcu_qsbr_check(t[0], token, true);
> @@ -365,7 +370,7 @@ test_rcu_qsbr_check(void)
>
> rte_rcu_qsbr_init(t[0], RTE_MAX_LCORE);
>
> - for (i = 0; i < 4; i++)
> + for (i = 0; i < num_cores; i++)
> rte_rcu_qsbr_thread_register(t[0], enabled_core_ids[i]);
>
> token = rte_rcu_qsbr_start(t[0]);
> @@ -928,7 +933,7 @@ test_rcu_qsbr_dq_functional(int32_t size, int32_t esize, uint32_t flags)
> static int
> test_rcu_qsbr_dump(void)
> {
> - int i;
> + unsigned int i;
>
> printf("\nTest rte_rcu_qsbr_dump()\n");
>
> @@ -945,7 +950,7 @@ test_rcu_qsbr_dump(void)
>
> rte_rcu_qsbr_thread_register(t[0], enabled_core_ids[0]);
>
> - for (i = 1; i < 3; i++)
> + for (i = 1; i < num_cores; i++)
> rte_rcu_qsbr_thread_register(t[1], enabled_core_ids[i]);
>
> rte_rcu_qsbr_dump(stdout, t[0]);
> @@ -1095,7 +1100,7 @@ test_rcu_qsbr_sw_sv_3qs(void)
> {
> uint64_t token[3];
> uint32_t c;
> - int i;
> + int i, num_readers;
> int32_t pos[3];
>
> writer_done = 0;
> @@ -1118,7 +1123,11 @@ test_rcu_qsbr_sw_sv_3qs(void)
> thread_info[0].ih = 0;
>
> /* Reader threads are launched */
> - for (i = 0; i < 4; i++)
> + /* Keep the number of reader threads low to reduce
> + * the execution time.
> + */
> + num_readers = num_cores < 4 ? num_cores : 4;
> + for (i = 0; i < num_readers; i++)
> rte_eal_remote_launch(test_rcu_qsbr_reader, &thread_info[0],
> enabled_core_ids[i]);
>
> @@ -1151,7 +1160,7 @@ test_rcu_qsbr_sw_sv_3qs(void)
>
> /* Check the quiescent state status */
> rte_rcu_qsbr_check(t[0], token[0], true);
> - for (i = 0; i < 4; i++) {
> + for (i = 0; i < num_readers; i++) {
> c = hash_data[0][0][enabled_core_ids[i]];
> if (c != COUNTER_VALUE && c != 0) {
> printf("Reader lcore %d did not complete #0 = %d\n",
> @@ -1169,7 +1178,7 @@ test_rcu_qsbr_sw_sv_3qs(void)
>
> /* Check the quiescent state status */
> rte_rcu_qsbr_check(t[0], token[1], true);
> - for (i = 0; i < 4; i++) {
> + for (i = 0; i < num_readers; i++) {
> c = hash_data[0][3][enabled_core_ids[i]];
> if (c != COUNTER_VALUE && c != 0) {
> printf("Reader lcore %d did not complete #3 = %d\n",
> @@ -1187,7 +1196,7 @@ test_rcu_qsbr_sw_sv_3qs(void)
>
> /* Check the quiescent state status */
> rte_rcu_qsbr_check(t[0], token[2], true);
> - for (i = 0; i < 4; i++) {
> + for (i = 0; i < num_readers; i++) {
> c = hash_data[0][6][enabled_core_ids[i]];
> if (c != COUNTER_VALUE && c != 0) {
> printf("Reader lcore %d did not complete #6 = %d\n",
> @@ -1206,7 +1215,7 @@ test_rcu_qsbr_sw_sv_3qs(void)
> writer_done = 1;
>
> /* Wait and check return value from reader threads */
> - for (i = 0; i < 4; i++)
> + for (i = 0; i < num_readers; i++)
> if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
> goto error;
> rte_hash_free(h[0]);
> @@ -1236,6 +1245,12 @@ test_rcu_qsbr_mw_mv_mqs(void)
> unsigned int i, j;
> unsigned int test_cores;
>
> + if (RTE_MAX_LCORE < 5 || num_cores < 4) {
> + printf("Not enough cores for %s, expecting at least 5\n",
> + __func__);
> + return TEST_SKIPPED;
> + }
> +
> writer_done = 0;
> test_cores = num_cores / 4;
> test_cores = test_cores * 4;
> @@ -1321,11 +1336,6 @@ test_rcu_qsbr_main(void)
> {
> uint16_t core_id;
>
> - if (rte_lcore_count() < 5) {
> - printf("Not enough cores for rcu_qsbr_autotest, expecting at least 5\n");
> - return TEST_SKIPPED;
> - }
> -
> num_cores = 0;
> RTE_LCORE_FOREACH_SLAVE(core_id) {
> enabled_core_ids[num_cores] = core_id;
--
Lukasz Wojciechowski
Principal Software Engineer
Samsung R&D Institute Poland
Samsung Electronics
Office +48 22 377 88 25
l.wojciechow@partner.samsung.com
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [dpdk-dev] [PATCH 1/2] test/rcu: fix array subscript is above array bounds
2020-10-20 0:06 ` [dpdk-dev] [PATCH 1/2] test/rcu: fix array subscript is above array bounds Lukasz Wojciechowski
@ 2020-10-20 16:26 ` Honnappa Nagarahalli
2020-10-20 20:59 ` Lukasz Wojciechowski
0 siblings, 1 reply; 8+ messages in thread
From: Honnappa Nagarahalli @ 2020-10-20 16:26 UTC (permalink / raw)
To: Lukasz Wojciechowski, dev, john.mcnamara
Cc: Ruifeng Wang, juraj.linkes, david.marchand, nd, stable,
Honnappa Nagarahalli, nd
<snip>
Hi Lukasz,
>
> Hi Honnappa,
>
> I verified building and testing and all the warnings/errors disappear for
> RTE_MAX_LCORE >= 2 and tests pass.
Thank you for testing this.
>
> I wonder, if it is possible to set RTE_MAX_LCORE = 1 ?
I thought, we would need 2 cores minimum, one for main and the other for worker.
I compiled now with 1 core. I see more errors than what you are seeing. I am seeing errors in test cases for bbdev, hash, lpm as well. Not sure if it is worth fixing them.
> In such case there are still few places with array bounds exceedings:
> Compiling C object 'app/test/3062f5d@@dpdk-test@exe/test_rcu_qsbr.c.o'.
> ../app/test/test_rcu_qsbr.c: In function ‘test_rcu_qsbr_check_reader’:
> ../app/test/test_rcu_qsbr.c:319:24: warning: array subscript is above array
> bounds [-Warray-bounds]
> enabled_core_ids[i]);
> ~~~~~~~~~~~~~~~~^~~
> ../app/test/test_rcu_qsbr.c: In function ‘test_rcu_qsbr_main’:
> ../app/test/test_rcu_qsbr.c:946:2: warning: array subscript is above array
> bounds [-Warray-bounds]
> rte_rcu_qsbr_init(t[1], RTE_MAX_LCORE);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ../app/test/test_rcu_qsbr.c:954:3: warning: array subscript is above array
> bounds [-Warray-bounds]
> rte_rcu_qsbr_thread_register(t[1], enabled_core_ids[i]);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ../app/test/test_rcu_qsbr.c:957:2: warning: array subscript is above array
> bounds [-Warray-bounds]
> rte_rcu_qsbr_dump(stdout, t[1]);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ../app/test/test_rcu_qsbr.c:486:53: warning: array subscript is above array
> bounds [-Warray-bounds]
> rte_rcu_qsbr_thread_register(t[0], enabled_core_ids[1]);
> ~~~~~~~~~~~~~~~~^~~ ...and few more in other files.
>
>
> Best regards
>
> Lukasz
>
> W dniu 16.10.2020 o 08:03, Honnappa Nagarahalli pisze:
> > When RTE_MAX_LCORE value is small, following compiler errors are
> > observed.
> >
> > ../app/test/test_rcu_qsbr.c:296:54: error: iteration 2 invokes
> > undefined behavior [-Werror=aggressive-loop-optimizations]
> >
> > ../app/test/test_rcu_qsbr.c:315:55: error: array subscript is above
> > array bounds [-Werror=array-bounds]
> >
> > Fixes: b87089b0bb19 ("test/rcu: add API and functional tests")
> > 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 | 56 +++++++++++++++++++++++----------------
> -
> > 1 file changed, 33 insertions(+), 23 deletions(-)
> >
> > diff --git a/app/test/test_rcu_qsbr.c b/app/test/test_rcu_qsbr.c index
> > 0a9e5ecd1..848a68092 100644
> > --- a/app/test/test_rcu_qsbr.c
> > +++ b/app/test/test_rcu_qsbr.c
> > @@ -286,13 +286,13 @@ static int
> > test_rcu_qsbr_start(void)
> > {
> > uint64_t token;
> > - int i;
> > + unsigned int i;
> >
> > printf("\nTest rte_rcu_qsbr_start()\n");
> >
> > rte_rcu_qsbr_init(t[0], RTE_MAX_LCORE);
> >
> > - for (i = 0; i < 3; i++)
> > + for (i = 0; i < num_cores; i++)
> > rte_rcu_qsbr_thread_register(t[0], enabled_core_ids[i]);
> >
> > token = rte_rcu_qsbr_start(t[0]);
> > @@ -306,14 +306,18 @@ test_rcu_qsbr_check_reader(void *arg)
> > {
> > struct rte_rcu_qsbr *temp;
> > uint8_t read_type = (uint8_t)((uintptr_t)arg);
> > + unsigned int i;
> >
> > temp = t[read_type];
> >
> > /* Update quiescent state counter */
> > - rte_rcu_qsbr_quiescent(temp, enabled_core_ids[0]);
> > - rte_rcu_qsbr_quiescent(temp, enabled_core_ids[1]);
> > - rte_rcu_qsbr_thread_unregister(temp, enabled_core_ids[2]);
> > - rte_rcu_qsbr_quiescent(temp, enabled_core_ids[3]);
> > + for (i = 0; i < num_cores; i++) {
> > + if (i % 2 == 0)
> > + rte_rcu_qsbr_quiescent(temp, enabled_core_ids[i]);
> > + else
> > + rte_rcu_qsbr_thread_unregister(temp,
> > + enabled_core_ids[i]);
> > + }
> > return 0;
> > }
> >
> > @@ -324,7 +328,8 @@ test_rcu_qsbr_check_reader(void *arg)
> > static int
> > test_rcu_qsbr_check(void)
> > {
> > - int i, ret;
> > + int ret;
> > + unsigned int i;
> > uint64_t token;
> >
> > printf("\nTest rte_rcu_qsbr_check()\n"); @@ -342,7 +347,7 @@
> > test_rcu_qsbr_check(void)
> > ret = rte_rcu_qsbr_check(t[0], token, true);
> > TEST_RCU_QSBR_RETURN_IF_ERROR((ret == 0), "Blocking QSBR
> check");
> >
> > - for (i = 0; i < 3; i++)
> > + for (i = 0; i < num_cores; i++)
> > rte_rcu_qsbr_thread_register(t[0], enabled_core_ids[i]);
> >
> > ret = rte_rcu_qsbr_check(t[0], token, false); @@ -357,7 +362,7 @@
> > test_rcu_qsbr_check(void)
> > /* Threads are offline, hence this should pass */
> > TEST_RCU_QSBR_RETURN_IF_ERROR((ret == 0), "Non-blocking QSBR
> > check");
> >
> > - for (i = 0; i < 3; i++)
> > + for (i = 0; i < num_cores; i++)
> > rte_rcu_qsbr_thread_unregister(t[0], enabled_core_ids[i]);
> >
> > ret = rte_rcu_qsbr_check(t[0], token, true); @@ -365,7 +370,7 @@
> > test_rcu_qsbr_check(void)
> >
> > rte_rcu_qsbr_init(t[0], RTE_MAX_LCORE);
> >
> > - for (i = 0; i < 4; i++)
> > + for (i = 0; i < num_cores; i++)
> > rte_rcu_qsbr_thread_register(t[0], enabled_core_ids[i]);
> >
> > token = rte_rcu_qsbr_start(t[0]);
> > @@ -928,7 +933,7 @@ test_rcu_qsbr_dq_functional(int32_t size, int32_t
> esize, uint32_t flags)
> > static int
> > test_rcu_qsbr_dump(void)
> > {
> > - int i;
> > + unsigned int i;
> >
> > printf("\nTest rte_rcu_qsbr_dump()\n");
> >
> > @@ -945,7 +950,7 @@ test_rcu_qsbr_dump(void)
> >
> > rte_rcu_qsbr_thread_register(t[0], enabled_core_ids[0]);
> >
> > - for (i = 1; i < 3; i++)
> > + for (i = 1; i < num_cores; i++)
> > rte_rcu_qsbr_thread_register(t[1], enabled_core_ids[i]);
> >
> > rte_rcu_qsbr_dump(stdout, t[0]);
> > @@ -1095,7 +1100,7 @@ test_rcu_qsbr_sw_sv_3qs(void)
> > {
> > uint64_t token[3];
> > uint32_t c;
> > - int i;
> > + int i, num_readers;
> > int32_t pos[3];
> >
> > writer_done = 0;
> > @@ -1118,7 +1123,11 @@ test_rcu_qsbr_sw_sv_3qs(void)
> > thread_info[0].ih = 0;
> >
> > /* Reader threads are launched */
> > - for (i = 0; i < 4; i++)
> > + /* Keep the number of reader threads low to reduce
> > + * the execution time.
> > + */
> > + num_readers = num_cores < 4 ? num_cores : 4;
> > + for (i = 0; i < num_readers; i++)
> > rte_eal_remote_launch(test_rcu_qsbr_reader,
> &thread_info[0],
> > enabled_core_ids[i]);
> >
> > @@ -1151,7 +1160,7 @@ test_rcu_qsbr_sw_sv_3qs(void)
> >
> > /* Check the quiescent state status */
> > rte_rcu_qsbr_check(t[0], token[0], true);
> > - for (i = 0; i < 4; i++) {
> > + for (i = 0; i < num_readers; i++) {
> > c = hash_data[0][0][enabled_core_ids[i]];
> > if (c != COUNTER_VALUE && c != 0) {
> > printf("Reader lcore %d did not complete #0 = %d\n",
> @@ -1169,7
> > +1178,7 @@ test_rcu_qsbr_sw_sv_3qs(void)
> >
> > /* Check the quiescent state status */
> > rte_rcu_qsbr_check(t[0], token[1], true);
> > - for (i = 0; i < 4; i++) {
> > + for (i = 0; i < num_readers; i++) {
> > c = hash_data[0][3][enabled_core_ids[i]];
> > if (c != COUNTER_VALUE && c != 0) {
> > printf("Reader lcore %d did not complete #3 = %d\n",
> @@ -1187,7
> > +1196,7 @@ test_rcu_qsbr_sw_sv_3qs(void)
> >
> > /* Check the quiescent state status */
> > rte_rcu_qsbr_check(t[0], token[2], true);
> > - for (i = 0; i < 4; i++) {
> > + for (i = 0; i < num_readers; i++) {
> > c = hash_data[0][6][enabled_core_ids[i]];
> > if (c != COUNTER_VALUE && c != 0) {
> > printf("Reader lcore %d did not complete #6 = %d\n",
> @@ -1206,7
> > +1215,7 @@ test_rcu_qsbr_sw_sv_3qs(void)
> > writer_done = 1;
> >
> > /* Wait and check return value from reader threads */
> > - for (i = 0; i < 4; i++)
> > + for (i = 0; i < num_readers; i++)
> > if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
> > goto error;
> > rte_hash_free(h[0]);
> > @@ -1236,6 +1245,12 @@ test_rcu_qsbr_mw_mv_mqs(void)
> > unsigned int i, j;
> > unsigned int test_cores;
> >
> > + if (RTE_MAX_LCORE < 5 || num_cores < 4) {
> > + printf("Not enough cores for %s, expecting at least 5\n",
> > + __func__);
> > + return TEST_SKIPPED;
> > + }
> > +
> > writer_done = 0;
> > test_cores = num_cores / 4;
> > test_cores = test_cores * 4;
> > @@ -1321,11 +1336,6 @@ test_rcu_qsbr_main(void)
> > {
> > uint16_t core_id;
> >
> > - if (rte_lcore_count() < 5) {
> > - printf("Not enough cores for rcu_qsbr_autotest, expecting at
> least 5\n");
> > - return TEST_SKIPPED;
> > - }
> > -
> > num_cores = 0;
> > RTE_LCORE_FOREACH_SLAVE(core_id) {
> > enabled_core_ids[num_cores] = core_id;
>
> --
> Lukasz Wojciechowski
> Principal Software Engineer
>
> Samsung R&D Institute Poland
> Samsung Electronics
> Office +48 22 377 88 25
> l.wojciechow@partner.samsung.com
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [dpdk-dev] [PATCH 1/2] test/rcu: fix array subscript is above array bounds
2020-10-20 16:26 ` Honnappa Nagarahalli
@ 2020-10-20 20:59 ` Lukasz Wojciechowski
0 siblings, 0 replies; 8+ messages in thread
From: Lukasz Wojciechowski @ 2020-10-20 20:59 UTC (permalink / raw)
To: Honnappa Nagarahalli, dev, john.mcnamara
Cc: Ruifeng Wang, juraj.linkes, david.marchand, nd, stable,
"'Lukasz Wojciechowski'",
Hi Honnappa,
If setting value lower than 2 makes no sense as there is no place for
worker thread, then the patch is perfectly fine
<snip>
>>> When RTE_MAX_LCORE value is small, following compiler errors are
>>> observed.
>>>
>>> ../app/test/test_rcu_qsbr.c:296:54: error: iteration 2 invokes
>>> undefined behavior [-Werror=aggressive-loop-optimizations]
>>>
>>> ../app/test/test_rcu_qsbr.c:315:55: error: array subscript is above
>>> array bounds [-Werror=array-bounds]
>>>
>>> Fixes: b87089b0bb19 ("test/rcu: add API and functional tests")
>>> Cc: stable@dpdk.org
>>>
>>> Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
>>> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Tested-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Reviewed-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
>>> ---
>>> app/test/test_rcu_qsbr.c | 56 +++++++++++++++++++++++----------------
>> -
>>> 1 file changed, 33 insertions(+), 23 deletions(-)
>>>
>>> diff --git a/app/test/test_rcu_qsbr.c b/app/test/test_rcu_qsbr.c index
>>> 0a9e5ecd1..848a68092 100644
>>> --- a/app/test/test_rcu_qsbr.c
>>> +++ b/app/test/test_rcu_qsbr.c
>>> @@ -286,13 +286,13 @@ static int
>>> test_rcu_qsbr_start(void)
>>> {
>>> uint64_t token;
>>> - int i;
>>> + unsigned int i;
>>>
>>> printf("\nTest rte_rcu_qsbr_start()\n");
>>>
>>> rte_rcu_qsbr_init(t[0], RTE_MAX_LCORE);
>>>
>>> - for (i = 0; i < 3; i++)
>>> + for (i = 0; i < num_cores; i++)
>>> rte_rcu_qsbr_thread_register(t[0], enabled_core_ids[i]);
>>>
>>> token = rte_rcu_qsbr_start(t[0]);
>>> @@ -306,14 +306,18 @@ test_rcu_qsbr_check_reader(void *arg)
>>> {
>>> struct rte_rcu_qsbr *temp;
>>> uint8_t read_type = (uint8_t)((uintptr_t)arg);
>>> + unsigned int i;
>>>
>>> temp = t[read_type];
>>>
>>> /* Update quiescent state counter */
>>> - rte_rcu_qsbr_quiescent(temp, enabled_core_ids[0]);
>>> - rte_rcu_qsbr_quiescent(temp, enabled_core_ids[1]);
>>> - rte_rcu_qsbr_thread_unregister(temp, enabled_core_ids[2]);
>>> - rte_rcu_qsbr_quiescent(temp, enabled_core_ids[3]);
>>> + for (i = 0; i < num_cores; i++) {
>>> + if (i % 2 == 0)
>>> + rte_rcu_qsbr_quiescent(temp, enabled_core_ids[i]);
>>> + else
>>> + rte_rcu_qsbr_thread_unregister(temp,
>>> + enabled_core_ids[i]);
>>> + }
>>> return 0;
>>> }
>>>
>>> @@ -324,7 +328,8 @@ test_rcu_qsbr_check_reader(void *arg)
>>> static int
>>> test_rcu_qsbr_check(void)
>>> {
>>> - int i, ret;
>>> + int ret;
>>> + unsigned int i;
>>> uint64_t token;
>>>
>>> printf("\nTest rte_rcu_qsbr_check()\n"); @@ -342,7 +347,7 @@
>>> test_rcu_qsbr_check(void)
>>> ret = rte_rcu_qsbr_check(t[0], token, true);
>>> TEST_RCU_QSBR_RETURN_IF_ERROR((ret == 0), "Blocking QSBR
>> check");
>>> - for (i = 0; i < 3; i++)
>>> + for (i = 0; i < num_cores; i++)
>>> rte_rcu_qsbr_thread_register(t[0], enabled_core_ids[i]);
>>>
>>> ret = rte_rcu_qsbr_check(t[0], token, false); @@ -357,7 +362,7 @@
>>> test_rcu_qsbr_check(void)
>>> /* Threads are offline, hence this should pass */
>>> TEST_RCU_QSBR_RETURN_IF_ERROR((ret == 0), "Non-blocking QSBR
>>> check");
>>>
>>> - for (i = 0; i < 3; i++)
>>> + for (i = 0; i < num_cores; i++)
>>> rte_rcu_qsbr_thread_unregister(t[0], enabled_core_ids[i]);
>>>
>>> ret = rte_rcu_qsbr_check(t[0], token, true); @@ -365,7 +370,7 @@
>>> test_rcu_qsbr_check(void)
>>>
>>> rte_rcu_qsbr_init(t[0], RTE_MAX_LCORE);
>>>
>>> - for (i = 0; i < 4; i++)
>>> + for (i = 0; i < num_cores; i++)
>>> rte_rcu_qsbr_thread_register(t[0], enabled_core_ids[i]);
>>>
>>> token = rte_rcu_qsbr_start(t[0]);
>>> @@ -928,7 +933,7 @@ test_rcu_qsbr_dq_functional(int32_t size, int32_t
>> esize, uint32_t flags)
>>> static int
>>> test_rcu_qsbr_dump(void)
>>> {
>>> - int i;
>>> + unsigned int i;
>>>
>>> printf("\nTest rte_rcu_qsbr_dump()\n");
>>>
>>> @@ -945,7 +950,7 @@ test_rcu_qsbr_dump(void)
>>>
>>> rte_rcu_qsbr_thread_register(t[0], enabled_core_ids[0]);
>>>
>>> - for (i = 1; i < 3; i++)
>>> + for (i = 1; i < num_cores; i++)
>>> rte_rcu_qsbr_thread_register(t[1], enabled_core_ids[i]);
>>>
>>> rte_rcu_qsbr_dump(stdout, t[0]);
>>> @@ -1095,7 +1100,7 @@ test_rcu_qsbr_sw_sv_3qs(void)
>>> {
>>> uint64_t token[3];
>>> uint32_t c;
>>> - int i;
>>> + int i, num_readers;
>>> int32_t pos[3];
>>>
>>> writer_done = 0;
>>> @@ -1118,7 +1123,11 @@ test_rcu_qsbr_sw_sv_3qs(void)
>>> thread_info[0].ih = 0;
>>>
>>> /* Reader threads are launched */
>>> - for (i = 0; i < 4; i++)
>>> + /* Keep the number of reader threads low to reduce
>>> + * the execution time.
>>> + */
>>> + num_readers = num_cores < 4 ? num_cores : 4;
>>> + for (i = 0; i < num_readers; i++)
>>> rte_eal_remote_launch(test_rcu_qsbr_reader,
>> &thread_info[0],
>>> enabled_core_ids[i]);
>>>
>>> @@ -1151,7 +1160,7 @@ test_rcu_qsbr_sw_sv_3qs(void)
>>>
>>> /* Check the quiescent state status */
>>> rte_rcu_qsbr_check(t[0], token[0], true);
>>> - for (i = 0; i < 4; i++) {
>>> + for (i = 0; i < num_readers; i++) {
>>> c = hash_data[0][0][enabled_core_ids[i]];
>>> if (c != COUNTER_VALUE && c != 0) {
>>> printf("Reader lcore %d did not complete #0 = %d\n",
>> @@ -1169,7
>>> +1178,7 @@ test_rcu_qsbr_sw_sv_3qs(void)
>>>
>>> /* Check the quiescent state status */
>>> rte_rcu_qsbr_check(t[0], token[1], true);
>>> - for (i = 0; i < 4; i++) {
>>> + for (i = 0; i < num_readers; i++) {
>>> c = hash_data[0][3][enabled_core_ids[i]];
>>> if (c != COUNTER_VALUE && c != 0) {
>>> printf("Reader lcore %d did not complete #3 = %d\n",
>> @@ -1187,7
>>> +1196,7 @@ test_rcu_qsbr_sw_sv_3qs(void)
>>>
>>> /* Check the quiescent state status */
>>> rte_rcu_qsbr_check(t[0], token[2], true);
>>> - for (i = 0; i < 4; i++) {
>>> + for (i = 0; i < num_readers; i++) {
>>> c = hash_data[0][6][enabled_core_ids[i]];
>>> if (c != COUNTER_VALUE && c != 0) {
>>> printf("Reader lcore %d did not complete #6 = %d\n",
>> @@ -1206,7
>>> +1215,7 @@ test_rcu_qsbr_sw_sv_3qs(void)
>>> writer_done = 1;
>>>
>>> /* Wait and check return value from reader threads */
>>> - for (i = 0; i < 4; i++)
>>> + for (i = 0; i < num_readers; i++)
>>> if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
>>> goto error;
>>> rte_hash_free(h[0]);
>>> @@ -1236,6 +1245,12 @@ test_rcu_qsbr_mw_mv_mqs(void)
>>> unsigned int i, j;
>>> unsigned int test_cores;
>>>
>>> + if (RTE_MAX_LCORE < 5 || num_cores < 4) {
>>> + printf("Not enough cores for %s, expecting at least 5\n",
>>> + __func__);
>>> + return TEST_SKIPPED;
>>> + }
>>> +
>>> writer_done = 0;
>>> test_cores = num_cores / 4;
>>> test_cores = test_cores * 4;
>>> @@ -1321,11 +1336,6 @@ test_rcu_qsbr_main(void)
>>> {
>>> uint16_t core_id;
>>>
>>> - if (rte_lcore_count() < 5) {
>>> - printf("Not enough cores for rcu_qsbr_autotest, expecting at
>> least 5\n");
>>> - return TEST_SKIPPED;
>>> - }
>>> -
>>> num_cores = 0;
>>> RTE_LCORE_FOREACH_SLAVE(core_id) {
>>> enabled_core_ids[num_cores] = core_id;
>> --
>> Lukasz Wojciechowski
>> Principal Software Engineer
>>
>> Samsung R&D Institute Poland
>> Samsung Electronics
>> Office +48 22 377 88 25
>> l.wojciechow@partner.samsung.com
--
Lukasz Wojciechowski
Principal Software Engineer
Samsung R&D Institute Poland
Samsung Electronics
Office +48 22 377 88 25
l.wojciechow@partner.samsung.com
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [dpdk-dev] [PATCH 2/2] examples/performance-thread: fix undef behavior
2020-10-16 6:03 ` [dpdk-dev] [PATCH 2/2] examples/performance-thread: fix undef behavior Honnappa Nagarahalli
@ 2020-10-20 22:46 ` Lukasz Wojciechowski
2020-10-30 14:26 ` David Marchand
1 sibling, 0 replies; 8+ messages in thread
From: Lukasz Wojciechowski @ 2020-10-20 22:46 UTC (permalink / raw)
To: Honnappa Nagarahalli, dev, john.mcnamara
Cc: ruifeng.wang, juraj.linkes, david.marchand, nd, ian.betts,
stable, "'Lukasz Wojciechowski'",
Looks good!
W dniu 16.10.2020 o 08:03, Honnappa Nagarahalli pisze:
> When the value of RTE_MAX_LCORE is small, it results in the
> following compilation error.
>
> ../examples/performance-thread/l3fwd-thread/main.c:2338:34: error:
> iteration 4 invokes undefined behavior
> [-Werror=aggressive-loop-optimizations]
>
> Fixes: d48415e1fee3 ("examples/performance-thread: add l3fwd-thread app")
> Cc: ian.betts@intel.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Tested-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Reviewed-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
> ---
> examples/performance-thread/l3fwd-thread/main.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c
> index 818e483d2..dc34d4893 100644
> --- a/examples/performance-thread/l3fwd-thread/main.c
> +++ b/examples/performance-thread/l3fwd-thread/main.c
> @@ -599,8 +599,8 @@ struct thread_rx_conf rx_thread[MAX_RX_THREAD];
> struct thread_tx_conf {
> struct thread_conf conf;
>
> - uint16_t tx_queue_id[RTE_MAX_LCORE];
> - struct mbuf_table tx_mbufs[RTE_MAX_LCORE];
> + uint16_t tx_queue_id[RTE_MAX_ETHPORTS];
> + struct mbuf_table tx_mbufs[RTE_MAX_ETHPORTS];
>
> struct rte_ring *ring;
> struct lthread_cond **ready;
--
Lukasz Wojciechowski
Principal Software Engineer
Samsung R&D Institute Poland
Samsung Electronics
Office +48 22 377 88 25
l.wojciechow@partner.samsung.com
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [dpdk-dev] [PATCH 2/2] examples/performance-thread: fix undef behavior
2020-10-16 6:03 ` [dpdk-dev] [PATCH 2/2] examples/performance-thread: fix undef behavior Honnappa Nagarahalli
2020-10-20 22:46 ` Lukasz Wojciechowski
@ 2020-10-30 14:26 ` David Marchand
1 sibling, 0 replies; 8+ messages in thread
From: David Marchand @ 2020-10-30 14:26 UTC (permalink / raw)
To: Honnappa Nagarahalli
Cc: dev, Mcnamara, John, Ruifeng Wang (Arm Technology China),
Juraj Linkeš,
nd, ian.betts, dpdk stable
On Fri, Oct 16, 2020 at 8:04 AM Honnappa Nagarahalli
<honnappa.nagarahalli@arm.com> wrote:
>
> When the value of RTE_MAX_LCORE is small, it results in the
> following compilation error.
>
> ../examples/performance-thread/l3fwd-thread/main.c:2338:34: error:
> iteration 4 invokes undefined behavior
> [-Werror=aggressive-loop-optimizations]
Lucky to catch this incorrect array size because of a change in
RTE_MAX_LCORE :-).
>
> Fixes: d48415e1fee3 ("examples/performance-thread: add l3fwd-thread app")
> Cc: ian.betts@intel.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> ---
> examples/performance-thread/l3fwd-thread/main.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c
> index 818e483d2..dc34d4893 100644
> --- a/examples/performance-thread/l3fwd-thread/main.c
> +++ b/examples/performance-thread/l3fwd-thread/main.c
> @@ -599,8 +599,8 @@ struct thread_rx_conf rx_thread[MAX_RX_THREAD];
> struct thread_tx_conf {
> struct thread_conf conf;
>
> - uint16_t tx_queue_id[RTE_MAX_LCORE];
> - struct mbuf_table tx_mbufs[RTE_MAX_LCORE];
> + uint16_t tx_queue_id[RTE_MAX_ETHPORTS];
> + struct mbuf_table tx_mbufs[RTE_MAX_ETHPORTS];
>
> struct rte_ring *ring;
> struct lthread_cond **ready;
> --
> 2.17.1
>
Reviewed-by: David Marchand <david.marchand@redhat.com>
--
David Marchand
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [dpdk-dev] [PATCH 1/2] test/rcu: fix array subscript is above array bounds
2020-10-16 6:03 ` [dpdk-dev] [PATCH 1/2] test/rcu: fix array subscript is above array bounds Honnappa Nagarahalli
2020-10-16 6:03 ` [dpdk-dev] [PATCH 2/2] examples/performance-thread: fix undef behavior Honnappa Nagarahalli
2020-10-20 0:06 ` [dpdk-dev] [PATCH 1/2] test/rcu: fix array subscript is above array bounds Lukasz Wojciechowski
@ 2020-10-30 14:44 ` David Marchand
2 siblings, 0 replies; 8+ messages in thread
From: David Marchand @ 2020-10-30 14:44 UTC (permalink / raw)
To: Honnappa Nagarahalli
Cc: dev, Mcnamara, John, Ruifeng Wang (Arm Technology China),
Juraj Linkeš,
nd, dpdk stable
On Fri, Oct 16, 2020 at 8:04 AM Honnappa Nagarahalli
<honnappa.nagarahalli@arm.com> wrote:
>
> When RTE_MAX_LCORE value is small, following compiler errors
> are observed.
>
> ../app/test/test_rcu_qsbr.c:296:54: error: iteration 2 invokes
> undefined behavior [-Werror=aggressive-loop-optimizations]
>
> ../app/test/test_rcu_qsbr.c:315:55: error: array subscript is above
> array bounds [-Werror=array-bounds]
>
> Fixes: b87089b0bb19 ("test/rcu: add API and functional tests")
> Cc: stable@dpdk.org
>
> Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Tested-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Reviewed-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Series applied, thanks.
--
David Marchand
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2020-10-30 14:44 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20201016060420eucas1p12f301a94eb4b4d19a9ced5c5cbd59c77@eucas1p1.samsung.com>
2020-10-16 6:03 ` [dpdk-dev] [PATCH 1/2] test/rcu: fix array subscript is above array bounds Honnappa Nagarahalli
2020-10-16 6:03 ` [dpdk-dev] [PATCH 2/2] examples/performance-thread: fix undef behavior Honnappa Nagarahalli
2020-10-20 22:46 ` Lukasz Wojciechowski
2020-10-30 14:26 ` David Marchand
2020-10-20 0:06 ` [dpdk-dev] [PATCH 1/2] test/rcu: fix array subscript is above array bounds Lukasz Wojciechowski
2020-10-20 16:26 ` Honnappa Nagarahalli
2020-10-20 20:59 ` Lukasz Wojciechowski
2020-10-30 14:44 ` David Marchand
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).