From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0083.outbound.protection.outlook.com [104.47.1.83]) by dpdk.org (Postfix) with ESMTP id A392F5F33 for ; Thu, 4 Oct 2018 05:32:10 +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=OuABUswEJxHiFxsPDaKrYiLb0FLs6t/miLl7f406h7g=; b=VAQgkeh+gYUDnMjQNja5OKrEWZW5wSNudxdxB/35+60hODyrhvuiz8uYk6fwyy9mgPt5ear7VBlAAcWZaMWBi9S84lPDfoHwizdNX1e+yyc1FYSfOzOPS0fcdu+JGu8CuKdqwnxSSscKuqbMaXL5nP1+lf+kIl5zyK0WakpZP8s= Received: from AM6PR08MB3672.eurprd08.prod.outlook.com (20.177.115.29) by AM6PR08MB3111.eurprd08.prod.outlook.com (52.135.163.160) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.23; Thu, 4 Oct 2018 03:32:08 +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:32:08 +0000 From: Honnappa Nagarahalli To: "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" , Honnappa Nagarahalli Thread-Topic: [dpdk-dev] [PATCH 3/4] hash: fix rw concurrency while moving keys Thread-Index: AQHUWQ2TA27X9NBsCE+C+fB5/YkDUqUJ4m0AgAKJQACAAD1o4IABIbUwgAAH74CAAKAAEA== Date: Thu, 4 Oct 2018 03:32:08 +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; AM6PR08MB3111; 6:eyDttFyyZRCorWXh+mn5GgWTpSUn4lawQnYBG6eoLchZq0Qe/nD4nSeFQkKtnGaGEIijoLlkDsw2eUDFSQO7KiUpK2Ov96+dQNrLwAViWJ4s9GG+RCAeP0fpmxkQ9JMH5oVkQH0iEddsxy5/c5IP7hEyATMKIxWidX6qJxdPiPn9L8vmGVanNpnBFvDUyfTYa+cBf3l+pMcgiMReKrtE9/k9JkIXssrQLClvrWP/QGaV8+XNAbPAAjNgD9eLSJY6TcLP071pA3WsCTL5iRX/ha+kBMf3BXCGelNtKJenRwHE5kYgwIjCT/dCB5hgfNKQBEUA5l4wQi+ZQGDza6ObemIhzpFszD55F6+qJyIEBbKAHMKMoGdHu10SqPkrPLegv8p11xzh4Am/r2NPBy1MHIO63DFNcsUXgZvTydJpNTSTeWoy0F9MjJDaYqye8TLeHUizQbvUz08e/0oFeDv6jA==; 5:0NWCavQ+v8dq326y6E2k80Km9vqJAmKzFRjX69XLUIKJjjTUMVa0QsGCYqczh8zvGj7Yv2c1MSq8FU8livW8OGYzDpeoIoKQOxsPBPDQfT4os0/924RplRGsRkHjJuJOnIHeLMjTm8LxQMcy9DaIC/QqnqQgD1IhmwitsLSZh88=; 7:8tWVs0xkUjjkNZyB3i/NL07wcebuU5HHKSh2neuI2IXUzrQeZm5pjqB2f2O3zCxwaUyTCr3ZnhtQMm9aBr4t5Um2LNW12TVVFBcmQMsZVSk15KQSTKMcVtIdswwPiLtxe3ZjlifBcwkXmGLAmwayTEcaiBRWIVpU5TTps837FYXFYlWeTLsFdQB1Bj2UogiHoFMAeZDyZO2G/SPjFi90SbmReGbEjKiq3XqUdMz9Ov3lXxKlY7YoB81ZwqaKVqW8 x-ms-exchange-antispam-srfa-diagnostics: SOS;SOR; x-ms-office365-filtering-correlation-id: 55a9f172-3e57-423b-32c0-08d629a9f6f3 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:AM6PR08MB3111; x-ms-traffictypediagnostic: AM6PR08MB3111: 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)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3002001)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(20161123560045)(20161123564045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(201708071742011)(7699051); SRVR:AM6PR08MB3111; BCL:0; PCL:0; RULEID:; SRVR:AM6PR08MB3111; x-forefront-prvs: 0815F8251E x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(376002)(366004)(346002)(396003)(39860400002)(189003)(199004)(57704003)(13464003)(110136005)(54906003)(229853002)(33656002)(478600001)(3846002)(81166006)(81156014)(6116002)(186003)(9686003)(6436002)(74316002)(305945005)(6306002)(7736002)(7696005)(76176011)(72206003)(5250100002)(8936002)(26005)(99286004)(68736007)(86362001)(5660300001)(93886005)(256004)(14444005)(316002)(71200400001)(71190400001)(106356001)(105586002)(2906002)(486006)(66066001)(97736004)(11346002)(476003)(446003)(14454004)(102836004)(25786009)(2900100001)(6506007)(55016002)(4326008)(53936002)(6246003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR08MB3111; H:AM6PR08MB3672.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 7OoxAHGTAuUoGSGMQ366RoyhwRWjTJApsQt0CP1xqDpvvh9+R493yFMOomvDLOWfMNZE+k7GNRS2Z1mPu+Ypd827Wpx8CAF8NYRSpoj7wyUaC7AGb0jXprFc2DKe7PiuFCp+y8tW/Yx30Xg9gJP8f8NdKNzzEL2qbbgVwl9yyckh9NO+t+xJm3MVqEGooX7b5ikHlmskBe782VsWfFVpgB11nOrRlmw//6fTaoQitpAWxMqb42fNe2auIvabEt4eacbiy2Cc9aWrY+kalytoz7JjcuwfHend6aT+qlX4GsuqxHDjRNGpJDxWNLnIplBnq9dt/488E1X47s+0ObKExaMDr87MiLYlhiqhJgNQZm8= 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: 55a9f172-3e57-423b-32c0-08d629a9f6f3 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Oct 2018 03:32:08.8224 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3111 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:32:10 -0000 > > > >> >-----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 ke= y. > >> >> > > > > */ > >> >> > > > > 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 > there 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 provi= des > incorrect information to the user. > >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 > >to do this little bit later. I will look at the effort involved and may = be do it > now. > [Wang, Yipeng] > I think with ABI/API change, you might need to announce it one release cy= cle > ahead. >=20 > In the cuckoo switch paper: Scalable, High Performance Ethernet Forwardin= g > with CUCKOOSWITCH it separates the version counter array and the hash > table. You can strike a balance between granularity of the version counte= r and > the cache/memory requirement. > Is it a better way? This will introduce another cache line access. It would be good to stay wit= hin the single cacheline. >=20 > Another consideration is current bucket is 64-byte exactly with the parti= al- > key-hashing. > To add another counter, we need to think about changing certain variables= to > still align cache line. The 'flags' structure member is not being used. I plan to remove that. That= will give us 8B, I will use 4B out of it for the counter.