From: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
To: Yipeng Wang <yipeng1.wang@intel.com>,
"bruce.richardson@intel.com" <bruce.richardson@intel.com>
Cc: "stephen@networkplumber.org" <stephen@networkplumber.org>,
"dev@dpdk.org" <dev@dpdk.org>,
"sameh.gobriel@intel.com" <sameh.gobriel@intel.com>,
nd <nd@arm.com>
Subject: Re: [dpdk-dev] [PATCH v2 3/4] test/hash: add readwrite test for ext table
Date: Fri, 26 Oct 2018 00:32:33 +0000 [thread overview]
Message-ID: <AM6PR08MB36728C12693A04B84157ED2198F00@AM6PR08MB3672.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <1540404570-102126-4-git-send-email-yipeng1.wang@intel.com>
> Subject: [PATCH v2 3/4] test/hash: add readwrite test for ext table
>
> This commit improves the readwrite test to consider extendable table
> feature and add more functional tests to cover more corner cases.
>
I think the part covering the more corner cases should go into a separate commit.
> Signed-off-by: Yipeng Wang <yipeng1.wang@intel.com>
> ---
> test/test/test_hash_readwrite.c | 70
> ++++++++++++++++++++++++++++++++++-------
> 1 file changed, 58 insertions(+), 12 deletions(-)
>
> diff --git a/test/test/test_hash_readwrite.c
> b/test/test/test_hash_readwrite.c index a8fadd0..13c28e0 100644
> --- a/test/test/test_hash_readwrite.c
> +++ b/test/test/test_hash_readwrite.c
> @@ -21,6 +21,8 @@
> #define TOTAL_ENTRY (16*1024*1024)
> #define TOTAL_INSERT (15*1024*1024)
>
> +#define TOTAL_INSERT_EXT (16*1024*1024)
> +
> #define NUM_TEST 3
> unsigned int core_cnt[NUM_TEST] = {2, 4, 8};
>
> @@ -59,8 +61,10 @@ test_hash_readwrite_worker(__attribute__((unused))
> void *arg)
> uint64_t i, offset;
> uint32_t lcore_id = rte_lcore_id();
> uint64_t begin, cycles;
> - int ret;
> + int *ret;
>
> + ret = rte_malloc(NULL, sizeof(int) *
> + tbl_rw_test_param.num_insert, 0);
This memory needs to be freed.
> for (i = 0; i < rte_lcore_count(); i++) {
> if (slave_core_ids[i] == lcore_id)
> break;
> @@ -79,13 +83,30 @@ test_hash_readwrite_worker(__attribute__((unused))
> void *arg)
> tbl_rw_test_param.keys + i) > 0)
> break;
>
> - ret = rte_hash_add_key(tbl_rw_test_param.h,
> + ret[i - offset] = rte_hash_add_key(tbl_rw_test_param.h,
> tbl_rw_test_param.keys + i);
> - if (ret < 0)
> + if (ret[i - offset] < 0)
> + break;
> +
> + /* lookup a random key */
> + uint32_t rand = rte_rand() % (i + 1 - offset);
> +
> + if (rte_hash_lookup(tbl_rw_test_param.h,
> + tbl_rw_test_param.keys + rand) != ret[rand])
> + break;
> +
> +
> + if (rte_hash_del_key(tbl_rw_test_param.h,
> + tbl_rw_test_param.keys + rand) != ret[rand])
> + break;
> +
> + ret[rand] = rte_hash_add_key(tbl_rw_test_param.h,
> + tbl_rw_test_param.keys + rand);
> + if (ret[rand] < 0)
> break;
>
> if (rte_hash_lookup(tbl_rw_test_param.h,
> - tbl_rw_test_param.keys + i) != ret)
> + tbl_rw_test_param.keys + rand) != ret[rand])
> break;
> }
>
> @@ -100,7 +121,7 @@ test_hash_readwrite_worker(__attribute__((unused))
> void *arg) }
>
> static int
> -init_params(int use_htm, int use_jhash)
> +init_params(int use_ext, int use_htm, int use_jhash)
> {
> unsigned int i;
>
> @@ -129,6 +150,13 @@ init_params(int use_htm, int use_jhash)
> RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY |
> RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD;
>
> + if (use_ext)
> + hash_params.extra_flag |=
> + RTE_HASH_EXTRA_FLAGS_EXT_TABLE;
> + else
> + hash_params.extra_flag &=
> + ~RTE_HASH_EXTRA_FLAGS_EXT_TABLE;
> +
> hash_params.name = "tests";
>
> handle = rte_hash_create(&hash_params); @@ -167,7 +195,7 @@
> init_params(int use_htm, int use_jhash) }
>
> static int
> -test_hash_readwrite_functional(int use_htm)
> +test_hash_readwrite_functional(int use_ext, int use_htm)
> {
> unsigned int i;
> const void *next_key;
> @@ -178,6 +206,7 @@ test_hash_readwrite_functional(int use_htm)
> uint32_t lost_keys = 0;
> int use_jhash = 1;
> int slave_cnt = rte_lcore_count() - 1;
> + uint32_t tot_insert = 0;
>
> rte_atomic64_init(&gcycles);
> rte_atomic64_clear(&gcycles);
> @@ -185,11 +214,16 @@ test_hash_readwrite_functional(int use_htm)
> rte_atomic64_init(&ginsertions);
> rte_atomic64_clear(&ginsertions);
>
> - if (init_params(use_htm, use_jhash) != 0)
> + if (init_params(use_ext, use_htm, use_jhash) != 0)
> goto err;
>
> + if (use_ext)
> + tot_insert = TOTAL_INSERT_EXT;
> + else
> + tot_insert = TOTAL_INSERT;
> +
> tbl_rw_test_param.num_insert =
> - TOTAL_INSERT / slave_cnt;
> + tot_insert / slave_cnt;
>
> tbl_rw_test_param.rounded_tot_insert =
> tbl_rw_test_param.num_insert
> @@ -345,7 +379,7 @@ test_hash_readwrite_perf(struct perf *perf_results,
> int use_htm,
> rte_atomic64_init(&gwrite_cycles);
> rte_atomic64_clear(&gwrite_cycles);
>
> - if (init_params(use_htm, use_jhash) != 0)
> + if (init_params(0, use_htm, use_jhash) != 0)
> goto err;
>
> /*
> @@ -579,7 +613,7 @@ test_hash_readwrite_main(void)
> * than writer threads. This is to timing either reader threads or
> * writer threads for performance numbers.
> */
> - int use_htm, reader_faster;
> + int use_htm, use_ext, reader_faster;
> unsigned int i = 0, core_id = 0;
>
> if (rte_lcore_count() <= 2) {
> @@ -602,7 +636,13 @@ test_hash_readwrite_main(void)
> printf("Test read-write with Hardware transactional
> memory\n");
>
> use_htm = 1;
> - if (test_hash_readwrite_functional(use_htm) < 0)
> + use_ext = 0;
> +
> + if (test_hash_readwrite_functional(use_ext, use_htm) < 0)
> + return -1;
> +
> + use_ext = 1;
> + if (test_hash_readwrite_functional(use_ext, use_htm) < 0)
> return -1;
>
> reader_faster = 1;
> @@ -621,8 +661,14 @@ test_hash_readwrite_main(void)
>
> printf("Test read-write without Hardware transactional memory\n");
> use_htm = 0;
> - if (test_hash_readwrite_functional(use_htm) < 0)
> + use_ext = 0;
> + if (test_hash_readwrite_functional(use_ext, use_htm) < 0)
> return -1;
> +
> + use_ext = 1;
> + if (test_hash_readwrite_functional(use_ext, use_htm) < 0)
> + return -1;
> +
> reader_faster = 1;
> if (test_hash_readwrite_perf(&non_htm_results, use_htm,
> reader_faster) < 0)
> --
> 2.7.4
next prev parent reply other threads:[~2018-10-26 0:32 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-24 18:09 [dpdk-dev] [PATCH v2 0/4] hash: improve multiple places Yipeng Wang
2018-10-24 18:09 ` [dpdk-dev] [PATCH v2 1/4] hash: fix unnecessary pause Yipeng Wang
2018-10-25 6:31 ` Mattias Rönnblom
2018-10-25 9:30 ` Bruce Richardson
2018-10-26 0:24 ` Honnappa Nagarahalli
2018-10-26 2:04 ` Wang, Yipeng1
2018-10-26 11:09 ` Bruce Richardson
2018-10-24 18:09 ` [dpdk-dev] [PATCH v2 2/4] test/hash: change multiwriter test to use jhash Yipeng Wang
2018-10-25 9:32 ` Bruce Richardson
2018-10-24 18:09 ` [dpdk-dev] [PATCH v2 3/4] test/hash: add readwrite test for ext table Yipeng Wang
2018-10-25 9:34 ` Bruce Richardson
2018-10-26 0:32 ` Honnappa Nagarahalli [this message]
2018-10-24 18:09 ` [dpdk-dev] [PATCH v2 4/4] test/hash: remove hash scaling unit test Yipeng Wang
2018-10-25 9:34 ` Bruce Richardson
2018-10-25 19:11 ` [dpdk-dev] [PATCH v3 0/6] hash: improve multiple places Yipeng Wang
2018-10-25 19:11 ` [dpdk-dev] [PATCH v3 1/6] hash: fix unnecessary pause Yipeng Wang
2018-10-25 19:11 ` [dpdk-dev] [PATCH v3 2/6] test/hash: change multiwriter test to use jhash Yipeng Wang
2018-10-25 19:11 ` [dpdk-dev] [PATCH v3 3/6] test/hash: test more corner cases in unit test Yipeng Wang
2018-10-26 5:03 ` Honnappa Nagarahalli
2018-10-26 11:02 ` Thomas Monjalon
2018-10-25 19:11 ` [dpdk-dev] [PATCH v3 4/6] test/hash: add readwrite test for ext table Yipeng Wang
2018-10-25 19:11 ` [dpdk-dev] [PATCH v3 5/6] test/hash: remove hash scaling unit test Yipeng Wang
2018-10-25 19:11 ` [dpdk-dev] [PATCH v3 6/6] test/hash: fix to add read-write test to autotest Yipeng Wang
2018-10-26 9:53 ` [dpdk-dev] [PATCH v4 0/6] hash: improve multiple places Yipeng Wang
2018-10-26 9:53 ` [dpdk-dev] [PATCH v4 1/6] hash: fix unnecessary pause Yipeng Wang
2018-10-26 9:53 ` [dpdk-dev] [PATCH v4 2/6] test/hash: change multiwriter test to use jhash Yipeng Wang
2018-10-26 9:53 ` [dpdk-dev] [PATCH v4 3/6] test/hash: test more corner cases in unit test Yipeng Wang
2018-10-26 9:53 ` [dpdk-dev] [PATCH v4 4/6] test/hash: add readwrite test for ext table Yipeng Wang
2018-10-26 9:53 ` [dpdk-dev] [PATCH v4 5/6] test/hash: remove hash scaling unit test Yipeng Wang
2018-10-26 9:53 ` [dpdk-dev] [PATCH v4 6/6] test/hash: fix to add read-write test to autotest Yipeng Wang
2018-10-26 20:15 ` [dpdk-dev] [PATCH v4 0/6] hash: improve multiple places Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AM6PR08MB36728C12693A04B84157ED2198F00@AM6PR08MB3672.eurprd08.prod.outlook.com \
--to=honnappa.nagarahalli@arm.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=nd@arm.com \
--cc=sameh.gobriel@intel.com \
--cc=stephen@networkplumber.org \
--cc=yipeng1.wang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).