* [PATCH 0/2] fix hash unit test for CI
@ 2025-10-30 17:50 Thomas Monjalon
2025-10-30 17:50 ` [PATCH 1/2] test/hash: check memory allocation Thomas Monjalon
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Thomas Monjalon @ 2025-10-30 17:50 UTC (permalink / raw)
To: dev; +Cc: david.marchand
When running the CI tests in GHA with UBSan enabled,
for an unknown reason, a test is regularly going to timeout.
While reducing the time needed for this test,
a fix is added to fail nicely when there is not enough memory.
Thomas Monjalon (2):
test/hash: check memory allocation
test/hash: reduce time of functional R/W test
app/test/test_hash_readwrite.c | 35 +++++++++++++++-----------
app/test/test_hash_readwrite_lf_perf.c | 4 +++
2 files changed, 24 insertions(+), 15 deletions(-)
--
2.51.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] test/hash: check memory allocation
2025-10-30 17:50 [PATCH 0/2] fix hash unit test for CI Thomas Monjalon
@ 2025-10-30 17:50 ` Thomas Monjalon
2025-10-31 7:51 ` David Marchand
2025-10-30 17:50 ` [PATCH 2/2] test/hash: reduce time of functional R/W test Thomas Monjalon
2025-10-31 11:12 ` [PATCH 0/2] fix hash unit test for CI Thomas Monjalon
2 siblings, 1 reply; 6+ messages in thread
From: Thomas Monjalon @ 2025-10-30 17:50 UTC (permalink / raw)
To: dev
Cc: david.marchand, stable, Yipeng Wang, Sameh Gobriel,
Bruce Richardson, Vladimir Medvedkin
When reserving a specific memory amount, it was possible to pass
the first allocations and fail on a later allocation
where there was no check, resulting in a crash.
It is fixed by stopping the test if allocation failed.
Fixes: fd368e1982bc ("test/hash: test more corner cases")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
app/test/test_hash_readwrite.c | 5 +++++
app/test/test_hash_readwrite_lf_perf.c | 4 ++++
2 files changed, 9 insertions(+)
diff --git a/app/test/test_hash_readwrite.c b/app/test/test_hash_readwrite.c
index 82fe03cc5a..22ccd6df6a 100644
--- a/app/test/test_hash_readwrite.c
+++ b/app/test/test_hash_readwrite.c
@@ -70,6 +70,11 @@ test_hash_readwrite_worker(__rte_unused void *arg)
ret = rte_malloc(NULL, sizeof(int) *
tbl_rw_test_param.num_insert, 0);
+ if (ret == NULL) {
+ printf("allocation failed\n");
+ return -1;
+ }
+
for (i = 0; i < rte_lcore_count(); i++) {
if (worker_core_ids[i] == lcore_id)
break;
diff --git a/app/test/test_hash_readwrite_lf_perf.c b/app/test/test_hash_readwrite_lf_perf.c
index 864c3059d9..bef987d29d 100644
--- a/app/test/test_hash_readwrite_lf_perf.c
+++ b/app/test/test_hash_readwrite_lf_perf.c
@@ -1310,6 +1310,10 @@ test_hash_rcu_qsbr_writer_perf(struct rwc_perf *rwc_perf_results, int rwc_lf,
sz = rte_rcu_qsbr_get_memsize(RTE_MAX_LCORE);
rv = (struct rte_rcu_qsbr *)rte_zmalloc(NULL, sz, RTE_CACHE_LINE_SIZE);
+ if (rv == NULL) {
+ printf("allocation failed\n");
+ goto err;
+ }
rcu_config.v = rv;
if (rte_hash_rcu_qsbr_add(tbl_rwc_test_param.h, &rcu_config) < 0) {
--
2.51.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] test/hash: reduce time of functional R/W test
2025-10-30 17:50 [PATCH 0/2] fix hash unit test for CI Thomas Monjalon
2025-10-30 17:50 ` [PATCH 1/2] test/hash: check memory allocation Thomas Monjalon
@ 2025-10-30 17:50 ` Thomas Monjalon
2025-10-31 8:18 ` David Marchand
2025-10-31 11:12 ` [PATCH 0/2] fix hash unit test for CI Thomas Monjalon
2 siblings, 1 reply; 6+ messages in thread
From: Thomas Monjalon @ 2025-10-30 17:50 UTC (permalink / raw)
To: dev
Cc: david.marchand, Yipeng Wang, Sameh Gobriel, Bruce Richardson,
Vladimir Medvedkin
When running on limited platforms like GitHub Actions,
the functional unit test "hash_readwrite_func_autotest"
will hit a timeout, especially when running with UBSan:
46/102 DPDK:fast-tests / hash_readwrite_func_autotest TIMEOUT 30.01s
killed by signal 15 SIGTERM
Similarly to what was done in the
commit fd368e1982bc ("test/hash: test more corner cases"),
some constants are decreased.
In order to keep the performance test as it was,
a multiplier is kept for performance test case only.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
app/test/test_hash_readwrite.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/app/test/test_hash_readwrite.c b/app/test/test_hash_readwrite.c
index 22ccd6df6a..4d140439e4 100644
--- a/app/test/test_hash_readwrite.c
+++ b/app/test/test_hash_readwrite.c
@@ -18,9 +18,11 @@
#define RTE_RWTEST_FAIL 0
-#define TOTAL_ENTRY (5*1024*1024)
-#define TOTAL_INSERT (4.5*1024*1024)
-#define TOTAL_INSERT_EXT (5*1024*1024)
+#define TOTAL_ENTRY (5*1024) /* must be multiplied for perf test */
+#define TOTAL_INSERT_FUNC (4.5*1024)
+#define TOTAL_INSERT_FUNC_EXT (5*1024)
+#define PERF_MULTIPLIER 1024
+#define TOTAL_INSERT (TOTAL_INSERT_FUNC * PERF_MULTIPLIER) /* only for perf */
#define NUM_TEST 3
unsigned int core_cnt[NUM_TEST] = {2, 4, 8};
@@ -136,16 +138,15 @@ test_hash_readwrite_worker(__rte_unused void *arg)
}
static int
-init_params(int use_ext, int use_htm, int rw_lf, int use_jhash)
+init_params(int use_ext, int use_htm, int rw_lf, int use_jhash, bool perf)
{
unsigned int i;
-
uint32_t *keys = NULL;
uint8_t *found = NULL;
struct rte_hash *handle;
struct rte_hash_parameters hash_params = {
- .entries = TOTAL_ENTRY,
+ .entries = TOTAL_ENTRY * (perf ? PERF_MULTIPLIER : 1),
.key_len = sizeof(uint32_t),
.hash_func_init_val = 0,
.socket_id = rte_socket_id(),
@@ -182,14 +183,13 @@ init_params(int use_ext, int use_htm, int rw_lf, int use_jhash)
}
tbl_rw_test_param.h = handle;
- keys = rte_malloc(NULL, sizeof(uint32_t) * TOTAL_ENTRY, 0);
-
+ keys = rte_malloc(NULL, sizeof(uint32_t) * hash_params.entries, 0);
if (keys == NULL) {
printf("RTE_MALLOC failed\n");
goto err;
}
- found = rte_zmalloc(NULL, sizeof(uint8_t) * TOTAL_ENTRY, 0);
+ found = rte_zmalloc(NULL, sizeof(uint8_t) * hash_params.entries, 0);
if (found == NULL) {
printf("RTE_ZMALLOC failed\n");
goto err;
@@ -198,7 +198,7 @@ init_params(int use_ext, int use_htm, int rw_lf, int use_jhash)
tbl_rw_test_param.keys = keys;
tbl_rw_test_param.found = found;
- for (i = 0; i < TOTAL_ENTRY; i++)
+ for (i = 0; i < hash_params.entries; i++)
keys[i] = i;
return 0;
@@ -227,13 +227,13 @@ test_hash_readwrite_functional(int use_htm, int use_rw_lf, int use_ext)
rte_atomic_store_explicit(&gcycles, 0, rte_memory_order_relaxed);
rte_atomic_store_explicit(&ginsertions, 0, rte_memory_order_relaxed);
- if (init_params(use_ext, use_htm, use_rw_lf, use_jhash) != 0)
+ if (init_params(use_ext, use_htm, use_rw_lf, use_jhash, false) != 0)
goto err;
if (use_ext)
- tot_insert = TOTAL_INSERT_EXT;
+ tot_insert = TOTAL_INSERT_FUNC_EXT;
else
- tot_insert = TOTAL_INSERT;
+ tot_insert = TOTAL_INSERT_FUNC;
tbl_rw_test_param.num_insert =
tot_insert / worker_cnt;
@@ -390,7 +390,7 @@ test_hash_readwrite_perf(struct perf *perf_results, int use_htm,
rte_atomic_store_explicit(&gread_cycles, 0, rte_memory_order_relaxed);
rte_atomic_store_explicit(&gwrite_cycles, 0, rte_memory_order_relaxed);
- if (init_params(0, use_htm, 0, use_jhash) != 0)
+ if (init_params(0, use_htm, 0, use_jhash, true) != 0)
goto err;
/*
@@ -548,7 +548,7 @@ test_hash_readwrite_perf(struct perf *perf_results, int use_htm,
rte_eal_mp_wait_lcore();
iter = 0;
- memset(tbl_rw_test_param.found, 0, TOTAL_ENTRY);
+ memset(tbl_rw_test_param.found, 0, TOTAL_ENTRY * PERF_MULTIPLIER);
while (rte_hash_iterate(tbl_rw_test_param.h,
&next_key, &next_data, &iter) >= 0) {
/* Search for the key in the list of keys added .*/
--
2.51.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] test/hash: check memory allocation
2025-10-30 17:50 ` [PATCH 1/2] test/hash: check memory allocation Thomas Monjalon
@ 2025-10-31 7:51 ` David Marchand
0 siblings, 0 replies; 6+ messages in thread
From: David Marchand @ 2025-10-31 7:51 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, stable, Yipeng Wang, Sameh Gobriel, Bruce Richardson,
Vladimir Medvedkin
On Thu, 30 Oct 2025 at 18:53, Thomas Monjalon <thomas@monjalon.net> wrote:
>
> When reserving a specific memory amount, it was possible to pass
> the first allocations and fail on a later allocation
> where there was no check, resulting in a crash.
> It is fixed by stopping the test if allocation failed.
>
> Fixes: fd368e1982bc ("test/hash: test more corner cases")
Also
Fixes: 9c7d8eed1a45 ("test/hash: add RCU tests")
> Cc: stable@dpdk.org
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: David Marchand <david.marchand@redhat.com>
--
David Marchand
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] test/hash: reduce time of functional R/W test
2025-10-30 17:50 ` [PATCH 2/2] test/hash: reduce time of functional R/W test Thomas Monjalon
@ 2025-10-31 8:18 ` David Marchand
0 siblings, 0 replies; 6+ messages in thread
From: David Marchand @ 2025-10-31 8:18 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, Yipeng Wang, Sameh Gobriel, Bruce Richardson,
Vladimir Medvedkin
On Thu, 30 Oct 2025 at 18:53, Thomas Monjalon <thomas@monjalon.net> wrote:
>
> When running on limited platforms like GitHub Actions,
> the functional unit test "hash_readwrite_func_autotest"
> will hit a timeout, especially when running with UBSan:
>
> 46/102 DPDK:fast-tests / hash_readwrite_func_autotest TIMEOUT 30.01s
> killed by signal 15 SIGTERM
>
> Similarly to what was done in the
> commit fd368e1982bc ("test/hash: test more corner cases"),
> some constants are decreased.
> In order to keep the performance test as it was,
> a multiplier is kept for performance test case only.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: David Marchand <david.marchand@redhat.com>
--
David Marchand
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] fix hash unit test for CI
2025-10-30 17:50 [PATCH 0/2] fix hash unit test for CI Thomas Monjalon
2025-10-30 17:50 ` [PATCH 1/2] test/hash: check memory allocation Thomas Monjalon
2025-10-30 17:50 ` [PATCH 2/2] test/hash: reduce time of functional R/W test Thomas Monjalon
@ 2025-10-31 11:12 ` Thomas Monjalon
2 siblings, 0 replies; 6+ messages in thread
From: Thomas Monjalon @ 2025-10-31 11:12 UTC (permalink / raw)
To: dev; +Cc: david.marchand
30/10/2025 18:50, Thomas Monjalon:
> When running the CI tests in GHA with UBSan enabled,
> for an unknown reason, a test is regularly going to timeout.
> While reducing the time needed for this test,
> a fix is added to fail nicely when there is not enough memory.
>
> Thomas Monjalon (2):
> test/hash: check memory allocation
> test/hash: reduce time of functional R/W test
Applied quickly to fix CI tests.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-10-31 11:12 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-30 17:50 [PATCH 0/2] fix hash unit test for CI Thomas Monjalon
2025-10-30 17:50 ` [PATCH 1/2] test/hash: check memory allocation Thomas Monjalon
2025-10-31 7:51 ` David Marchand
2025-10-30 17:50 ` [PATCH 2/2] test/hash: reduce time of functional R/W test Thomas Monjalon
2025-10-31 8:18 ` David Marchand
2025-10-31 11:12 ` [PATCH 0/2] fix hash unit test for CI Thomas Monjalon
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.