From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20080.outbound.protection.outlook.com [40.107.2.80]) by dpdk.org (Postfix) with ESMTP id 986B04C9D for ; Thu, 4 Oct 2018 05:54:27 +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=o/RFmzfTB6Fk6Edqrev8Nh9Fe9Asc5j2SZClvmclVT0=; b=KeWBy3a8WN4ZKEMuMnCSIvw8JciQVAY2m2/LZASUCx0LeyptY2iU7ANpgzcnkDZAFHTmJcbhk4R0a70YmsDmFyCN0DddyQOf53GK+q2+csJgCFCaE+ZTra1g6NuM1b/HQ2wgs8vBoqWQiTJ7FAt3YzR4VwH26A9J+vYF1HfBqmw= Received: from AM6PR08MB3672.eurprd08.prod.outlook.com (20.177.115.29) by AM6PR08MB3112.eurprd08.prod.outlook.com (52.135.163.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.21; Thu, 4 Oct 2018 03:54:24 +0000 Received: from AM6PR08MB3672.eurprd08.prod.outlook.com ([fe80::f423:e46a:a03c:e928]) by AM6PR08MB3672.eurprd08.prod.outlook.com ([fe80::f423:e46a:a03c:e928%2]) with mapi id 15.20.1185.027; Thu, 4 Oct 2018 03:54:24 +0000 From: Honnappa Nagarahalli To: Honnappa Nagarahalli , "Wang, Yipeng1" , "Van Haaren, Harry" , "Richardson, Bruce" CC: "De Lara Guarch, Pablo" , "dev@dpdk.org" , "Gavin Hu (Arm Technology China)" , Steve Capper , Ola Liljedahl , nd , "Gobriel, Sameh" Thread-Topic: [dpdk-dev] [PATCH 3/4] hash: fix rw concurrency while moving keys Thread-Index: AQHUW5Xw2wBr13Jifk2sKcwDGjOrOw== Date: Thu, 4 Oct 2018 03:54:24 +0000 Message-ID: References: <1536253938-192391-1-git-send-email-honnappa.nagarahalli@arm.com> <1536253938-192391-4-git-send-email-honnappa.nagarahalli@arm.com> <20180928082610.GA7592@bricha3-MOBL.ger.corp.intel.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; AM6PR08MB3112; 6:lAckvxTibkHBDSHg9Firf/PnmAxB0EfKEQ8CunDOlAbtoQftwV6hJrr/qVSvKERMOJjj+UmdOIb4wI3bt8sIVh7KqL/o4QDoi3j5wAIVbR7Hjyo+Sykpx6ehAlaiPv2LqB0rNqj/BmCnQL7MRDsViKNk7SeeAZ6E4vM5XnymjTF5vo6ffoiqYioOYdqCHaGX8wrUWUXhEpY5G03vTQLCXtdF8EEwWJQfKQjmWIPIKxJqUQXNTQP0kxKw24XoOnT6jQmBRWl2h0fSKtTWQ9dY+93ytz2j0/kkMHzSvUlTFpiTFnbqUct3Ednt0u2g3r4REgUCK9FHUcGyemxHZMlpxvTxSqv+sNyDQL4hvKDNA7pIyx5PaJI99C5C0ZkT+U85mj+GAufac5z17567gigjW6+fZNl7s3/rSC0cfyl1eaBOFs6+j+kOLhNhNH+ADwKzjeO0fPOTNufLNDO09b8U6Q==; 5:sYo6J/nWsnVB4LJlShX7KzrCHcN7t8DoyCb6rbXYeQbiIuONBImJUph8EGNkDafm4fW1EDBoSQw8HmrwV/hIxA1E0hCQGBNWerEFev0zsp3vWGCOvQdXpXvIGqxc5BcbDtQotylKMD9V0xvSiLthHf0QmXmIsZCsLFeo6WnsdDA=; 7:asfQjMB7av2+e4Q2M4dIlxvXqZnR8jFO/08N5GFhKnwLf4cREETnAr5bFBd01JEwdIEC4h4UYtBCLFq8a3rLT2+JrMl+1GH5/byrDkkcKxa1gxYc3vVvI7yoTAepberkXTtHL1elFqR6tt2EvZyBcfGRu3To7dH4ung1BagIIqIMrZWrq3lREpG6QUGrob1yK+Jz7Yan1zVzSSUgrvY6ydfXO6jFmtugQI/2omYmBMbnZyMxdXrhmIMxWA73M1Tj x-ms-exchange-antispam-srfa-diagnostics: SOS;SOR; x-ms-office365-filtering-correlation-id: 9cc41eee-1543-49f0-baa0-08d629ad132b x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM6PR08MB3112; x-ms-traffictypediagnostic: AM6PR08MB3112: nodisclaimer: True x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(3231355)(944501410)(52105095)(93006095)(93001095)(10201501046)(6055026)(149066)(150057)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(20161123562045)(201708071742011)(7699051); SRVR:AM6PR08MB3112; BCL:0; PCL:0; RULEID:; SRVR:AM6PR08MB3112; x-forefront-prvs: 0815F8251E x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(396003)(346002)(376002)(136003)(366004)(57704003)(199004)(13464003)(189003)(14454004)(105586002)(66066001)(6246003)(478600001)(8936002)(106356001)(6306002)(9686003)(53936002)(486006)(5660300001)(55016002)(229853002)(6436002)(476003)(68736007)(5250100002)(81166006)(256004)(81156014)(72206003)(14444005)(97736004)(74316002)(11346002)(446003)(7696005)(6506007)(305945005)(76176011)(7736002)(71190400001)(2906002)(71200400001)(2900100001)(110136005)(186003)(99286004)(316002)(54906003)(25786009)(6116002)(26005)(3846002)(86362001)(102836004)(4326008)(93886005)(33656002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR08MB3112; 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: b9i5nnYaigUtSFn7kqz736WH6dA2ydLO9KzVfGLzFgrpglDOG3erftziqZPa5PPZvuOhHFAHeX2nGx2Efa7Aiec+ickc7zsGRrSFgZIsFDxT2B2XRCJhJMt9qSaN7qnoZZkzHqV7+pvFsA+i1fyLjYsA1e6X9wj2s5U1ZAThYsp1doAgHnN1FdPhtEv59VXLGbMtIISt0RTW0hFKReJzuqSy/m8Y/77lXIxxaVYjtEm2OfiEh3rYfk93tuai8NuA+9UomBtdWrHicTLP4wTU7epKrNvEiZGzfu4369WyYRXHo2rK/TMHtUv0hFgJk++F0k3ST2YuW0AdCa+TtyfctIxbcD1a/+RqYOImiTwVDH8= 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: 9cc41eee-1543-49f0-baa0-08d629ad132b X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Oct 2018 03:54:24.6280 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3112 Subject: Re: [dpdk-dev] [PATCH 3/4] hash: fix rw concurrency while moving keys 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: Thu, 04 Oct 2018 03:54:27 -0000 >=20 > > >-----Original Message----- > > >From: Van Haaren, Harry > > >> > > > > /** > > >> > > > > * Add a key to an existing hash table. > > >> > > > >@@ -222,7 +222,7 @@ rte_hash_add_key(const struct rte_hash > > >> > > > >*h, const void > > >> > > *key); > > >> > > > > * array of user data. This value is unique for this key= . > > >> > > > > */ > > >> > > > > int32_t > > >> > > > >-rte_hash_add_key_with_hash(const struct rte_hash *h, const > > >> > > > >void *key, > > >> > > hash_sig_t sig); > > >> > > > >+rte_hash_add_key_with_hash(struct rte_hash *h, const void > > >> > > > >+*key, > > >> > > hash_sig_t sig); > > >> > > > > > > >> > > > > / > > >> > > > > > >> > > > I think the above changes will break ABI by changing the > > >> > > > parameter > > >> type? > > >> > > Other people may know better on this. > > >> > > > > >> > > Just removing a const should not change the ABI, I believe, > > >> > > since the const is just advisory hint to the compiler. Actual > > >> > > parameter size and count remains unchanged so I don't believe th= ere > is an issue. > > >> > > [ABI experts, please correct me if I'm wrong on this] > > >> > > > >> > > > >> > [Certainly no ABI expert, but...] > > >> > > > >> > I think this is an API break, not ABI break. > > >> > > > >> > Given application code as follows, it will fail to compile - even > > >> > though > > >> running > > >> > the new code as a .so wouldn't cause any issues (AFAIK). > > >> > > > >> > void do_hash_stuff(const struct rte_hash *h, ...) { > > >> > /* parameter passed in is const, but updated function > > >> > prototype is > > >> non- > > >> > const */ > > >> > rte_hash_add_key_with_hash(h, ...); } > > >> > > > >> > This means that we can't recompile apps against latest patch > > >> > without application code changes, if the app was passing a const > > >> > rte_hash struct > > >> as > > >> > the first parameter. > > >> > > > >> Agree. Do we need to do anything for this? > > > > > >I think we should try to avoid breaking API wherever possible. > > >If we must, then I suppose we could follow the ABI process of a > > >deprecation notice. > > > > > >From my reading of the versioning docs, it doesn't document this case: > > >https://doc.dpdk.org/guides/contributing/versioning.html > > > > > >I don't recall a similar situation in DPDK previously - so I suggest > > >you ask Tech board for input here. > > > > > >Hope that helps! -Harry > > [Wang, Yipeng] > > Honnappa, how about use a pointer to the counter in the rte_hash > > struct instead of the counter? Will this avoid API change? > I think it defeats the purpose of 'const' parameter to the API and provid= es > incorrect information to the user. Yipeng, I think I have misunderstood your comment. I believe you meant; we = could allocate memory to the counter and store the pointer in the structure= . Please correct me if I am wrong. This could be a solution, though it will be another cache line access. It m= ight be ok given that it is a single cache line for entire hash table. > IMO, DPDK should have guidelines on how to handle the API compatibility > breaks. I will send an email to tech board on this. > We can also solve this by having counters on the bucket. I was planning t= o do > this little bit later. I will look at the effort involved and may be do i= t now.