From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 9DE86A0096 for ; Thu, 9 May 2019 17:48:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 92F5B3977; Thu, 9 May 2019 17:48:55 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 6F1C62C2B; Thu, 9 May 2019 17:48:54 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 May 2019 08:48:53 -0700 X-ExtLoop1: 1 Received: from orsmsx103.amr.corp.intel.com ([10.22.225.130]) by fmsmga008.fm.intel.com with ESMTP; 09 May 2019 08:48:52 -0700 Received: from orsmsx159.amr.corp.intel.com (10.22.240.24) by ORSMSX103.amr.corp.intel.com (10.22.225.130) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 9 May 2019 08:48:52 -0700 Received: from orsmsx104.amr.corp.intel.com ([169.254.4.183]) by ORSMSX159.amr.corp.intel.com ([169.254.11.86]) with mapi id 14.03.0415.000; Thu, 9 May 2019 08:48:52 -0700 From: "Wang, Yipeng1" To: Dharmik Thakkar , "Gobriel, Sameh" , "Richardson, Bruce" , "De Lara Guarch, Pablo" CC: "dev@dpdk.org" , "honnappa.nagarahalli@arm.com" , "zhongdahulinfan@163.com" , "stable@dpdk.org" Thread-Topic: [PATCH v3 1/3] hash: fix position bug in 'free key with position' Thread-Index: AQHVBmypXNv9bVRD8kaXeAbvgIMG2KZi7Zag Date: Thu, 9 May 2019 15:48:51 +0000 Message-ID: References: <20190508225924.21200-1-dharmik.thakkar@arm.com> <20190509133924.7153-1-dharmik.thakkar@arm.com> <20190509133924.7153-2-dharmik.thakkar@arm.com> In-Reply-To: <20190509133924.7153-2-dharmik.thakkar@arm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNjgzNWI1ZDEtNzQ2Yi00NzZjLTk2MDAtM2FmNmZlYjdlM2YzIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiUFloK2tEUXdcLzEyZnl4bExxQUVMd1wvMXZKNkNmakhEck4wTldoYzhQaVNDV2JqRk5iOE1UbWNQVjRNakhiamg2In0= x-originating-ip: [10.22.254.139] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v3 1/3] hash: fix position bug in 'free key with position' 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" Message-ID: <20190509154851.oq7P54P4PS89F9DCklbsR_oIcG_7E87GOwTtcEbBhww@z> > -----Original Message----- > From: Dharmik Thakkar [mailto:dharmik.thakkar@arm.com] > Sent: Thursday, May 9, 2019 6:39 AM > To: Wang, Yipeng1 ; Gobriel, Sameh > ; Richardson, Bruce = ; > De Lara Guarch, Pablo > Cc: dev@dpdk.org; honnappa.nagarahalli@arm.com; > zhongdahulinfan@163.com; Dharmik Thakkar ; > stable@dpdk.org > Subject: [PATCH v3 1/3] hash: fix position bug in 'free key with position= ' >=20 > Currently, in rte_hash_free_key_with_position(), the position returned to= the > ring of free_slots leads to an unexpected conflict with a key already in = use. >=20 > This patch fixes incorrect position returned to the ring of free_slots. >=20 > Bugzilla ID: 261 > Fixes: 9d033dac7d7c ("hash: support no free on delete") > Cc: honnappa.nagarahalli@arm.com > Cc: stable@dpdk.org >=20 > Reported-by: Linfan > Suggested-by: Linfan > Signed-off-by: Dharmik Thakkar > --- > lib/librte_hash/rte_cuckoo_hash.c | 11 +++++++---- > 1 file changed, 7 insertions(+), 4 deletions(-) >=20 > diff --git a/lib/librte_hash/rte_cuckoo_hash.c > b/lib/librte_hash/rte_cuckoo_hash.c > index 261267b7fd3d..8646ca52e60b 100644 > --- a/lib/librte_hash/rte_cuckoo_hash.c > +++ b/lib/librte_hash/rte_cuckoo_hash.c > @@ -1587,14 +1587,17 @@ int __rte_experimental > rte_hash_free_key_with_position(const struct rte_hash *h, > const int32_t position) > { > - RETURN_IF_TRUE(((h =3D=3D NULL) || (position =3D=3D EMPTY_SLOT)), -EINV= AL); > + /* Key index where key is stored, adding the first dummy index*/ > + uint32_t key_idx =3D position + 1; > + > + RETURN_IF_TRUE(((h =3D=3D NULL) || (key_idx =3D=3D EMPTY_SLOT)), -EINVA= L); >=20 > unsigned int lcore_id, n_slots; > struct lcore_cache *cached_free_slots; > const int32_t total_entries =3D h->num_buckets * > RTE_HASH_BUCKET_ENTRIES; >=20 > /* Out of bounds */ > - if (position >=3D total_entries) > + if (key_idx >=3D total_entries) [Wang, Yipeng]=20 Compiling fail after this commit. /rte_cuckoo_hash.c:1600:14: error: comparison between signed and unsigned i= nteger expressions [-Werror=3Dsign-compare] if (key_idx >=3D total_entries) please fix. Please run the test-build and test-meson-build scripts. I currently have so= me issue with my meson setup on my new system so I will rely on other reviewers or you guys to pass the meson test. Logically these two bug fixes are valid and should be upstreamed otherwise = this API breaks. But this is the experimental tag for :) Thanks Yipeng