From patchwork Thu Oct 25 19:11:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Yipeng1" X-Patchwork-Id: 47449 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 840235F25; Fri, 26 Oct 2018 04:16:47 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id D6E0C5B1C for ; Fri, 26 Oct 2018 04:16:39 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Oct 2018 19:16:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,426,1534834800"; d="scan'208";a="102770312" Received: from skx-yipeng.jf.intel.com ([10.54.81.175]) by orsmga001.jf.intel.com with ESMTP; 25 Oct 2018 19:16:37 -0700 From: Yipeng Wang To: bruce.richardson@intel.com Cc: stephen@networkplumber.org, dev@dpdk.org, yipeng1.wang@intel.com, honnappa.nagarahalli@arm.com, sameh.gobriel@intel.com Date: Thu, 25 Oct 2018 12:11:16 -0700 Message-Id: <1540494678-64299-5-git-send-email-yipeng1.wang@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1540494678-64299-1-git-send-email-yipeng1.wang@intel.com> References: <1540404570-102126-1-git-send-email-yipeng1.wang@intel.com> <1540494678-64299-1-git-send-email-yipeng1.wang@intel.com> Subject: [dpdk-dev] [PATCH v3 4/6] test/hash: add readwrite test for ext table X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This commit improves the readwrite test to consider extendable table feature. Signed-off-by: Yipeng Wang Acked-by: Bruce Richardson --- test/test/test_hash_readwrite.c | 42 +++++++++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/test/test/test_hash_readwrite.c b/test/test/test_hash_readwrite.c index a45c669..8cbe85bd 100644 --- a/test/test/test_hash_readwrite.c +++ b/test/test/test_hash_readwrite.c @@ -20,6 +20,7 @@ #define TOTAL_ENTRY (5*1024*1024) #define TOTAL_INSERT (4.5*1024*1024) +#define TOTAL_INSERT_EXT (5*1024*1024) #define NUM_TEST 3 unsigned int core_cnt[NUM_TEST] = {2, 4, 8}; @@ -119,7 +120,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; @@ -148,6 +149,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); @@ -186,7 +194,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; @@ -197,6 +205,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); @@ -204,11 +213,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 @@ -364,7 +378,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; /* @@ -598,7 +612,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) { @@ -621,7 +635,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; @@ -640,8 +660,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)