[1/2] test/hash: use existing lcore API
Checks
Commit Message
Prefer the existing apis rather than direct access the configuration
structure.
Fixes: c7eb0972e74b ("test/hash: add lock-free r/w concurrency")
Fixes: 3f9aab961ed3 ("test/hash: check lock-free extendable bucket")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
app/test/test_hash_readwrite_lf.c | 29 ++++++++++++++---------------
1 file changed, 14 insertions(+), 15 deletions(-)
Comments
On 5/15/19 9:56 AM, David Marchand wrote:
> Prefer the existing apis rather than direct access the configuration
> structure.
>
> Fixes: c7eb0972e74b ("test/hash: add lock-free r/w concurrency")
> Fixes: 3f9aab961ed3 ("test/hash: check lock-free extendable bucket")
> Cc:stable@dpdk.org
>
> Signed-off-by: David Marchand<david.marchand@redhat.com>
> ---
> app/test/test_hash_readwrite_lf.c | 29 ++++++++++++++---------------
> 1 file changed, 14 insertions(+), 15 deletions(-)
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Thanks,
Maxime
>-----Original Message-----
>From: David Marchand [mailto:david.marchand@redhat.com]
>Sent: Wednesday, May 15, 2019 12:57 AM
>To: dev@dpdk.org
>Cc: thomas@monjalon.net; stephen@networkplumber.org; stable@dpdk.org; Wang, Yipeng1 <yipeng1.wang@intel.com>; Gobriel,
>Sameh <sameh.gobriel@intel.com>; Richardson, Bruce <bruce.richardson@intel.com>; De Lara Guarch, Pablo
><pablo.de.lara.guarch@intel.com>
>Subject: [PATCH 1/2] test/hash: use existing lcore API
>
>Prefer the existing apis rather than direct access the configuration
>structure.
>
>Fixes: c7eb0972e74b ("test/hash: add lock-free r/w concurrency")
>Fixes: 3f9aab961ed3 ("test/hash: check lock-free extendable bucket")
>Cc: stable@dpdk.org
>
>Signed-off-by: David Marchand <david.marchand@redhat.com>
>---
> app/test/test_hash_readwrite_lf.c | 29 ++++++++++++++---------------
> 1 file changed, 14 insertions(+), 15 deletions(-)
>
[Wang, Yipeng]
Hi, David, I tested the patch and the test case seems now frozen after running in the middle. Have you seen same thing?
I include the original author Dharmik for the file for more reviews.
Output:
"
....
Test: Hash add - key shift, Hash lookup - miss
Number of readers: 1
Cycles per lookup: 112
Number of readers: 2
Cycles per lookup: 113
Number of readers: 4
Cycles per lookup: 116
** With bulk-lookup **
Number of readers: 1
Cycles per lookup: 41
Number of readers: 2
Cycles per lookup: 40
Number of readers: 4
Cycles per lookup: 40
Test: Multi-add-lookup
Number of writers: 2
Number of readers: 1
Cycles per lookup: 166
Number of writers: 2
Number of readers: 2
"
<Freezing here>
Hello,
On Wed, May 22, 2019 at 2:16 AM Wang, Yipeng1 <yipeng1.wang@intel.com>
wrote:
> >-----Original Message-----
> >From: David Marchand [mailto:david.marchand@redhat.com]
> >Sent: Wednesday, May 15, 2019 12:57 AM
> >To: dev@dpdk.org
> >Cc: thomas@monjalon.net; stephen@networkplumber.org; stable@dpdk.org;
> Wang, Yipeng1 <yipeng1.wang@intel.com>; Gobriel,
> >Sameh <sameh.gobriel@intel.com>; Richardson, Bruce <
> bruce.richardson@intel.com>; De Lara Guarch, Pablo
> ><pablo.de.lara.guarch@intel.com>
> >Subject: [PATCH 1/2] test/hash: use existing lcore API
> >
> >Prefer the existing apis rather than direct access the configuration
> >structure.
> >
> >Fixes: c7eb0972e74b ("test/hash: add lock-free r/w concurrency")
> >Fixes: 3f9aab961ed3 ("test/hash: check lock-free extendable bucket")
> >Cc: stable@dpdk.org
> >
> >Signed-off-by: David Marchand <david.marchand@redhat.com>
> >---
> > app/test/test_hash_readwrite_lf.c | 29 ++++++++++++++---------------
> > 1 file changed, 14 insertions(+), 15 deletions(-)
> >
>
> [Wang, Yipeng]
>
> Hi, David, I tested the patch and the test case seems now frozen after
> running in the middle. Have you seen same thing?
>
> I include the original author Dharmik for the file for more reviews.
>
>
> Output:
>
> "
> ....
>
> Test: Hash add - key shift, Hash lookup - miss
>
> Number of readers: 1
> Cycles per lookup: 112
>
> Number of readers: 2
> Cycles per lookup: 113
>
> Number of readers: 4
> Cycles per lookup: 116
>
> ** With bulk-lookup **
>
> Number of readers: 1
> Cycles per lookup: 41
>
> Number of readers: 2
> Cycles per lookup: 40
>
> Number of readers: 4
> Cycles per lookup: 40
>
> Test: Multi-add-lookup
>
> Number of writers: 2
> Number of readers: 1
> Cycles per lookup: 166
>
> Number of writers: 2
> Number of readers: 2
> "
> <Freezing here>
>
Thanks for reporting.
I reproduced the issue.
I did not catch it as I was starting the test with 4 cores on my laptop.
I will post a fix and/or an updated patch.
@@ -738,10 +738,9 @@ struct {
rte_eal_remote_launch(test_rwc_reader,
(void *)(uintptr_t)read_type,
enabled_core_ids[i]);
- rte_eal_mp_wait_lcore();
for (i = 1; i <= rwc_core_cnt[n]; i++)
- if (lcore_config[i].ret < 0)
+ if (rte_eal_wait_lcore(i) < 0)
goto err;
unsigned long long cycles_per_lookup =
@@ -758,6 +757,7 @@ struct {
return 0;
err:
+ rte_eal_mp_wait_lcore();
rte_hash_free(tbl_rwc_test_param.h);
return -1;
}
@@ -808,12 +808,11 @@ struct {
enabled_core_ids[i]);
ret = write_keys(write_type);
writer_done = 1;
- rte_eal_mp_wait_lcore();
if (ret < 0)
goto err;
for (i = 1; i <= rwc_core_cnt[n]; i++)
- if (lcore_config[i].ret < 0)
+ if (rte_eal_wait_lcore(i) < 0)
goto err;
unsigned long long cycles_per_lookup =
@@ -830,6 +829,7 @@ struct {
return 0;
err:
+ rte_eal_mp_wait_lcore();
rte_hash_free(tbl_rwc_test_param.h);
return -1;
}
@@ -884,12 +884,11 @@ struct {
write_type = WRITE_KEY_SHIFT;
ret = write_keys(write_type);
writer_done = 1;
- rte_eal_mp_wait_lcore();
if (ret < 0)
goto err;
for (i = 1; i <= rwc_core_cnt[n]; i++)
- if (lcore_config[i].ret < 0)
+ if (rte_eal_wait_lcore(i) < 0)
goto err;
unsigned long long cycles_per_lookup =
@@ -906,6 +905,7 @@ struct {
return 0;
err:
+ rte_eal_mp_wait_lcore();
rte_hash_free(tbl_rwc_test_param.h);
return -1;
}
@@ -960,12 +960,11 @@ struct {
write_type = WRITE_KEY_SHIFT;
ret = write_keys(write_type);
writer_done = 1;
- rte_eal_mp_wait_lcore();
if (ret < 0)
goto err;
for (i = 1; i <= rwc_core_cnt[n]; i++)
- if (lcore_config[i].ret < 0)
+ if (rte_eal_wait_lcore(i) < 0)
goto err;
unsigned long long cycles_per_lookup =
@@ -982,6 +981,7 @@ struct {
return 0;
err:
+ rte_eal_mp_wait_lcore();
rte_hash_free(tbl_rwc_test_param.h);
return -1;
}
@@ -1035,12 +1035,11 @@ struct {
write_type = WRITE_KEY_SHIFT;
ret = write_keys(write_type);
writer_done = 1;
- rte_eal_mp_wait_lcore();
if (ret < 0)
goto err;
for (i = 1; i <= rwc_core_cnt[n]; i++)
- if (lcore_config[i].ret < 0)
+ if (rte_eal_wait_lcore(i) < 0)
goto err;
unsigned long long cycles_per_lookup =
@@ -1056,6 +1055,7 @@ struct {
return 0;
err:
+ rte_eal_mp_wait_lcore();
rte_hash_free(tbl_rwc_test_param.h);
return -1;
}
@@ -1138,10 +1138,8 @@ struct {
(multi_writer_done[i] == 0);
writer_done = 1;
- rte_eal_mp_wait_lcore();
-
for (i = 1; i <= rwc_core_cnt[n]; i++)
- if (lcore_config[i].ret < 0)
+ if (rte_eal_wait_lcore(i) < 0)
goto err;
unsigned long long cycles_per_lookup =
@@ -1160,6 +1158,7 @@ struct {
return 0;
err:
+ rte_eal_mp_wait_lcore();
rte_hash_free(tbl_rwc_test_param.h);
return -1;
}
@@ -1222,10 +1221,9 @@ struct {
}
}
writer_done = 1;
- rte_eal_mp_wait_lcore();
for (i = 1; i <= rwc_core_cnt[n]; i++)
- if (lcore_config[i].ret < 0)
+ if (rte_eal_wait_lcore(i) < 0)
goto err;
unsigned long long cycles_per_lookup =
@@ -1242,6 +1240,7 @@ struct {
return 0;
err:
+ rte_eal_mp_wait_lcore();
rte_hash_free(tbl_rwc_test_param.h);
return -1;
}