From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10066.outbound.protection.outlook.com [40.107.1.66]) by dpdk.org (Postfix) with ESMTP id 3BD1F5F30 for ; Wed, 17 Oct 2018 15:54:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pbCGz2TXH1c7xGDue365ROrg5AXqMSeSK04JIYzESJU=; b=fj2b5q79fM2KB5ZMJpMKercxsDegssBAFjiVVQAejXMkPkv9AiWdu7xWPUugnTKNapWR3kGXL9/5UuxPmqt3oXi5KQN21Y2wgPW4z8u6oL1IxU9oTHvr/1t3Mot90pfK0JIQuiz2a9xPyuL8U4ZjcOT4et740EcIhA9quBNmx5I= Received: from AM6PR08MB3672.eurprd08.prod.outlook.com (20.177.115.29) by AM6PR08MB3205.eurprd08.prod.outlook.com (52.135.164.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1250.20; Wed, 17 Oct 2018 13:54:46 +0000 Received: from AM6PR08MB3672.eurprd08.prod.outlook.com ([fe80::f423:e46a:a03c:e928]) by AM6PR08MB3672.eurprd08.prod.outlook.com ([fe80::f423:e46a:a03c:e928%3]) with mapi id 15.20.1228.032; Wed, 17 Oct 2018 13:54:46 +0000 From: Honnappa Nagarahalli To: "Wang, Yipeng1" , "Richardson, Bruce" , "De Lara Guarch, Pablo" CC: "dev@dpdk.org" , Dharmik Thakkar , "Gavin Hu (Arm Technology China)" , nd , "Gobriel, Sameh" Thread-Topic: [PATCH v3 6/7] hash: enable lock-free reader-writer concurrency Thread-Index: AQHUYfVR11nyBdO0bUmCViYz6/TUQqUcb0cAgAZrbVA= Date: Wed, 17 Oct 2018 13:54:46 +0000 Message-ID: References: <1539325918-125438-1-git-send-email-honnappa.nagarahalli@arm.com> <1539325918-125438-7-git-send-email-honnappa.nagarahalli@arm.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Honnappa.Nagarahalli@arm.com; x-originating-ip: [217.140.111.135] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM6PR08MB3205; 6:O8YmTvZsnLc9nVAGXM7vXE2IoaHk0ukU2rwy2RyzmSconAKj0ZzyEu26Kk8pXHgS2wpx8WK4va4i9OBL9MuW6B/nL/yFbX9waHvy3CO+22VnCVhk8AxsR9no2tSF6i03XKE0xPIlsqaCv+bHCIxnGEHylCHa5n58uli16j4sh9Gs4Onx/CZG1Rl7x4/jlYL0LYS8PTvvn3Rcp5jYSuK+22yXyfCeBFyATcFBFJmvQekguUhIRVHSq38WRqU0zBPaq02WseBi4nOPS3OpiU7S12wyvpuff6OQfKFu6RZqcYHvY/sGJl3HORnsmGC1pcI0LH2NaiMS0vB7c7vPOxQ5tK2nrIiLQFkYdyqNHfzH7EcKXvudJp14CS6U+69mHeKu66Q53c0GxVFRyPkX1Hzsl9UJHVtn+HjrzKDWcyiOVlU4pv80X1RvlTFRsSrlPI7+aI0py1wdbXatqvaJBYLUCQ==; 5:uOrpIufRjGGiWWyhv4/NDnDo3CZ8i1AibJ+owDmRTVuTJcx360lF1SBBulNgXISVUEYFpLvNQm7b2x3fWuovAzz6LwHVNmAX8mIa72pg7vIg6ebOz21prlFdE4xR2D+NATAjItouKu7z5bA9/OWGfu/B/RZUeTQ0/RZUVegdZ2g=; 7:StSXtcLh5qS42p+PgbFYfbT9Hb7uKNrP9xXFJYEHpMkTWsW4rQTBM0BwZM1/BhCoIA8dfytacbzb2tg9Hv9NLIY7g0U/vtzbBqDlWT8SlhjOwcZBwy3EAdhgQilzsOcUl9aOlnEroXZgU2EwG2ivrULiGhQaCHKFpmCGYnvgqhg+789DpVZC9qko85kC6TvvuScgSTpIhfUWc438F2K4oD5H0fK7Aa0UJTzLRsDmEoSKvm4CAfZI+ABZ2YxsdWDf x-ms-exchange-antispam-srfa-diagnostics: SOS;SOR; x-ms-office365-filtering-correlation-id: 088f3fa7-b9b7-4769-8e03-08d634381970 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:AM6PR08MB3205; x-ms-traffictypediagnostic: AM6PR08MB3205: nodisclaimer: True x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(180628864354917)(228905959029699); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(3231355)(944501410)(52105095)(10201501046)(93006095)(93001095)(6055026)(149066)(150057)(6041310)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:AM6PR08MB3205; BCL:0; PCL:0; RULEID:; SRVR:AM6PR08MB3205; x-forefront-prvs: 08286A0BE2 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(376002)(39860400002)(396003)(366004)(346002)(199004)(189003)(53936002)(76176011)(33656002)(6116002)(229853002)(55016002)(9686003)(6436002)(97736004)(2900100001)(3846002)(5250100002)(71190400001)(14454004)(106356001)(478600001)(5660300001)(66066001)(8936002)(14444005)(71200400001)(72206003)(105586002)(54906003)(256004)(486006)(2906002)(25786009)(4326008)(68736007)(316002)(110136005)(74316002)(186003)(8676002)(102836004)(26005)(6506007)(81166006)(7736002)(86362001)(6246003)(81156014)(305945005)(446003)(7696005)(99286004)(476003)(11346002)(21314002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR08MB3205; H:AM6PR08MB3672.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: Ox8U0959uEp4mcUnhBfKr04SIv3Cw87GiDpIvxP2DeCP6NxXpgJrY1KaV5yGAWYkAfQsKGYYhpyUyYPYW01atQCl8qd/6RpZqmLx5aks846E7YiS6Our53SlMIqu/o0e46ObZGSq37fFAg95ZvHliNtBKHUB6nxQrrizGbMwllrDA0udk/N7E1omRyVcS4RU+DKyAj1aySLXvA1P/XhU077V/2A6ynqIxn5GSUcc0LqQEGCm2OrxnUi2ilAi21ZuN8b19satOAOEGEqrxuXkHKajNCTmzsx6xCnFP4oiQ5TXsgmkpvEqwJtteCPAuHbk5qeFqTGsl9f0wk9ssdKf8IyaCepTJxERAlRXYES8k+g= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 088f3fa7-b9b7-4769-8e03-08d634381970 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Oct 2018 13:54:46.7852 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3205 Subject: Re: [dpdk-dev] [PATCH v3 6/7] hash: enable lock-free reader-writer concurrency 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: Wed, 17 Oct 2018 13:54:49 -0000 > >Subject: [PATCH v3 6/7] hash: enable lock-free reader-writer > >concurrency > > > >Add the flag to enable reader-writer concurrency during run time. The > >rte_hash_del_xxx APIs do not free the keystore element when this flag > >is enabled. Hence a new API, rte_hash_free_key_with_position, to free > >the key store element is added. > > > >Signed-off-by: Honnappa Nagarahalli > >Reviewed-by: Gavin Hu > >Reviewed-by: Ola Liljedahl > >Reviewed-by: Steve Capper > >Reviewed-by: Yipeng Wang > > > >+/** Flag to support lock free reader writer concurrency. Writer can be > >+ * single writer/multi writer. > [Wang, Yipeng] "Writer can be multi-writer when the > RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD flag is also set." Agree. What I am trying to say is that lock free reader writer concurrency = is support for both single writer or multi writer use cases. This was one o= f your questions in the earlier version. > >+ * Currently, extended bucket table feature is not supported with > [Wang, Yipeng] "extendable bucket table", I also used wrong name sometime= s > but please use this one. > >@@ -156,6 +169,10 @@ rte_hash_count(const struct rte_hash *h); > > * and should only be called from one thread by default. > > * Thread safety can be enabled by setting flag during > > * table creation. > >+ * The writer needs to be aware if this API is called to update > >+ * an existing entry. The application should free any memory > >+ * allocated for the existing 'data' only after all the readers > >+ * have stopped referrencing it. > > * > [Wang, Yipeng] > This comment to me is assuming a specific user use case, and not the libr= ary's > responsibility. > How about a more general description: > If the added key is already in the table, the function will update the da= ta of the > key. > In such case, it is the user's responsibility to properly handle the old = data if > the old data is still being referenced by other threads. > Please let me know if I understand it wrong. Your understanding is correct. I have changed the wordings.