* [dpdk-dev] [PATCH 1/3] test/hash: reset global variable to discard old data
@ 2019-06-27 3:24 Honnappa Nagarahalli
2019-06-27 3:24 ` [dpdk-dev] [PATCH 2/3] test/hash: free allocated memory Honnappa Nagarahalli
` (3 more replies)
0 siblings, 4 replies; 17+ messages in thread
From: Honnappa Nagarahalli @ 2019-06-27 3:24 UTC (permalink / raw)
To: yipeng1.wang, sameh.gobriel, bruce.richardson,
pablo.de.lara.guarch, honnappa.nagarahalli
Cc: dharmik.thakkar, dev, nd, stable
Reset tbl_rwc_test_param to discard data from previous run
of the test.
Fixes: c7eb0972e74b ("test/hash: add lock-free r/w concurrency")
Cc: stable@dpdk.org
Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
---
app/test/test_hash_readwrite_lf.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/app/test/test_hash_readwrite_lf.c b/app/test/test_hash_readwrite_lf.c
index 343a338b4..e9aca6ff4 100644
--- a/app/test/test_hash_readwrite_lf.c
+++ b/app/test/test_hash_readwrite_lf.c
@@ -1264,6 +1264,9 @@ test_hash_readwrite_lf_main(void)
setlocale(LC_NUMERIC, "");
+ /* Reset tbl_rwc_test_param to discard values from previous run */
+ memset(&tbl_rwc_test_param, 0, sizeof(tbl_rwc_test_param));
+
if (rte_tm_supported())
htm = 1;
else
--
2.17.1
^ permalink raw reply related [flat|nested] 17+ messages in thread* [dpdk-dev] [PATCH 2/3] test/hash: free allocated memory 2019-06-27 3:24 [dpdk-dev] [PATCH 1/3] test/hash: reset global variable to discard old data Honnappa Nagarahalli @ 2019-06-27 3:24 ` Honnappa Nagarahalli 2019-06-27 8:07 ` [dpdk-dev] [dpdk-stable] " David Marchand 2019-06-27 3:24 ` [dpdk-dev] [PATCH 3/3] test/hash: init hash parameters in the correct function Honnappa Nagarahalli ` (2 subsequent siblings) 3 siblings, 1 reply; 17+ messages in thread From: Honnappa Nagarahalli @ 2019-06-27 3:24 UTC (permalink / raw) To: yipeng1.wang, sameh.gobriel, bruce.richardson, pablo.de.lara.guarch, honnappa.nagarahalli Cc: dharmik.thakkar, dev, nd, stable Free allocated memory. Fixes: 3f9aab961ed3 ("test/hash: check lock-free extendable bucket") Cc: stable@dpdk.org Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Reviewed-by: Dharmik Thakkar <dharmik.thakkar@arm.com> --- app/test/test_hash_readwrite_lf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/test/test_hash_readwrite_lf.c b/app/test/test_hash_readwrite_lf.c index e9aca6ff4..e92d1065b 100644 --- a/app/test/test_hash_readwrite_lf.c +++ b/app/test/test_hash_readwrite_lf.c @@ -1431,6 +1431,8 @@ test_hash_readwrite_lf_main(void) rte_free(tbl_rwc_test_param.keys_ks); rte_free(tbl_rwc_test_param.keys_absent); rte_free(tbl_rwc_test_param.keys_shift_path); + rte_free(tbl_rwc_test_param.keys_ext_bkt); + rte_free(tbl_rwc_test_param.keys_ks_extbkt); rte_free(scanned_bkts); return 0; } -- 2.17.1 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [dpdk-dev] [dpdk-stable] [PATCH 2/3] test/hash: free allocated memory 2019-06-27 3:24 ` [dpdk-dev] [PATCH 2/3] test/hash: free allocated memory Honnappa Nagarahalli @ 2019-06-27 8:07 ` David Marchand 2019-06-28 4:59 ` Honnappa Nagarahalli 0 siblings, 1 reply; 17+ messages in thread From: David Marchand @ 2019-06-27 8:07 UTC (permalink / raw) To: Honnappa Nagarahalli Cc: Wang, Yipeng1, Gobriel, Sameh, Bruce Richardson, Pablo de Lara, Dharmik Thakkar, dev, nd, dpdk stable On Thu, Jun 27, 2019 at 5:25 AM Honnappa Nagarahalli < honnappa.nagarahalli@arm.com> wrote: > Free allocated memory. > > Fixes: 3f9aab961ed3 ("test/hash: check lock-free extendable bucket") > Cc: stable@dpdk.org > > Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> > Reviewed-by: Dharmik Thakkar <dharmik.thakkar@arm.com> > --- > app/test/test_hash_readwrite_lf.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/app/test/test_hash_readwrite_lf.c > b/app/test/test_hash_readwrite_lf.c > index e9aca6ff4..e92d1065b 100644 > --- a/app/test/test_hash_readwrite_lf.c > +++ b/app/test/test_hash_readwrite_lf.c > @@ -1431,6 +1431,8 @@ test_hash_readwrite_lf_main(void) > rte_free(tbl_rwc_test_param.keys_ks); > rte_free(tbl_rwc_test_param.keys_absent); > rte_free(tbl_rwc_test_param.keys_shift_path); > + rte_free(tbl_rwc_test_param.keys_ext_bkt); > + rte_free(tbl_rwc_test_param.keys_ks_extbkt); > rte_free(scanned_bkts); > return 0; > } > -- > 2.17.1 > I inspected this test a little more, I can see other leaks. - generate_keys(), on error, we are leaking tbl_rwc_test_param.h. - test_rwc_reader(), we are leaking pos. - test_hash_readwrite_lf_main(), we are leaking tbl_rwc_test_param.keys_non_shift_path Looking at your patch 1, I would prefer you reset tbl_rwc_test_param field per field to NULL once the rte_free() is called. It would then be easier for you to track the remaining leaks (and patch 1 disappears). -- David Marchand ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [dpdk-dev] [dpdk-stable] [PATCH 2/3] test/hash: free allocated memory 2019-06-27 8:07 ` [dpdk-dev] [dpdk-stable] " David Marchand @ 2019-06-28 4:59 ` Honnappa Nagarahalli 2019-06-28 8:36 ` David Marchand 0 siblings, 1 reply; 17+ messages in thread From: Honnappa Nagarahalli @ 2019-06-28 4:59 UTC (permalink / raw) To: David Marchand Cc: Wang, Yipeng1, Gobriel, Sameh, Bruce Richardson, Pablo de Lara, Dharmik Thakkar, Honnappa Nagarahalli, dev, nd, dpdk stable, nd On Thu, Jun 27, 2019 at 5:25 AM Honnappa Nagarahalli <honnappa.nagarahalli@arm.com<mailto:honnappa.nagarahalli@arm.com>> wrote: Free allocated memory. Fixes: 3f9aab961ed3 ("test/hash: check lock-free extendable bucket") Cc: stable@dpdk.org<mailto:stable@dpdk.org> Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com<mailto:honnappa.nagarahalli@arm.com>> Reviewed-by: Dharmik Thakkar <dharmik.thakkar@arm.com<mailto:dharmik.thakkar@arm.com>> --- app/test/test_hash_readwrite_lf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/test/test_hash_readwrite_lf.c b/app/test/test_hash_readwrite_lf.c index e9aca6ff4..e92d1065b 100644 --- a/app/test/test_hash_readwrite_lf.c +++ b/app/test/test_hash_readwrite_lf.c @@ -1431,6 +1431,8 @@ test_hash_readwrite_lf_main(void) rte_free(tbl_rwc_test_param.keys_ks); rte_free(tbl_rwc_test_param.keys_absent); rte_free(tbl_rwc_test_param.keys_shift_path); + rte_free(tbl_rwc_test_param.keys_ext_bkt); + rte_free(tbl_rwc_test_param.keys_ks_extbkt); rte_free(scanned_bkts); return 0; } -- 2.17.1 I inspected this test a little more, I can see other leaks. - generate_keys(), on error, we are leaking tbl_rwc_test_param.h. - test_rwc_reader(), we are leaking pos. - test_hash_readwrite_lf_main(), we are leaking tbl_rwc_test_param.keys_non_shift_path [Honnappa] Thanks for the review. I fixed these and few more in V2. Looking at your patch 1, I would prefer you reset tbl_rwc_test_param field per field to NULL once the rte_free() is called. It would then be easier for you to track the remaining leaks (and patch 1 disappears). [Honnappa] This can be considered as initialization code. I have left this as it is. -- David Marchand ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [dpdk-dev] [dpdk-stable] [PATCH 2/3] test/hash: free allocated memory 2019-06-28 4:59 ` Honnappa Nagarahalli @ 2019-06-28 8:36 ` David Marchand 0 siblings, 0 replies; 17+ messages in thread From: David Marchand @ 2019-06-28 8:36 UTC (permalink / raw) To: Honnappa Nagarahalli Cc: Wang, Yipeng1, Gobriel, Sameh, Bruce Richardson, Pablo de Lara, Dharmik Thakkar, dev, nd, dpdk stable On Fri, Jun 28, 2019 at 6:59 AM Honnappa Nagarahalli < Honnappa.Nagarahalli@arm.com> wrote: > > On Thu, Jun 27, 2019 at 5:25 AM Honnappa Nagarahalli < > honnappa.nagarahalli@arm.com<mailto:honnappa.nagarahalli@arm.com>> wrote: > Free allocated memory. > > Fixes: 3f9aab961ed3 ("test/hash: check lock-free extendable bucket") > Cc: stable@dpdk.org<mailto:stable@dpdk.org> > > Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com<mailto: > honnappa.nagarahalli@arm.com>> > Reviewed-by: Dharmik Thakkar <dharmik.thakkar@arm.com<mailto: > dharmik.thakkar@arm.com>> > --- > app/test/test_hash_readwrite_lf.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/app/test/test_hash_readwrite_lf.c > b/app/test/test_hash_readwrite_lf.c > index e9aca6ff4..e92d1065b 100644 > --- a/app/test/test_hash_readwrite_lf.c > +++ b/app/test/test_hash_readwrite_lf.c > @@ -1431,6 +1431,8 @@ test_hash_readwrite_lf_main(void) > rte_free(tbl_rwc_test_param.keys_ks); > rte_free(tbl_rwc_test_param.keys_absent); > rte_free(tbl_rwc_test_param.keys_shift_path); > + rte_free(tbl_rwc_test_param.keys_ext_bkt); > + rte_free(tbl_rwc_test_param.keys_ks_extbkt); > rte_free(scanned_bkts); > return 0; > } > -- > 2.17.1 > > > I inspected this test a little more, I can see other leaks. > - generate_keys(), on error, we are leaking tbl_rwc_test_param.h. > - test_rwc_reader(), we are leaking pos. > - test_hash_readwrite_lf_main(), we are leaking > tbl_rwc_test_param.keys_non_shift_path > [Honnappa] Thanks for the review. I fixed these and few more in V2. > Still missed pos in some err path. Comment incoming. > Looking at your patch 1, I would prefer you reset tbl_rwc_test_param field > per field to NULL once the rte_free() is called. > It would then be easier for you to track the remaining leaks (and patch 1 > disappears). > [Honnappa] This can be considered as initialization code. I have left this > as it is. > Ok, I won't insist. -- David Marchand ^ permalink raw reply [flat|nested] 17+ messages in thread
* [dpdk-dev] [PATCH 3/3] test/hash: init hash parameters in the correct function 2019-06-27 3:24 [dpdk-dev] [PATCH 1/3] test/hash: reset global variable to discard old data Honnappa Nagarahalli 2019-06-27 3:24 ` [dpdk-dev] [PATCH 2/3] test/hash: free allocated memory Honnappa Nagarahalli @ 2019-06-27 3:24 ` Honnappa Nagarahalli 2019-06-27 8:07 ` [dpdk-dev] [dpdk-stable] " David Marchand 2019-06-28 4:52 ` [dpdk-dev] [PATCH v2 1/3] test/hash: reset global variable to discard old data Honnappa Nagarahalli 2019-07-02 0:27 ` [dpdk-dev] [PATCH v3 1/4] test/hash: reset global variable to discard old data Honnappa Nagarahalli 3 siblings, 1 reply; 17+ messages in thread From: Honnappa Nagarahalli @ 2019-06-27 3:24 UTC (permalink / raw) To: yipeng1.wang, sameh.gobriel, bruce.richardson, pablo.de.lara.guarch, honnappa.nagarahalli Cc: dharmik.thakkar, dev, nd, stable Each test case initializes its hash parameters in the test case function. To be consistent, generate keys function should initialize hash parameters similarly. Fixes: c7eb0972e74b ("test/hash: add lock-free r/w concurrency") Cc: stable@dpdk.org Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Reviewed-by: Dharmik Thakkar <dharmik.thakkar@arm.com> --- app/test/test_hash_readwrite_lf.c | 98 +++++++++++++++---------------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/app/test/test_hash_readwrite_lf.c b/app/test/test_hash_readwrite_lf.c index e92d1065b..efabb60ef 100644 --- a/app/test/test_hash_readwrite_lf.c +++ b/app/test/test_hash_readwrite_lf.c @@ -141,6 +141,52 @@ get_enabled_cores_list(void) return 0; } +static int +init_params(int rwc_lf, int use_jhash, int htm, int ext_bkt) +{ + struct rte_hash *handle; + + struct rte_hash_parameters hash_params = { + .entries = TOTAL_ENTRY, + .key_len = sizeof(uint32_t), + .hash_func_init_val = 0, + .socket_id = rte_socket_id(), + }; + + if (use_jhash) + hash_params.hash_func = rte_jhash; + else + hash_params.hash_func = rte_hash_crc; + + if (rwc_lf) + hash_params.extra_flag = + RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF | + RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; + else if (htm) + hash_params.extra_flag = + RTE_HASH_EXTRA_FLAGS_TRANS_MEM_SUPPORT | + RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY | + RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; + else + hash_params.extra_flag = + RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY | + RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; + + if (ext_bkt) + hash_params.extra_flag |= RTE_HASH_EXTRA_FLAGS_EXT_TABLE; + + hash_params.name = "tests"; + + handle = rte_hash_create(&hash_params); + if (handle == NULL) { + printf("hash creation failed"); + return -1; + } + + tbl_rwc_test_param.h = handle; + return 0; +} + static inline int check_bucket(uint32_t bkt_idx, uint32_t key) { @@ -215,6 +261,9 @@ generate_keys(void) uint32_t count_keys_extbkt = 0; uint32_t i; + if (init_params(0, 0, 0, 0) != 0) + return -1; + /* * keys will consist of a) keys whose addition to the hash table * will result in shifting of the existing keys to their alternate @@ -504,52 +553,6 @@ generate_keys(void) return -1; } -static int -init_params(int rwc_lf, int use_jhash, int htm, int ext_bkt) -{ - struct rte_hash *handle; - - struct rte_hash_parameters hash_params = { - .entries = TOTAL_ENTRY, - .key_len = sizeof(uint32_t), - .hash_func_init_val = 0, - .socket_id = rte_socket_id(), - }; - - if (use_jhash) - hash_params.hash_func = rte_jhash; - else - hash_params.hash_func = rte_hash_crc; - - if (rwc_lf) - hash_params.extra_flag = - RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF | - RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; - else if (htm) - hash_params.extra_flag = - RTE_HASH_EXTRA_FLAGS_TRANS_MEM_SUPPORT | - RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY | - RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; - else - hash_params.extra_flag = - RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY | - RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; - - if (ext_bkt) - hash_params.extra_flag |= RTE_HASH_EXTRA_FLAGS_EXT_TABLE; - - hash_params.name = "tests"; - - handle = rte_hash_create(&hash_params); - if (handle == NULL) { - printf("hash creation failed"); - return -1; - } - - tbl_rwc_test_param.h = handle; - return 0; -} - static int test_rwc_reader(__attribute__((unused)) void *arg) { @@ -1254,7 +1257,6 @@ test_hash_readwrite_lf_main(void) */ int rwc_lf = 0; int htm; - int use_jhash = 0; int ext_bkt = 0; if (rte_lcore_count() == 1) { printf("More than one lcore is required " @@ -1272,8 +1274,6 @@ test_hash_readwrite_lf_main(void) else htm = 0; - if (init_params(rwc_lf, use_jhash, htm, ext_bkt) != 0) - return -1; if (generate_keys() != 0) return -1; if (get_enabled_cores_list() != 0) -- 2.17.1 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [dpdk-dev] [dpdk-stable] [PATCH 3/3] test/hash: init hash parameters in the correct function 2019-06-27 3:24 ` [dpdk-dev] [PATCH 3/3] test/hash: init hash parameters in the correct function Honnappa Nagarahalli @ 2019-06-27 8:07 ` David Marchand 2019-06-28 4:55 ` Honnappa Nagarahalli 0 siblings, 1 reply; 17+ messages in thread From: David Marchand @ 2019-06-27 8:07 UTC (permalink / raw) To: Honnappa Nagarahalli Cc: Wang, Yipeng1, Gobriel, Sameh, Bruce Richardson, Pablo de Lara, Dharmik Thakkar, dev, nd, dpdk stable On Thu, Jun 27, 2019 at 5:25 AM Honnappa Nagarahalli < honnappa.nagarahalli@arm.com> wrote: > Each test case initializes its hash parameters in the test case > function. To be consistent, generate keys function should initialize > hash parameters similarly. > > Fixes: c7eb0972e74b ("test/hash: add lock-free r/w concurrency") > Cc: stable@dpdk.org > > Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> > Reviewed-by: Dharmik Thakkar <dharmik.thakkar@arm.com> > --- > app/test/test_hash_readwrite_lf.c | 98 +++++++++++++++---------------- > 1 file changed, 49 insertions(+), 49 deletions(-) > > diff --git a/app/test/test_hash_readwrite_lf.c > b/app/test/test_hash_readwrite_lf.c > index e92d1065b..efabb60ef 100644 > --- a/app/test/test_hash_readwrite_lf.c > +++ b/app/test/test_hash_readwrite_lf.c > @@ -141,6 +141,52 @@ get_enabled_cores_list(void) > return 0; > } > > +static int > +init_params(int rwc_lf, int use_jhash, int htm, int ext_bkt) > +{ > + struct rte_hash *handle; > + > + struct rte_hash_parameters hash_params = { > + .entries = TOTAL_ENTRY, > + .key_len = sizeof(uint32_t), > + .hash_func_init_val = 0, > + .socket_id = rte_socket_id(), > + }; > + > + if (use_jhash) > + hash_params.hash_func = rte_jhash; > + else > + hash_params.hash_func = rte_hash_crc; > + > + if (rwc_lf) > + hash_params.extra_flag = > + RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF | > + RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; > + else if (htm) > + hash_params.extra_flag = > + RTE_HASH_EXTRA_FLAGS_TRANS_MEM_SUPPORT | > + RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY | > + RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; > + else > + hash_params.extra_flag = > + RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY | > + RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; > + > + if (ext_bkt) > + hash_params.extra_flag |= RTE_HASH_EXTRA_FLAGS_EXT_TABLE; > + > + hash_params.name = "tests"; > + > + handle = rte_hash_create(&hash_params); > + if (handle == NULL) { > + printf("hash creation failed"); > + return -1; > + } > + > + tbl_rwc_test_param.h = handle; > + return 0; > +} > + > static inline int > check_bucket(uint32_t bkt_idx, uint32_t key) > { > @@ -215,6 +261,9 @@ generate_keys(void) > uint32_t count_keys_extbkt = 0; > uint32_t i; > > + if (init_params(0, 0, 0, 0) != 0) > + return -1; > + > /* > * keys will consist of a) keys whose addition to the hash table > * will result in shifting of the existing keys to their alternate > @@ -504,52 +553,6 @@ generate_keys(void) > return -1; > } > > -static int > -init_params(int rwc_lf, int use_jhash, int htm, int ext_bkt) > -{ > - struct rte_hash *handle; > - > - struct rte_hash_parameters hash_params = { > - .entries = TOTAL_ENTRY, > - .key_len = sizeof(uint32_t), > - .hash_func_init_val = 0, > - .socket_id = rte_socket_id(), > - }; > - > - if (use_jhash) > - hash_params.hash_func = rte_jhash; > - else > - hash_params.hash_func = rte_hash_crc; > - > - if (rwc_lf) > - hash_params.extra_flag = > - RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF | > - RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; > - else if (htm) > - hash_params.extra_flag = > - RTE_HASH_EXTRA_FLAGS_TRANS_MEM_SUPPORT | > - RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY | > - RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; > - else > - hash_params.extra_flag = > - RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY | > - RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; > - > - if (ext_bkt) > - hash_params.extra_flag |= RTE_HASH_EXTRA_FLAGS_EXT_TABLE; > - > - hash_params.name = "tests"; > - > - handle = rte_hash_create(&hash_params); > - if (handle == NULL) { > - printf("hash creation failed"); > - return -1; > - } > - > - tbl_rwc_test_param.h = handle; > - return 0; > -} > - > static int > test_rwc_reader(__attribute__((unused)) void *arg) > { > @@ -1254,7 +1257,6 @@ test_hash_readwrite_lf_main(void) > */ > int rwc_lf = 0; > int htm; > - int use_jhash = 0; > int ext_bkt = 0; > if (rte_lcore_count() == 1) { > printf("More than one lcore is required " > @@ -1272,8 +1274,6 @@ test_hash_readwrite_lf_main(void) > else > htm = 0; > > - if (init_params(rwc_lf, use_jhash, htm, ext_bkt) != 0) > - return -1; > if (generate_keys() != 0) > return -1; > if (get_enabled_cores_list() != 0) > -- > 2.17.1 > > This patch impacts the memory allocations, it should be placed before patch 2. -- David Marchand ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [dpdk-dev] [dpdk-stable] [PATCH 3/3] test/hash: init hash parameters in the correct function 2019-06-27 8:07 ` [dpdk-dev] [dpdk-stable] " David Marchand @ 2019-06-28 4:55 ` Honnappa Nagarahalli 0 siblings, 0 replies; 17+ messages in thread From: Honnappa Nagarahalli @ 2019-06-28 4:55 UTC (permalink / raw) To: David Marchand Cc: Wang, Yipeng1, Gobriel, Sameh, Bruce Richardson, Pablo de Lara, Dharmik Thakkar, Honnappa Nagarahalli, dev, nd, dpdk stable, nd <snip> static int test_rwc_reader(__attribute__((unused)) void *arg) { @@ -1254,7 +1257,6 @@ test_hash_readwrite_lf_main(void) */ int rwc_lf = 0; int htm; - int use_jhash = 0; int ext_bkt = 0; if (rte_lcore_count() == 1) { printf("More than one lcore is required " @@ -1272,8 +1274,6 @@ test_hash_readwrite_lf_main(void) else htm = 0; - if (init_params(rwc_lf, use_jhash, htm, ext_bkt) != 0) - return -1; if (generate_keys() != 0) return -1; if (get_enabled_cores_list() != 0) -- 2.17.1 This patch impacts the memory allocations, it should be placed before patch 2. [Honnappa] Done in V2 -- David Marchand ^ permalink raw reply [flat|nested] 17+ messages in thread
* [dpdk-dev] [PATCH v2 1/3] test/hash: reset global variable to discard old data 2019-06-27 3:24 [dpdk-dev] [PATCH 1/3] test/hash: reset global variable to discard old data Honnappa Nagarahalli 2019-06-27 3:24 ` [dpdk-dev] [PATCH 2/3] test/hash: free allocated memory Honnappa Nagarahalli 2019-06-27 3:24 ` [dpdk-dev] [PATCH 3/3] test/hash: init hash parameters in the correct function Honnappa Nagarahalli @ 2019-06-28 4:52 ` Honnappa Nagarahalli 2019-06-28 4:52 ` [dpdk-dev] [PATCH v2 2/3] test/hash: init hash parameters in the correct function Honnappa Nagarahalli 2019-06-28 4:52 ` [dpdk-dev] [PATCH v2 3/3] test/hash: free allocated memory Honnappa Nagarahalli 2019-07-02 0:27 ` [dpdk-dev] [PATCH v3 1/4] test/hash: reset global variable to discard old data Honnappa Nagarahalli 3 siblings, 2 replies; 17+ messages in thread From: Honnappa Nagarahalli @ 2019-06-28 4:52 UTC (permalink / raw) To: yipeng1.wang, sameh.gobriel, bruce.richardson, pablo.de.lara.guarch, david.marchand, honnappa.nagarahalli Cc: dharmik.thakkar, dev, nd, stable Reset tbl_rwc_test_param to discard data from previous run of the test. Fixes: c7eb0972e74b ("test/hash: add lock-free r/w concurrency") Cc: stable@dpdk.org Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Reviewed-by: Dharmik Thakkar <dharmik.thakkar@arm.com> --- app/test/test_hash_readwrite_lf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/test/test_hash_readwrite_lf.c b/app/test/test_hash_readwrite_lf.c index 343a338b4..e9aca6ff4 100644 --- a/app/test/test_hash_readwrite_lf.c +++ b/app/test/test_hash_readwrite_lf.c @@ -1264,6 +1264,9 @@ test_hash_readwrite_lf_main(void) setlocale(LC_NUMERIC, ""); + /* Reset tbl_rwc_test_param to discard values from previous run */ + memset(&tbl_rwc_test_param, 0, sizeof(tbl_rwc_test_param)); + if (rte_tm_supported()) htm = 1; else -- 2.17.1 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [dpdk-dev] [PATCH v2 2/3] test/hash: init hash parameters in the correct function 2019-06-28 4:52 ` [dpdk-dev] [PATCH v2 1/3] test/hash: reset global variable to discard old data Honnappa Nagarahalli @ 2019-06-28 4:52 ` Honnappa Nagarahalli 2019-06-28 4:52 ` [dpdk-dev] [PATCH v2 3/3] test/hash: free allocated memory Honnappa Nagarahalli 1 sibling, 0 replies; 17+ messages in thread From: Honnappa Nagarahalli @ 2019-06-28 4:52 UTC (permalink / raw) To: yipeng1.wang, sameh.gobriel, bruce.richardson, pablo.de.lara.guarch, david.marchand, honnappa.nagarahalli Cc: dharmik.thakkar, dev, nd, stable Each test case initializes its hash parameters in the test case function. To be consistent, generate keys function should initialize hash parameters similarly. Fixes: c7eb0972e74b ("test/hash: add lock-free r/w concurrency") Cc: stable@dpdk.org Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Reviewed-by: Dharmik Thakkar <dharmik.thakkar@arm.com> --- app/test/test_hash_readwrite_lf.c | 98 +++++++++++++++---------------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/app/test/test_hash_readwrite_lf.c b/app/test/test_hash_readwrite_lf.c index e9aca6ff4..12522e265 100644 --- a/app/test/test_hash_readwrite_lf.c +++ b/app/test/test_hash_readwrite_lf.c @@ -141,6 +141,52 @@ get_enabled_cores_list(void) return 0; } +static int +init_params(int rwc_lf, int use_jhash, int htm, int ext_bkt) +{ + struct rte_hash *handle; + + struct rte_hash_parameters hash_params = { + .entries = TOTAL_ENTRY, + .key_len = sizeof(uint32_t), + .hash_func_init_val = 0, + .socket_id = rte_socket_id(), + }; + + if (use_jhash) + hash_params.hash_func = rte_jhash; + else + hash_params.hash_func = rte_hash_crc; + + if (rwc_lf) + hash_params.extra_flag = + RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF | + RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; + else if (htm) + hash_params.extra_flag = + RTE_HASH_EXTRA_FLAGS_TRANS_MEM_SUPPORT | + RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY | + RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; + else + hash_params.extra_flag = + RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY | + RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; + + if (ext_bkt) + hash_params.extra_flag |= RTE_HASH_EXTRA_FLAGS_EXT_TABLE; + + hash_params.name = "tests"; + + handle = rte_hash_create(&hash_params); + if (handle == NULL) { + printf("hash creation failed"); + return -1; + } + + tbl_rwc_test_param.h = handle; + return 0; +} + static inline int check_bucket(uint32_t bkt_idx, uint32_t key) { @@ -215,6 +261,9 @@ generate_keys(void) uint32_t count_keys_extbkt = 0; uint32_t i; + if (init_params(0, 0, 0, 0) != 0) + return -1; + /* * keys will consist of a) keys whose addition to the hash table * will result in shifting of the existing keys to their alternate @@ -504,52 +553,6 @@ generate_keys(void) return -1; } -static int -init_params(int rwc_lf, int use_jhash, int htm, int ext_bkt) -{ - struct rte_hash *handle; - - struct rte_hash_parameters hash_params = { - .entries = TOTAL_ENTRY, - .key_len = sizeof(uint32_t), - .hash_func_init_val = 0, - .socket_id = rte_socket_id(), - }; - - if (use_jhash) - hash_params.hash_func = rte_jhash; - else - hash_params.hash_func = rte_hash_crc; - - if (rwc_lf) - hash_params.extra_flag = - RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF | - RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; - else if (htm) - hash_params.extra_flag = - RTE_HASH_EXTRA_FLAGS_TRANS_MEM_SUPPORT | - RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY | - RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; - else - hash_params.extra_flag = - RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY | - RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; - - if (ext_bkt) - hash_params.extra_flag |= RTE_HASH_EXTRA_FLAGS_EXT_TABLE; - - hash_params.name = "tests"; - - handle = rte_hash_create(&hash_params); - if (handle == NULL) { - printf("hash creation failed"); - return -1; - } - - tbl_rwc_test_param.h = handle; - return 0; -} - static int test_rwc_reader(__attribute__((unused)) void *arg) { @@ -1254,7 +1257,6 @@ test_hash_readwrite_lf_main(void) */ int rwc_lf = 0; int htm; - int use_jhash = 0; int ext_bkt = 0; if (rte_lcore_count() == 1) { printf("More than one lcore is required " @@ -1272,8 +1274,6 @@ test_hash_readwrite_lf_main(void) else htm = 0; - if (init_params(rwc_lf, use_jhash, htm, ext_bkt) != 0) - return -1; if (generate_keys() != 0) return -1; if (get_enabled_cores_list() != 0) -- 2.17.1 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [dpdk-dev] [PATCH v2 3/3] test/hash: free allocated memory 2019-06-28 4:52 ` [dpdk-dev] [PATCH v2 1/3] test/hash: reset global variable to discard old data Honnappa Nagarahalli 2019-06-28 4:52 ` [dpdk-dev] [PATCH v2 2/3] test/hash: init hash parameters in the correct function Honnappa Nagarahalli @ 2019-06-28 4:52 ` Honnappa Nagarahalli 2019-06-28 8:38 ` [dpdk-dev] [dpdk-stable] " David Marchand 1 sibling, 1 reply; 17+ messages in thread From: Honnappa Nagarahalli @ 2019-06-28 4:52 UTC (permalink / raw) To: yipeng1.wang, sameh.gobriel, bruce.richardson, pablo.de.lara.guarch, david.marchand, honnappa.nagarahalli Cc: dharmik.thakkar, dev, nd, stable Free allocated memory. Fixes: 3f9aab961ed3 ("test/hash: check lock-free extendable bucket") Cc: stable@dpdk.org Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Reviewed-by: Dharmik Thakkar <dharmik.thakkar@arm.com> --- app/test/test_hash_readwrite_lf.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/test/test_hash_readwrite_lf.c b/app/test/test_hash_readwrite_lf.c index 12522e265..9b054dec0 100644 --- a/app/test/test_hash_readwrite_lf.c +++ b/app/test/test_hash_readwrite_lf.c @@ -537,6 +537,7 @@ generate_keys(void) tbl_rwc_test_param.count_keys_ks_extbkt); rte_free(found); + rte_free(scanned_bkts); rte_hash_free(tbl_rwc_test_param.h); return 0; @@ -547,9 +548,11 @@ generate_keys(void) rte_free(keys_absent); rte_free(found); rte_free(tbl_rwc_test_param.keys_shift_path); + rte_free(keys_non_shift_path); rte_free(keys_ext_bkt); rte_free(keys_ks_extbkt); rte_free(scanned_bkts); + rte_hash_free(tbl_rwc_test_param.h); return -1; } @@ -653,6 +656,8 @@ test_rwc_reader(__attribute__((unused)) void *arg) cycles = rte_rdtsc_precise() - begin; rte_atomic64_add(&gread_cycles, cycles); rte_atomic64_add(&greads, read_cnt*loop_cnt); + + rte_free(pos); return 0; } @@ -1431,7 +1436,9 @@ test_hash_readwrite_lf_main(void) rte_free(tbl_rwc_test_param.keys_ks); rte_free(tbl_rwc_test_param.keys_absent); rte_free(tbl_rwc_test_param.keys_shift_path); - rte_free(scanned_bkts); + rte_free(tbl_rwc_test_param.keys_non_shift_path); + rte_free(tbl_rwc_test_param.keys_ext_bkt); + rte_free(tbl_rwc_test_param.keys_ks_extbkt); return 0; } -- 2.17.1 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [dpdk-dev] [dpdk-stable] [PATCH v2 3/3] test/hash: free allocated memory 2019-06-28 4:52 ` [dpdk-dev] [PATCH v2 3/3] test/hash: free allocated memory Honnappa Nagarahalli @ 2019-06-28 8:38 ` David Marchand 0 siblings, 0 replies; 17+ messages in thread From: David Marchand @ 2019-06-28 8:38 UTC (permalink / raw) To: Honnappa Nagarahalli Cc: Wang, Yipeng1, Gobriel, Sameh, Bruce Richardson, Pablo de Lara, Dharmik Thakkar, dev, nd, dpdk stable On Fri, Jun 28, 2019 at 6:53 AM Honnappa Nagarahalli < honnappa.nagarahalli@arm.com> wrote: > Free allocated memory. > > Fixes: 3f9aab961ed3 ("test/hash: check lock-free extendable bucket") > Cc: stable@dpdk.org > > Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> > Reviewed-by: Dharmik Thakkar <dharmik.thakkar@arm.com> > --- > app/test/test_hash_readwrite_lf.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/app/test/test_hash_readwrite_lf.c > b/app/test/test_hash_readwrite_lf.c > index 12522e265..9b054dec0 100644 > --- a/app/test/test_hash_readwrite_lf.c > +++ b/app/test/test_hash_readwrite_lf.c > > [snip] @@ -653,6 +656,8 @@ test_rwc_reader(__attribute__((unused)) void *arg) > cycles = rte_rdtsc_precise() - begin; > rte_atomic64_add(&gread_cycles, cycles); > rte_atomic64_add(&greads, read_cnt*loop_cnt); > + > + rte_free(pos); > return 0; > } > In this function, there are three other places returning -1 without freeing pos. -- David Marchand ^ permalink raw reply [flat|nested] 17+ messages in thread
* [dpdk-dev] [PATCH v3 1/4] test/hash: reset global variable to discard old data 2019-06-27 3:24 [dpdk-dev] [PATCH 1/3] test/hash: reset global variable to discard old data Honnappa Nagarahalli ` (2 preceding siblings ...) 2019-06-28 4:52 ` [dpdk-dev] [PATCH v2 1/3] test/hash: reset global variable to discard old data Honnappa Nagarahalli @ 2019-07-02 0:27 ` Honnappa Nagarahalli 2019-07-02 0:27 ` [dpdk-dev] [PATCH v3 2/4] test/hash: init hash parameters in the correct function Honnappa Nagarahalli ` (3 more replies) 3 siblings, 4 replies; 17+ messages in thread From: Honnappa Nagarahalli @ 2019-07-02 0:27 UTC (permalink / raw) To: yipeng1.wang, sameh.gobriel, bruce.richardson, pablo.de.lara.guarch, david.marchand, honnappa.nagarahalli Cc: dharmik.thakkar, dev, nd, stable Reset tbl_rwc_test_param to discard data from previous run of the test. Fixes: c7eb0972e74b ("test/hash: add lock-free r/w concurrency") Cc: stable@dpdk.org Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Reviewed-by: Dharmik Thakkar <dharmik.thakkar@arm.com> --- v3 - No changes V2 - No changes app/test/test_hash_readwrite_lf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/test/test_hash_readwrite_lf.c b/app/test/test_hash_readwrite_lf.c index 343a338b4..e9aca6ff4 100644 --- a/app/test/test_hash_readwrite_lf.c +++ b/app/test/test_hash_readwrite_lf.c @@ -1264,6 +1264,9 @@ test_hash_readwrite_lf_main(void) setlocale(LC_NUMERIC, ""); + /* Reset tbl_rwc_test_param to discard values from previous run */ + memset(&tbl_rwc_test_param, 0, sizeof(tbl_rwc_test_param)); + if (rte_tm_supported()) htm = 1; else -- 2.17.1 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [dpdk-dev] [PATCH v3 2/4] test/hash: init hash parameters in the correct function 2019-07-02 0:27 ` [dpdk-dev] [PATCH v3 1/4] test/hash: reset global variable to discard old data Honnappa Nagarahalli @ 2019-07-02 0:27 ` Honnappa Nagarahalli 2019-07-02 0:27 ` [dpdk-dev] [PATCH v3 3/4] test/hash: free allocated memory Honnappa Nagarahalli ` (2 subsequent siblings) 3 siblings, 0 replies; 17+ messages in thread From: Honnappa Nagarahalli @ 2019-07-02 0:27 UTC (permalink / raw) To: yipeng1.wang, sameh.gobriel, bruce.richardson, pablo.de.lara.guarch, david.marchand, honnappa.nagarahalli Cc: dharmik.thakkar, dev, nd, stable Each test case initializes its hash parameters in the test case function. To be consistent, generate keys function should initialize hash parameters similarly. Fixes: c7eb0972e74b ("test/hash: add lock-free r/w concurrency") Cc: stable@dpdk.org Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Reviewed-by: Dharmik Thakkar <dharmik.thakkar@arm.com> --- v3 - no changes v2 - changed the order of the patch app/test/test_hash_readwrite_lf.c | 98 +++++++++++++++---------------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/app/test/test_hash_readwrite_lf.c b/app/test/test_hash_readwrite_lf.c index e9aca6ff4..12522e265 100644 --- a/app/test/test_hash_readwrite_lf.c +++ b/app/test/test_hash_readwrite_lf.c @@ -141,6 +141,52 @@ get_enabled_cores_list(void) return 0; } +static int +init_params(int rwc_lf, int use_jhash, int htm, int ext_bkt) +{ + struct rte_hash *handle; + + struct rte_hash_parameters hash_params = { + .entries = TOTAL_ENTRY, + .key_len = sizeof(uint32_t), + .hash_func_init_val = 0, + .socket_id = rte_socket_id(), + }; + + if (use_jhash) + hash_params.hash_func = rte_jhash; + else + hash_params.hash_func = rte_hash_crc; + + if (rwc_lf) + hash_params.extra_flag = + RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF | + RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; + else if (htm) + hash_params.extra_flag = + RTE_HASH_EXTRA_FLAGS_TRANS_MEM_SUPPORT | + RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY | + RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; + else + hash_params.extra_flag = + RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY | + RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; + + if (ext_bkt) + hash_params.extra_flag |= RTE_HASH_EXTRA_FLAGS_EXT_TABLE; + + hash_params.name = "tests"; + + handle = rte_hash_create(&hash_params); + if (handle == NULL) { + printf("hash creation failed"); + return -1; + } + + tbl_rwc_test_param.h = handle; + return 0; +} + static inline int check_bucket(uint32_t bkt_idx, uint32_t key) { @@ -215,6 +261,9 @@ generate_keys(void) uint32_t count_keys_extbkt = 0; uint32_t i; + if (init_params(0, 0, 0, 0) != 0) + return -1; + /* * keys will consist of a) keys whose addition to the hash table * will result in shifting of the existing keys to their alternate @@ -504,52 +553,6 @@ generate_keys(void) return -1; } -static int -init_params(int rwc_lf, int use_jhash, int htm, int ext_bkt) -{ - struct rte_hash *handle; - - struct rte_hash_parameters hash_params = { - .entries = TOTAL_ENTRY, - .key_len = sizeof(uint32_t), - .hash_func_init_val = 0, - .socket_id = rte_socket_id(), - }; - - if (use_jhash) - hash_params.hash_func = rte_jhash; - else - hash_params.hash_func = rte_hash_crc; - - if (rwc_lf) - hash_params.extra_flag = - RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF | - RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; - else if (htm) - hash_params.extra_flag = - RTE_HASH_EXTRA_FLAGS_TRANS_MEM_SUPPORT | - RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY | - RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; - else - hash_params.extra_flag = - RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY | - RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; - - if (ext_bkt) - hash_params.extra_flag |= RTE_HASH_EXTRA_FLAGS_EXT_TABLE; - - hash_params.name = "tests"; - - handle = rte_hash_create(&hash_params); - if (handle == NULL) { - printf("hash creation failed"); - return -1; - } - - tbl_rwc_test_param.h = handle; - return 0; -} - static int test_rwc_reader(__attribute__((unused)) void *arg) { @@ -1254,7 +1257,6 @@ test_hash_readwrite_lf_main(void) */ int rwc_lf = 0; int htm; - int use_jhash = 0; int ext_bkt = 0; if (rte_lcore_count() == 1) { printf("More than one lcore is required " @@ -1272,8 +1274,6 @@ test_hash_readwrite_lf_main(void) else htm = 0; - if (init_params(rwc_lf, use_jhash, htm, ext_bkt) != 0) - return -1; if (generate_keys() != 0) return -1; if (get_enabled_cores_list() != 0) -- 2.17.1 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [dpdk-dev] [PATCH v3 3/4] test/hash: free allocated memory 2019-07-02 0:27 ` [dpdk-dev] [PATCH v3 1/4] test/hash: reset global variable to discard old data Honnappa Nagarahalli 2019-07-02 0:27 ` [dpdk-dev] [PATCH v3 2/4] test/hash: init hash parameters in the correct function Honnappa Nagarahalli @ 2019-07-02 0:27 ` Honnappa Nagarahalli 2019-07-02 0:27 ` [dpdk-dev] [PATCH v3 4/4] test/hash: use array for small amount of memory Honnappa Nagarahalli 2019-07-05 8:46 ` [dpdk-dev] [PATCH v3 1/4] test/hash: reset global variable to discard old data Thomas Monjalon 3 siblings, 0 replies; 17+ messages in thread From: Honnappa Nagarahalli @ 2019-07-02 0:27 UTC (permalink / raw) To: yipeng1.wang, sameh.gobriel, bruce.richardson, pablo.de.lara.guarch, david.marchand, honnappa.nagarahalli Cc: dharmik.thakkar, dev, nd, stable Free allocated memory. Fixes: 3f9aab961ed3 ("test/hash: check lock-free extendable bucket") Cc: stable@dpdk.org Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Reviewed-by: Dharmik Thakkar <dharmik.thakkar@arm.com> --- v3 - removed freeing pos (addressed in 4/4) v2 - freed more memory app/test/test_hash_readwrite_lf.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/test/test_hash_readwrite_lf.c b/app/test/test_hash_readwrite_lf.c index 12522e265..792244fd0 100644 --- a/app/test/test_hash_readwrite_lf.c +++ b/app/test/test_hash_readwrite_lf.c @@ -537,6 +537,7 @@ generate_keys(void) tbl_rwc_test_param.count_keys_ks_extbkt); rte_free(found); + rte_free(scanned_bkts); rte_hash_free(tbl_rwc_test_param.h); return 0; @@ -547,9 +548,11 @@ generate_keys(void) rte_free(keys_absent); rte_free(found); rte_free(tbl_rwc_test_param.keys_shift_path); + rte_free(keys_non_shift_path); rte_free(keys_ext_bkt); rte_free(keys_ks_extbkt); rte_free(scanned_bkts); + rte_hash_free(tbl_rwc_test_param.h); return -1; } @@ -1431,7 +1434,9 @@ test_hash_readwrite_lf_main(void) rte_free(tbl_rwc_test_param.keys_ks); rte_free(tbl_rwc_test_param.keys_absent); rte_free(tbl_rwc_test_param.keys_shift_path); - rte_free(scanned_bkts); + rte_free(tbl_rwc_test_param.keys_non_shift_path); + rte_free(tbl_rwc_test_param.keys_ext_bkt); + rte_free(tbl_rwc_test_param.keys_ks_extbkt); return 0; } -- 2.17.1 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [dpdk-dev] [PATCH v3 4/4] test/hash: use array for small amount of memory 2019-07-02 0:27 ` [dpdk-dev] [PATCH v3 1/4] test/hash: reset global variable to discard old data Honnappa Nagarahalli 2019-07-02 0:27 ` [dpdk-dev] [PATCH v3 2/4] test/hash: init hash parameters in the correct function Honnappa Nagarahalli 2019-07-02 0:27 ` [dpdk-dev] [PATCH v3 3/4] test/hash: free allocated memory Honnappa Nagarahalli @ 2019-07-02 0:27 ` Honnappa Nagarahalli 2019-07-05 8:46 ` [dpdk-dev] [PATCH v3 1/4] test/hash: reset global variable to discard old data Thomas Monjalon 3 siblings, 0 replies; 17+ messages in thread From: Honnappa Nagarahalli @ 2019-07-02 0:27 UTC (permalink / raw) To: yipeng1.wang, sameh.gobriel, bruce.richardson, pablo.de.lara.guarch, david.marchand, honnappa.nagarahalli Cc: dharmik.thakkar, dev, nd Variables of size 128B can make use of stack instead of dynamically allocated memory. Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> --- v3 - Allocated pos on stack as it is just 128B v2 - N/A app/test/test_hash_readwrite_lf.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/app/test/test_hash_readwrite_lf.c b/app/test/test_hash_readwrite_lf.c index 792244fd0..f0d6f42c1 100644 --- a/app/test/test_hash_readwrite_lf.c +++ b/app/test/test_hash_readwrite_lf.c @@ -567,16 +567,9 @@ test_rwc_reader(__attribute__((unused)) void *arg) uint32_t read_cnt; uint32_t *keys; uint32_t extra_keys; - int32_t *pos; + int32_t pos[BULK_LOOKUP_SIZE]; void *temp_a[BULK_LOOKUP_SIZE]; - /* Used to identify keys not inserted in the hash table */ - pos = rte_malloc(NULL, sizeof(uint32_t) * BULK_LOOKUP_SIZE, 0); - if (pos == NULL) { - printf("RTE_MALLOC failed\n"); - return -1; - } - if (read_type & READ_FAIL) { keys = tbl_rwc_test_param.keys_absent; read_cnt = tbl_rwc_test_param.count_keys_absent; -- 2.17.1 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [dpdk-dev] [PATCH v3 1/4] test/hash: reset global variable to discard old data 2019-07-02 0:27 ` [dpdk-dev] [PATCH v3 1/4] test/hash: reset global variable to discard old data Honnappa Nagarahalli ` (2 preceding siblings ...) 2019-07-02 0:27 ` [dpdk-dev] [PATCH v3 4/4] test/hash: use array for small amount of memory Honnappa Nagarahalli @ 2019-07-05 8:46 ` Thomas Monjalon 3 siblings, 0 replies; 17+ messages in thread From: Thomas Monjalon @ 2019-07-05 8:46 UTC (permalink / raw) To: Honnappa Nagarahalli Cc: dev, yipeng1.wang, sameh.gobriel, bruce.richardson, pablo.de.lara.guarch, david.marchand, dharmik.thakkar, nd, stable 02/07/2019 02:27, Honnappa Nagarahalli: > Reset tbl_rwc_test_param to discard data from previous run > of the test. > > Fixes: c7eb0972e74b ("test/hash: add lock-free r/w concurrency") > Cc: stable@dpdk.org > > Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> > Reviewed-by: Dharmik Thakkar <dharmik.thakkar@arm.com> Series applied, thanks ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2019-07-05 8:46 UTC | newest] Thread overview: 17+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2019-06-27 3:24 [dpdk-dev] [PATCH 1/3] test/hash: reset global variable to discard old data Honnappa Nagarahalli 2019-06-27 3:24 ` [dpdk-dev] [PATCH 2/3] test/hash: free allocated memory Honnappa Nagarahalli 2019-06-27 8:07 ` [dpdk-dev] [dpdk-stable] " David Marchand 2019-06-28 4:59 ` Honnappa Nagarahalli 2019-06-28 8:36 ` David Marchand 2019-06-27 3:24 ` [dpdk-dev] [PATCH 3/3] test/hash: init hash parameters in the correct function Honnappa Nagarahalli 2019-06-27 8:07 ` [dpdk-dev] [dpdk-stable] " David Marchand 2019-06-28 4:55 ` Honnappa Nagarahalli 2019-06-28 4:52 ` [dpdk-dev] [PATCH v2 1/3] test/hash: reset global variable to discard old data Honnappa Nagarahalli 2019-06-28 4:52 ` [dpdk-dev] [PATCH v2 2/3] test/hash: init hash parameters in the correct function Honnappa Nagarahalli 2019-06-28 4:52 ` [dpdk-dev] [PATCH v2 3/3] test/hash: free allocated memory Honnappa Nagarahalli 2019-06-28 8:38 ` [dpdk-dev] [dpdk-stable] " David Marchand 2019-07-02 0:27 ` [dpdk-dev] [PATCH v3 1/4] test/hash: reset global variable to discard old data Honnappa Nagarahalli 2019-07-02 0:27 ` [dpdk-dev] [PATCH v3 2/4] test/hash: init hash parameters in the correct function Honnappa Nagarahalli 2019-07-02 0:27 ` [dpdk-dev] [PATCH v3 3/4] test/hash: free allocated memory Honnappa Nagarahalli 2019-07-02 0:27 ` [dpdk-dev] [PATCH v3 4/4] test/hash: use array for small amount of memory Honnappa Nagarahalli 2019-07-05 8:46 ` [dpdk-dev] [PATCH v3 1/4] test/hash: reset global variable to discard old data 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.