From patchwork Thu Jun 27 03:24:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honnappa Nagarahalli X-Patchwork-Id: 167873 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp1760384ilk; Wed, 26 Jun 2019 20:24:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqzQKFepqgSE+Yytxc/hh5cJVchqBq4rZ1mRWf6l2MENQzZd1RVHhH0McdYFroX7nJTGOIv5 X-Received: by 2002:a05:600c:20c3:: with SMTP id y3mr1371317wmm.3.1561605897379; Wed, 26 Jun 2019 20:24:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561605897; cv=none; d=google.com; s=arc-20160816; b=jb4WjVT/2c/ruY83qvNr9sUqZBwAyhaY7v69t36Taq2iIFwQDhyb504aV/LsbLyQ9M AuxdrrG7pudyAyFfaiFotPUTV8me0f5iXa+qPsWiP09TCU2Ws+4hlNare0J6ekLBWJCe aSJgJuH5Af2rqiOB/DXGT/LRQ1WMZ3q2o7cOobFobkdAgMlysXop5U7vmJKRxGK6ZLuv PY+EZLzalzznZe08KXgD1HdeuNUTHe24+JOJ6mOkZsSqIXIHw11RvWn+aXIuzD8bAyLA 4mxcQ2Dq6+qvqCzhMRQZrkUpA262dkHpdrdavZui9s/uvx2vBnJQ3/IAa7Kp6Zj+u/gq 99OQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:message-id:date:cc:to :from; bh=XhFpHcF0cPOrrovOc/Ri2i3iIrC9vVebKSyYQ8GLpOQ=; b=m7rFWyKvKFUtFSpS408jM/Qd3j3tlq7qY2lluVwmZXvN2rPJXMIpdYJSrgV3prph7t zkgB2NxSomd8daTMZQbO9wNMaDEJWA7TvXhqAn37aO3/BHP855slxKD4U/kZnz7l6Ohk 3+NKnbra1TDC7cZI4tnbexlxFddr1bR1yuAtTlE4zCvVUqxsdsU298nrHvGEQ11VTCpv Eor1JDr/GAXgmFjPRlEG65JroX8M66qlN4Fllr1HoCJZQWgwe04/RIFF1T6/Tztl0C4d JBJToHpVsnYyn4W7/hvQ3gRZCuBxft4IkpT+GSJJEV0aUlmHKEJgTwV6uG6Dx0vIhb0M CUjg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id j1si772044wre.59.2019.06.26.20.24.56; Wed, 26 Jun 2019 20:24:57 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E2A7028EE; Thu, 27 Jun 2019 05:24:55 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 00C3DF04; Thu, 27 Jun 2019 05:24:53 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 448702B; Wed, 26 Jun 2019 20:24:53 -0700 (PDT) Received: from qc2400f-1.austin.arm.com (qc2400f-1.austin.arm.com [10.118.12.65]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3AC4A3F246; Wed, 26 Jun 2019 20:24:53 -0700 (PDT) From: Honnappa Nagarahalli To: yipeng1.wang@intel.com, sameh.gobriel@intel.com, bruce.richardson@intel.com, pablo.de.lara.guarch@intel.com, honnappa.nagarahalli@arm.com Cc: dharmik.thakkar@arm.com, dev@dpdk.org, nd@arm.com, stable@dpdk.org Date: Wed, 26 Jun 2019 22:24:18 -0500 Message-Id: <20190627032420.4730-1-honnappa.nagarahalli@arm.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH 1/3] test/hash: reset global variable to discard old data 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" 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 Reviewed-by: Dharmik Thakkar --- app/test/test_hash_readwrite_lf.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.17.1 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 From patchwork Thu Jun 27 03:24:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honnappa Nagarahalli X-Patchwork-Id: 167874 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp1760509ilk; Wed, 26 Jun 2019 20:25:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqyUX2R9OLhL7np80rpel58UNxdcjrBJ59R1vMgRKHNzI4bmEHPcEExTuKAP4B0Y6IgVSL9o X-Received: by 2002:a1c:3c8a:: with SMTP id j132mr1303871wma.172.1561605907049; Wed, 26 Jun 2019 20:25:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561605907; cv=none; d=google.com; s=arc-20160816; b=044mxgnKPtXeCqmPA4yGHsW7/FVwTPVM/CSKsYNdwlJITt0xe21F2A3mhf0pAdYJv1 b2uIhWNsuq/SIR3xkrxkeXYpMgZE58SuignOgswnMdHC9Q8uDkOSRzZ6jCIThkOQWs7q wPCaDAEBP9S0xRac06elC7rbgDBgdLS9yhFWpwZSehBdA3c5xwyNdBPItbJyPqDbShL6 Q/+IENhlOTOVBZ8vg34HF9amQzTC1wMazejNO/WF2sE65u6+ndS61afszdDJ7okFdgol 6FG15rzQcNVMsDOyNzKw/gJV3ukHHBAHiNqWfeIuQEKPCINEUFCsbAuVYBDC2SP6d4OD 77yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:cc:to:from; bh=2cfz0K7KzEE+ItoO6yY+U7VPLKfXAd9o6flfmWJIbMI=; b=ShvWGTX+bX398df69NyXBM0yeHsqJ3xzkLT/plGsqWyikVOG3nC3jvIb1ShgIb88oj SbxH/9Gzxo6/qbeOAx6a4uSrCNE/OqtCWt0LXI7gQLd8gypA0eySL83e6uX9UFkOeqO5 f+GHIez4K5xDwz8HhWc3obiSmAQcCGnKTTOpQyPzffvsklKawV1MVWOq1NzYNQ5bvFui MX0AsgkcNRMY0ez6P+uHEk4+FTjtMSPgyffzSehinmPObBbuMlc2MUbDTXlmrbBX7JLz ijQ7kvr8KO6HkoExlTuYkXNY3s0GNaqb/cBCDjM8RNd1uq71uzFnu4fl0MK00n03aJnH jCwg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id v2si698867wrq.276.2019.06.26.20.25.06; Wed, 26 Jun 2019 20:25:07 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 61A5D37A8; Thu, 27 Jun 2019 05:25:00 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 43DD32F4F; Thu, 27 Jun 2019 05:24:57 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B33D92B; Wed, 26 Jun 2019 20:24:56 -0700 (PDT) Received: from qc2400f-1.austin.arm.com (qc2400f-1.austin.arm.com [10.118.12.65]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AAFAB3F246; Wed, 26 Jun 2019 20:24:56 -0700 (PDT) From: Honnappa Nagarahalli To: yipeng1.wang@intel.com, sameh.gobriel@intel.com, bruce.richardson@intel.com, pablo.de.lara.guarch@intel.com, honnappa.nagarahalli@arm.com Cc: dharmik.thakkar@arm.com, dev@dpdk.org, nd@arm.com, stable@dpdk.org Date: Wed, 26 Jun 2019 22:24:19 -0500 Message-Id: <20190627032420.4730-2-honnappa.nagarahalli@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190627032420.4730-1-honnappa.nagarahalli@arm.com> References: <20190627032420.4730-1-honnappa.nagarahalli@arm.com> Subject: [dpdk-dev] [PATCH 2/3] test/hash: free allocated memory 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" Free allocated memory. Fixes: 3f9aab961ed3 ("test/hash: check lock-free extendable bucket") Cc: stable@dpdk.org Signed-off-by: Honnappa Nagarahalli Reviewed-by: Dharmik Thakkar --- app/test/test_hash_readwrite_lf.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.17.1 Signed-off-by: Honnappa Nagarahalli > Reviewed-by: Dharmik Thakkar > 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; } From patchwork Thu Jun 27 03:24:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honnappa Nagarahalli X-Patchwork-Id: 167875 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp1760608ilk; Wed, 26 Jun 2019 20:25:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqzME0OzTucCT6vB1gtSS1q2VWw9m45zrOxDSubsWUvswxl0vh3Ve5aXoCQkI6nt1ACHe+J7 X-Received: by 2002:a5d:49cc:: with SMTP id t12mr870908wrs.344.1561605914470; Wed, 26 Jun 2019 20:25:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561605914; cv=none; d=google.com; s=arc-20160816; b=iUqKg0AscKlmoyQRhrVCoCy0umUxObxvG0kz1a74fohzQ8cNo5d+hM+0oyztpUFcZg 6JW3gCaOp51pyO12lqn0xKRgcgbvpNHlwVy5sQaxIYikiq63AHn+2oVdMOuRTZssiOLh RZ9JSrfglNSLF2yNHuy5f9unJlIWdqJvCwvyGAF/2UazhXP8lvr3eVLccSbvQrkZ1JDz ufAOyHHQDkiqSPSZd+KQQ/l5DC1nH5J4O+dfuWcNtVBLLYjAvYIOXy6Pf/aPTAHNc2jp WkkiKPFnMMXSTKolPipj483wS6B41cDNiHid+Cb/mvKD+n0/PTg4QNvxmq9FNF2ZK4bc D0HQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:cc:to:from; bh=Z1EIkCExZ8K8IsZUx/XG0QCItqoKMnoP/nxofn1hNjU=; b=wGAHpdTfA36j7H3LoeZlx3/nDXjP0V9fAEcPKIOhPGH5CwFtwP5sFUtUyESKAlOWeN HiRdWH5NHOiAY8UkSXYT+aMwP3yBPEHSihDDP9KJegEQ8FcDpC0IeL/dzAlNKWKInLcW UsPh7guE5tSi4lIgrP5aLIUXjC6gS0x9oo5gbfwbk4e13V9+lpnQT55T7/IdIcgM037I PMnm9AWK0CLWfrtnleH7xNYlK06wbG5SUQdehrACHT49q/Q3hZYAh37uCz34I7jUgFVN HJk0mbjmYiVfgumegTVLfqBefRIr1DWgMHd2NlT6k4gvAdsQPLjDAMbmw3KfFL78i7UK j0sw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id j128si2455646wmj.158.2019.06.26.20.25.14; Wed, 26 Jun 2019 20:25:14 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5E6862BE2; Thu, 27 Jun 2019 05:25:04 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id A9368F04; Thu, 27 Jun 2019 05:24:59 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3C1FED6E; Wed, 26 Jun 2019 20:24:59 -0700 (PDT) Received: from qc2400f-1.austin.arm.com (qc2400f-1.austin.arm.com [10.118.12.65]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3110F3F246; Wed, 26 Jun 2019 20:24:59 -0700 (PDT) From: Honnappa Nagarahalli To: yipeng1.wang@intel.com, sameh.gobriel@intel.com, bruce.richardson@intel.com, pablo.de.lara.guarch@intel.com, honnappa.nagarahalli@arm.com Cc: dharmik.thakkar@arm.com, dev@dpdk.org, nd@arm.com, stable@dpdk.org Date: Wed, 26 Jun 2019 22:24:20 -0500 Message-Id: <20190627032420.4730-3-honnappa.nagarahalli@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190627032420.4730-1-honnappa.nagarahalli@arm.com> References: <20190627032420.4730-1-honnappa.nagarahalli@arm.com> Subject: [dpdk-dev] [PATCH 3/3] test/hash: init hash parameters in the correct function 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" 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 Reviewed-by: Dharmik Thakkar --- app/test/test_hash_readwrite_lf.c | 98 +++++++++++++++---------------- 1 file changed, 49 insertions(+), 49 deletions(-) -- 2.17.1 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)