From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6A72AA0538; Wed, 5 Feb 2020 10:08:10 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B0A331C12A; Wed, 5 Feb 2020 10:08:09 +0100 (CET) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by dpdk.org (Postfix) with ESMTP id 801E01C11A for ; Wed, 5 Feb 2020 10:08:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580893686; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vtOK9B40Dt7NPS32eiRfmwcGgyJsUga/NCI1Vuwq/IE=; b=KY4l7rhFPJtHsJDF9NSVDTMqZ0kUfuO+4TSJICnc4xUTJtq/c7bpMq2a6jFB6sMmUy3PQl DZjpZP06l8r7HPxKT16CMKvHSw5qEFU3DMatlkNP7UVCrcJgjzK2HHMDcR77t9LuAKVXrs s7PDonkZdSKfB2u9I75aUcchQG1O2LQ= Received: from mail-ua1-f72.google.com (mail-ua1-f72.google.com [209.85.222.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-175-lZsDzbBDPHOp3BPkfVgkFg-1; Wed, 05 Feb 2020 04:08:05 -0500 Received: by mail-ua1-f72.google.com with SMTP id z17so418987uaa.1 for ; Wed, 05 Feb 2020 01:08:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=v+bxxV3vI+QpLTlXAThthhg8TP9xma8CrzUrG0U/X+Q=; b=qsCDzVrj19NVabmqGOybsyOCxx27yBUyuy52XtP38j8BfWZ6ZhvlsQOHWxEal7BZW+ 3Opvjnm/ILw6PNjUD03oX1veFeFKIinB+AepQH0MQMv7mggnK/L/30FgIF1SKS88F/os ZTBUXyaEhIR6MRfFPDKg8kYRUCDwe872VDQ/sk8tOaj5ebEeEVxh/6E8SXEHTfQrWoHx yxNZHZRd1aj3F5/JFyAHZGMpWEKoy/zDB9en2vkz3NG4ayO0l9yOUCnWR5YUwd5LJYhZ lWiV7/Rvvk+mboSCad90Pk+pGJvgvGPHanqwPG0aHXloxErAQ8iiI4PpJnFlSxD0vBuM amMg== X-Gm-Message-State: APjAAAUr2f09vzF7cIje5D7+gDvD4fKu64515JiVDZxfb0rqLA5XI3Ma WlTd4n2Ndyjx5QiSpe3WM/2JM/yfYKXRcX3CFEJy6uT0Mp1/OedJhXz6byJogZny3doq6UXyrPt +iaGLQAiT2sScWCFN0Vc= X-Received: by 2002:ab0:618a:: with SMTP id h10mr20221966uan.53.1580893684918; Wed, 05 Feb 2020 01:08:04 -0800 (PST) X-Google-Smtp-Source: APXvYqyFInOMqAWT2SR+5/pkzQFCC7iDO+Qw5q4Szz3TZy7lDNkHVPBlS2MznvvDmRHRIzk8y7KYKajlQFP7tgiHUGw= X-Received: by 2002:ab0:618a:: with SMTP id h10mr20221952uan.53.1580893684615; Wed, 05 Feb 2020 01:08:04 -0800 (PST) MIME-Version: 1.0 References: <1567748973-24192-1-git-send-email-agupta3@marvell.com> <20200203194912.4669-1-honnappa.nagarahalli@arm.com> <20200203194912.4669-4-honnappa.nagarahalli@arm.com> In-Reply-To: <20200203194912.4669-4-honnappa.nagarahalli@arm.com> From: David Marchand Date: Wed, 5 Feb 2020 10:07:53 +0100 Message-ID: To: Honnappa Nagarahalli Cc: Amit Gupta , "Wang, Yipeng1" , "Gobriel, Sameh" , Thomas Monjalon , dev , nd X-MC-Unique: lZsDzbBDPHOp3BPkfVgkFg-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-dev] [PATCH v2 3/5] test/hash: add lock free reader writer functional tests 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" On Mon, Feb 3, 2020 at 8:49 PM Honnappa Nagarahalli wrote: > > Add lock-free reader writer concurrency functional tests. > These tests will provide the same coverage that non lock-free > APIs have. > > Signed-off-by: Honnappa Nagarahalli > --- > app/test/test_hash_readwrite.c | 58 +++++++++++++++++++++------------- > 1 file changed, 36 insertions(+), 22 deletions(-) > > diff --git a/app/test/test_hash_readwrite.c b/app/test/test_hash_readwrit= e.c > index 635ed5a9f..a9429091c 100644 > --- a/app/test/test_hash_readwrite.c > +++ b/app/test/test_hash_readwrite.c > @@ -121,7 +121,7 @@ test_hash_readwrite_worker(__attribute__((unused)) vo= id *arg) > } > > static int > -init_params(int use_ext, int use_htm, int use_jhash) > +init_params(int use_ext, int use_htm, int rw_lf, int use_jhash) > { > unsigned int i; > > @@ -140,15 +140,16 @@ init_params(int use_ext, int use_htm, int use_jhash= ) > else > hash_params.hash_func =3D rte_hash_crc; > > + hash_params.extra_flag =3D RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; > if (use_htm) > - hash_params.extra_flag =3D > - RTE_HASH_EXTRA_FLAGS_TRANS_MEM_SUPPORT | > - RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY | > - RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; > + hash_params.extra_flag |=3D > + RTE_HASH_EXTRA_FLAGS_TRANS_MEM_SUPPORT; > + if (rw_lf) > + hash_params.extra_flag |=3D > + RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF; > else > - hash_params.extra_flag =3D > - RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY | > - RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; > + hash_params.extra_flag |=3D > + RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY; > > if (use_ext) > hash_params.extra_flag |=3D > @@ -195,7 +196,7 @@ init_params(int use_ext, int use_htm, int use_jhash) > } > > static int > -test_hash_readwrite_functional(int use_ext, int use_htm) > +test_hash_readwrite_functional(int use_htm, int use_rw_lf, int use_ext) This is a bit hard to read, please keep the same order than init_params. > { > unsigned int i; > const void *next_key; > @@ -214,7 +215,7 @@ test_hash_readwrite_functional(int use_ext, int use_h= tm) > rte_atomic64_init(&ginsertions); > rte_atomic64_clear(&ginsertions); > > - if (init_params(use_ext, use_htm, use_jhash) !=3D 0) > + if (init_params(use_ext, use_htm, use_rw_lf, use_jhash) !=3D 0) > goto err; > > if (use_ext) > @@ -229,6 +230,8 @@ test_hash_readwrite_functional(int use_ext, int use_h= tm) > tbl_rw_test_param.num_insert > * slave_cnt; > > + printf("\nHTM =3D %d, RW-LF =3D %d, EXT-Table =3D %d\n", > + use_htm, use_rw_lf, use_ext); > printf("++++++++Start function tests:+++++++++\n"); > > /* Fire all threads. */ > @@ -379,7 +382,7 @@ test_hash_readwrite_perf(struct perf *perf_results, i= nt use_htm, > rte_atomic64_init(&gwrite_cycles); > rte_atomic64_clear(&gwrite_cycles); > > - if (init_params(0, use_htm, use_jhash) !=3D 0) > + if (init_params(0, use_htm, 0, use_jhash) !=3D 0) > goto err; > > /* > @@ -700,7 +703,6 @@ test_hash_rw_func_main(void) > * than writer threads. This is to timing either reader threads o= r > * writer threads for performance numbers. > */ > - int use_htm, use_ext; The comments block just before is out of sync. > unsigned int i =3D 0, core_id =3D 0; > > if (rte_lcore_count() < 3) { > @@ -721,29 +723,41 @@ test_hash_rw_func_main(void) > > printf("Test read-write with Hardware transactional memor= y\n"); > > - use_htm =3D 1; > - use_ext =3D 0; > + /* htm =3D 1, rw_lf =3D 0, ext =3D 0 */ I didn't like those local variables. But comments tend to get out of sync fairly easily, please remove too. > + if (test_hash_readwrite_functional(1, 0, 0) < 0) > + return -1; > > - if (test_hash_readwrite_functional(use_ext, use_htm) < 0) > + /* htm =3D 1, rw_lf =3D 1, ext =3D 0 */ > + if (test_hash_readwrite_functional(1, 1, 0) < 0) > return -1; > > - use_ext =3D 1; > - if (test_hash_readwrite_functional(use_ext, use_htm) < 0) > + /* htm =3D 1, rw_lf =3D 0, ext =3D 1 */ > + if (test_hash_readwrite_functional(1, 0, 1) < 0) > return -1; > > + /* htm =3D 1, rw_lf =3D 1, ext =3D 1 */ > + if (test_hash_readwrite_functional(1, 1, 1) < 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 =3D 0; > - use_ext =3D 0; > - if (test_hash_readwrite_functional(use_ext, use_htm) < 0) > + /* htm =3D 0, rw_lf =3D 0, ext =3D 0 */ > + if (test_hash_readwrite_functional(0, 0, 0) < 0) > + return -1; > + > + /* htm =3D 0, rw_lf =3D 1, ext =3D 0 */ > + if (test_hash_readwrite_functional(0, 1, 0) < 0) > + return -1; > + > + /* htm =3D 0, rw_lf =3D 0, ext =3D 1 */ > + if (test_hash_readwrite_functional(0, 0, 1) < 0) > return -1; > > - use_ext =3D 1; > - if (test_hash_readwrite_functional(use_ext, use_htm) < 0) > + /* htm =3D 0, rw_lf =3D 1, ext =3D 1 */ > + if (test_hash_readwrite_functional(0, 1, 1) < 0) > return -1; > > return 0; > -- > 2.17.1 > --=20 David Marchand