From patchwork Fri Sep 6 05:49:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Gupta X-Patchwork-Id: 58726 X-Patchwork-Delegate: david.marchand@redhat.com 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 600F31F121; Fri, 6 Sep 2019 07:50:08 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id BFB811F119 for ; Fri, 6 Sep 2019 07:50:06 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x865o6mC006209; Thu, 5 Sep 2019 22:50:06 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0818; bh=ZOrwA9gR/dRM7fbPs/dOalPXd1OPfEjic88ELu4zjUw=; b=POvtcd7uFVZJg5NWp15m14Z2uxeMrqP2ImEqlRU/UgZ6/6q/MrpXUd8Xx9anF8OqtSUQ At4+REEms/xZaDdriZ4+YOPu7Ow4oLmApEpXyO609/PsJ5Wl8I17gAjy4jJkWPIZuTvG n5UmchNM6I/c5XtHCr+No61EWpt+oCHPkHhBCfsIj4InYiFfrPIuCItrJZleRzt3LeJM GOc1I0Hf6/zOYnmvHF01+H66afX113PSuJcWn6K962fjc3HFe/lHPv3fiO86+SUbx6uL AjjZEs1dIf0bo0IdwgxkfBywEKtdIjpVW6Y6FOEEXo5g6xL7ATniYakXbYFLdQvBzKq7 xw== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0b-0016f401.pphosted.com with ESMTP id 2uqrdmnsp6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 05 Sep 2019 22:50:06 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 5 Sep 2019 22:50:03 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Thu, 5 Sep 2019 22:50:03 -0700 Received: from dc7-eodlnx04.marvell.com (dc7-eodlnx04.marvell.com [10.28.113.54]) by maili.marvell.com (Postfix) with ESMTP id 7C09C3F7045; Thu, 5 Sep 2019 22:50:01 -0700 (PDT) From: To: , , , CC: , Amit Gupta Date: Fri, 6 Sep 2019 11:19:32 +0530 Message-ID: <1567748973-24192-2-git-send-email-agupta3@marvell.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1567748973-24192-1-git-send-email-agupta3@marvell.com> References: <1567748973-24192-1-git-send-email-agupta3@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.70,1.0.8 definitions=2019-09-06_03:2019-09-04,2019-09-06 signatures=0 Subject: [dpdk-dev] [PATCH 1/2] test/meson: hash test split into shorter subtests 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" From: Amit Gupta hash_readwrite meson test was taking longer time to complete. The test always get TIMEOUT, hence test is split into functional and perf test. perf test is being moved under dpdk perf testsuites in meson build. Signed-off-by: Amit Gupta Acked-by: Yipeng Wang --- app/test/meson.build | 3 +- app/test/test_hash_readwrite.c | 146 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 148 insertions(+), 1 deletion(-) diff --git a/app/test/meson.build b/app/test/meson.build index ec40943..94fd9f8 100644 --- a/app/test/meson.build +++ b/app/test/meson.build @@ -219,7 +219,7 @@ fast_test_names = [ 'distributor_autotest', 'eventdev_common_autotest', 'fbarray_autotest', - 'hash_readwrite_autotest', + 'hash_readwrite_func_autotest', 'hash_readwrite_lf_autotest', 'ipsec_autotest', 'kni_autotest', @@ -262,6 +262,7 @@ perf_test_names = [ 'stack_perf_autotest', 'stack_lf_perf_autotest', 'rand_perf_autotest', + 'hash_readwrite_perf_autotest', ] driver_test_names = [ diff --git a/app/test/test_hash_readwrite.c b/app/test/test_hash_readwrite.c index 4376b09..c25e904 100644 --- a/app/test/test_hash_readwrite.c +++ b/app/test/test_hash_readwrite.c @@ -606,6 +606,150 @@ struct { } static int +test_hash_rw_perf_main(void) +{ + /* + * Variables used to choose different tests. + * use_htm indicates if hardware transactional memory should be used. + * reader_faster indicates if the reader threads should finish earlier + * than writer threads. This is to timing either reader threads or + * writer threads for performance numbers. + */ + int use_htm, reader_faster; + unsigned int i = 0, core_id = 0; + + if (rte_lcore_count() < 3) { + printf("Not enough cores for hash_readwrite_autotest, expecting at least 3\n"); + return TEST_SKIPPED; + } + + RTE_LCORE_FOREACH_SLAVE(core_id) { + slave_core_ids[i] = core_id; + i++; + } + + setlocale(LC_NUMERIC, ""); + + if (rte_tm_supported()) { + printf("Hardware transactional memory (lock elision) " + "is supported\n"); + + printf("Test read-write with Hardware transactional memory\n"); + + use_htm = 1; + + reader_faster = 1; + if (test_hash_readwrite_perf(&htm_results, use_htm, + reader_faster) < 0) + return -1; + + reader_faster = 0; + if (test_hash_readwrite_perf(&htm_results, use_htm, + reader_faster) < 0) + return -1; + } else { + printf("Hardware transactional memory (lock elision) " + "is NOT supported\n"); + } + + printf("Test read-write without Hardware transactional memory\n"); + use_htm = 0; + + reader_faster = 1; + if (test_hash_readwrite_perf(&non_htm_results, use_htm, + reader_faster) < 0) + return -1; + reader_faster = 0; + if (test_hash_readwrite_perf(&non_htm_results, use_htm, + reader_faster) < 0) + return -1; + + printf("================\n"); + printf("Results summary:\n"); + printf("================\n"); + + printf("single read: %u\n", htm_results.single_read); + printf("single write: %u\n", htm_results.single_write); + for (i = 0; i < NUM_TEST; i++) { + printf("+++ core_cnt: %u +++\n", core_cnt[i]); + printf("HTM:\n"); + printf(" read only: %u\n", htm_results.read_only[i]); + printf(" write only: %u\n", htm_results.write_only[i]); + printf(" read-write read: %u\n", htm_results.read_write_r[i]); + printf(" read-write write: %u\n", htm_results.read_write_w[i]); + + printf("non HTM:\n"); + printf(" read only: %u\n", non_htm_results.read_only[i]); + printf(" write only: %u\n", non_htm_results.write_only[i]); + printf(" read-write read: %u\n", + non_htm_results.read_write_r[i]); + printf(" read-write write: %u\n", + non_htm_results.read_write_w[i]); + } + + return 0; +} + +static int +test_hash_rw_func_main(void) +{ + /* + * Variables used to choose different tests. + * use_htm indicates if hardware transactional memory should be used. + * reader_faster indicates if the reader threads should finish earlier + * than writer threads. This is to timing either reader threads or + * writer threads for performance numbers. + */ + int use_htm, use_ext; + unsigned int i = 0, core_id = 0; + + if (rte_lcore_count() < 3) { + printf("Not enough cores for hash_readwrite_autotest, expecting at least 3\n"); + return TEST_SKIPPED; + } + + RTE_LCORE_FOREACH_SLAVE(core_id) { + slave_core_ids[i] = core_id; + i++; + } + + setlocale(LC_NUMERIC, ""); + + if (rte_tm_supported()) { + printf("Hardware transactional memory (lock elision) " + "is supported\n"); + + printf("Test read-write with Hardware transactional memory\n"); + + use_htm = 1; + 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; + + } else { + printf("Hardware transactional memory (lock elision) " + "is NOT supported\n"); + } + + printf("Test read-write without Hardware transactional memory\n"); + 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; + + return 0; +} + +static int test_hash_readwrite_main(void) { /* @@ -706,3 +850,5 @@ struct { } REGISTER_TEST_COMMAND(hash_readwrite_autotest, test_hash_readwrite_main); +REGISTER_TEST_COMMAND(hash_readwrite_func_autotest, test_hash_rw_func_main); +REGISTER_TEST_COMMAND(hash_readwrite_perf_autotest, test_hash_rw_perf_main);