From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 6F7432E81 for ; Fri, 26 Oct 2018 18:59:11 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Oct 2018 09:59:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,428,1534834800"; d="scan'208";a="85849498" Received: from skx-yipeng.jf.intel.com ([10.54.81.175]) by orsmga006.jf.intel.com with ESMTP; 26 Oct 2018 09:59:08 -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: Fri, 26 Oct 2018 02:53:45 -0700 Message-Id: <1540547626-197189-6-git-send-email-yipeng1.wang@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1540547626-197189-1-git-send-email-yipeng1.wang@intel.com> References: <1540494678-64299-1-git-send-email-yipeng1.wang@intel.com> <1540547626-197189-1-git-send-email-yipeng1.wang@intel.com> Subject: [dpdk-dev] [PATCH v4 5/6] test/hash: remove hash scaling unit test 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: , X-List-Received-Date: Fri, 26 Oct 2018 16:59:11 -0000 The hash scaling unit test is not really needed any more since the multi-writer is supported now inside the library and it is tested by multi-writer unit test. Signed-off-by: Yipeng Wang Acked-by: Bruce Richardson --- test/test/Makefile | 1 - test/test/autotest_data.py | 6 -- test/test/meson.build | 2 - test/test/test_hash_scaling.c | 191 ------------------------------------------ 4 files changed, 200 deletions(-) delete mode 100644 test/test/test_hash_scaling.c diff --git a/test/test/Makefile b/test/test/Makefile index 1b5c070..6b77e15 100644 --- a/test/test/Makefile +++ b/test/test/Makefile @@ -113,7 +113,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_HASH) += test_hash.c SRCS-$(CONFIG_RTE_LIBRTE_HASH) += test_thash.c SRCS-$(CONFIG_RTE_LIBRTE_HASH) += test_hash_perf.c SRCS-$(CONFIG_RTE_LIBRTE_HASH) += test_hash_functions.c -SRCS-$(CONFIG_RTE_LIBRTE_HASH) += test_hash_scaling.c SRCS-$(CONFIG_RTE_LIBRTE_HASH) += test_hash_multiwriter.c SRCS-$(CONFIG_RTE_LIBRTE_HASH) += test_hash_readwrite.c SRCS-$(CONFIG_RTE_LIBRTE_HASH) += test_hash_readwrite_lf.c diff --git a/test/test/autotest_data.py b/test/test/autotest_data.py index 4eae588..9265617 100644 --- a/test/test/autotest_data.py +++ b/test/test/autotest_data.py @@ -345,12 +345,6 @@ "Report": None, }, { - "Name": "Hash scaling autotest", - "Command": "hash_scaling_autotest", - "Func": default_autotest, - "Report": None, - }, - { "Name": "Hash multiwriter autotest", "Command": "hash_multiwriter_autotest", "Func": default_autotest, diff --git a/test/test/meson.build b/test/test/meson.build index faef5a4..7ebe9ab 100644 --- a/test/test/meson.build +++ b/test/test/meson.build @@ -47,7 +47,6 @@ test_sources = files('commands.c', 'test_hash_readwrite.c', 'test_hash_perf.c', 'test_hash_readwrite_lf.c', - 'test_hash_scaling.c', 'test_interrupts.c', 'test_kni.c', 'test_kvargs.c', @@ -170,7 +169,6 @@ test_names = [ 'external_mem_autotest', 'func_reentrancy_autotest', 'flow_classify_autotest', - 'hash_scaling_autotest', 'hash_autotest', 'hash_functions_autotest', 'hash_multiwriter_autotest', diff --git a/test/test/test_hash_scaling.c b/test/test/test_hash_scaling.c deleted file mode 100644 index 07765a7..0000000 --- a/test/test/test_hash_scaling.c +++ /dev/null @@ -1,191 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * Copyright(c) 2015 Intel Corporation - */ - -#include - -#include -#include -#include -#include -#include - -#include "test.h" - -/* - * Check condition and return an error if true. Assumes that "handle" is the - * name of the hash structure pointer to be freed. - */ -#define RETURN_IF_ERROR(cond, str, ...) do { \ - if (cond) { \ - printf("ERROR line %d: " str "\n", __LINE__, \ - ##__VA_ARGS__); \ - if (handle) \ - rte_hash_free(handle); \ - return -1; \ - } \ -} while (0) - -enum locking_mode_t { - NORMAL_LOCK, - LOCK_ELISION, - NULL_LOCK -}; - -struct { - uint32_t num_iterations; - struct rte_hash *h; - rte_spinlock_t *lock; - int locking_mode; -} tbl_scaling_test_params; - -static rte_atomic64_t gcycles; - -static int test_hash_scaling_worker(__attribute__((unused)) void *arg) -{ - uint64_t i, key; - uint32_t thr_id = rte_sys_gettid(); - uint64_t begin, cycles = 0; - - switch (tbl_scaling_test_params.locking_mode) { - - case NORMAL_LOCK: - - for (i = 0; i < tbl_scaling_test_params.num_iterations; i++) { - /* different threads get different keys because - we use the thread-id in the key computation - */ - key = rte_hash_crc(&i, sizeof(i), thr_id); - begin = rte_rdtsc_precise(); - rte_spinlock_lock(tbl_scaling_test_params.lock); - rte_hash_add_key(tbl_scaling_test_params.h, &key); - rte_spinlock_unlock(tbl_scaling_test_params.lock); - cycles += rte_rdtsc_precise() - begin; - } - break; - - case LOCK_ELISION: - - for (i = 0; i < tbl_scaling_test_params.num_iterations; i++) { - key = rte_hash_crc(&i, sizeof(i), thr_id); - begin = rte_rdtsc_precise(); - rte_spinlock_lock_tm(tbl_scaling_test_params.lock); - rte_hash_add_key(tbl_scaling_test_params.h, &key); - rte_spinlock_unlock_tm(tbl_scaling_test_params.lock); - cycles += rte_rdtsc_precise() - begin; - } - break; - - default: - - for (i = 0; i < tbl_scaling_test_params.num_iterations; i++) { - key = rte_hash_crc(&i, sizeof(i), thr_id); - begin = rte_rdtsc_precise(); - rte_hash_add_key(tbl_scaling_test_params.h, &key); - cycles += rte_rdtsc_precise() - begin; - } - } - - rte_atomic64_add(&gcycles, cycles); - - return 0; -} - -/* - * Do scalability perf tests. - */ -static int -test_hash_scaling(int locking_mode) -{ - static unsigned calledCount = 1; - uint32_t num_iterations = 1024*1024; - uint64_t i, key; - struct rte_hash_parameters hash_params = { - .entries = num_iterations*2, - .key_len = sizeof(key), - .hash_func = rte_hash_crc, - .hash_func_init_val = 0, - .socket_id = rte_socket_id(), - .extra_flag = RTE_HASH_EXTRA_FLAGS_TRANS_MEM_SUPPORT - }; - struct rte_hash *handle; - char name[RTE_HASH_NAMESIZE]; - rte_spinlock_t lock; - - rte_spinlock_init(&lock); - - snprintf(name, 32, "test%u", calledCount++); - hash_params.name = name; - - handle = rte_hash_create(&hash_params); - RETURN_IF_ERROR(handle == NULL, "hash creation failed"); - - tbl_scaling_test_params.num_iterations = - num_iterations/rte_lcore_count(); - tbl_scaling_test_params.h = handle; - tbl_scaling_test_params.lock = &lock; - tbl_scaling_test_params.locking_mode = locking_mode; - - rte_atomic64_init(&gcycles); - rte_atomic64_clear(&gcycles); - - /* fill up to initial size */ - for (i = 0; i < num_iterations; i++) { - key = rte_hash_crc(&i, sizeof(i), 0xabcdabcd); - rte_hash_add_key(tbl_scaling_test_params.h, &key); - } - - rte_eal_mp_remote_launch(test_hash_scaling_worker, NULL, CALL_MASTER); - rte_eal_mp_wait_lcore(); - - unsigned long long int cycles_per_operation = - rte_atomic64_read(&gcycles)/ - (tbl_scaling_test_params.num_iterations*rte_lcore_count()); - const char *lock_name; - - switch (locking_mode) { - case NORMAL_LOCK: - lock_name = "normal spinlock"; - break; - case LOCK_ELISION: - lock_name = "lock elision"; - break; - default: - lock_name = "null lock"; - } - printf("--------------------------------------------------------\n"); - printf("Cores: %d; %s mode -> cycles per operation: %llu\n", - rte_lcore_count(), lock_name, cycles_per_operation); - printf("--------------------------------------------------------\n"); - /* CSV output */ - printf(">>>%d,%s,%llu\n", rte_lcore_count(), lock_name, - cycles_per_operation); - - rte_hash_free(handle); - return 0; -} - -static int -test_hash_scaling_main(void) -{ - int r = 0; - - if (rte_lcore_count() == 1) - r = test_hash_scaling(NULL_LOCK); - - if (r == 0) - r = test_hash_scaling(NORMAL_LOCK); - - if (!rte_tm_supported()) { - printf("Hardware transactional memory (lock elision) is NOT supported\n"); - return r; - } - printf("Hardware transactional memory (lock elision) is supported\n"); - - if (r == 0) - r = test_hash_scaling(LOCK_ELISION); - - return r; -} - -REGISTER_TEST_COMMAND(hash_scaling_autotest, test_hash_scaling_main); -- 2.7.4