From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140049.outbound.protection.outlook.com [40.107.14.49]) by dpdk.org (Postfix) with ESMTP id B0C9337B7; Thu, 9 May 2019 19:25: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=pq+EdYCl3EMJxPS+Sm041DB8b9XsaGRnJLB1+9aXlZ8=; b=WxdOhAhv2c2YIXvG0+V1giJZCW3egg043cb0PoH5NZ/5EvUmSdTOPk7roGpw8K21koxzslvlrkNz7gFv5vXtNrm1JFVUcQJozHCV6thnpsFMnYMYpvDERRLVaaJYYxtZhu2CZxApOnzBlhto+29CwMMj3zZYGToG5ljKCTXEVo8= Received: from AM0PR08MB3379.eurprd08.prod.outlook.com (20.177.109.142) by AM0PR08MB3764.eurprd08.prod.outlook.com (20.178.22.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1878.20; Thu, 9 May 2019 17:25:09 +0000 Received: from AM0PR08MB3379.eurprd08.prod.outlook.com ([fe80::b5af:c4b5:376e:ab19]) by AM0PR08MB3379.eurprd08.prod.outlook.com ([fe80::b5af:c4b5:376e:ab19%7]) with mapi id 15.20.1856.012; Thu, 9 May 2019 17:25:09 +0000 From: Dharmik Thakkar To: "Wang, Yipeng1" CC: "Gobriel, Sameh" , "Richardson, Bruce" , "De Lara Guarch, Pablo" , "dev@dpdk.org" , Honnappa Nagarahalli , "zhongdahulinfan@163.com" , "stable@dpdk.org" , nd Thread-Topic: [PATCH v3 1/3] hash: fix position bug in 'free key with position' Thread-Index: AQHVBmylr5zA2kRoLk2AGWIhlMRncqZi8IuAgAAa5wA= Date: Thu, 9 May 2019 17:25:09 +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: 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=Dharmik.Thakkar@arm.com; x-originating-ip: [2605:6000:eb05:8c00:24c5:f0b2:4333:62a3] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 7c65da05-bb45-4217-f824-08d6d4a34935 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(4618075)(2017052603328)(7193020); SRVR:AM0PR08MB3764; x-ms-traffictypediagnostic: AM0PR08MB3764: nodisclaimer: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-forefront-prvs: 003245E729 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(396003)(136003)(376002)(39860400002)(346002)(199004)(189003)(13464003)(66446008)(66946007)(66556008)(66476007)(54906003)(64756008)(36756003)(256004)(2906002)(91956017)(53936002)(316002)(14444005)(73956011)(4326008)(76116006)(8676002)(6246003)(6116002)(25786009)(46003)(86362001)(186003)(102836004)(82746002)(33656002)(486006)(476003)(68736007)(446003)(11346002)(2616005)(6916009)(53546011)(83716004)(71190400001)(71200400001)(6486002)(6436002)(6506007)(5660300002)(229853002)(76176011)(6512007)(14454004)(8936002)(81156014)(81166006)(478600001)(305945005)(72206003)(99286004)(7736002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR08MB3764; H:AM0PR08MB3379.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: Dn/MCmbyk8OlWDZlYmepgWKH6erdHGdvj+8GCe/uzmpva+oPy3F/8pk4DiT7uVr6nwukf42c5u4LaIh1uxswpQin4b4j5c/fZW3JYQZCFrChbca8rk+a2dz7o8Op32kTPq+sReOsRa1BBq7AMCcSG6ifqgUqFjNkJKglLUWFtmWxLtqSZMT+B6abZBs0bHGoSlilcb2sKYmC8XQDnmTIIKkCdAS9TdhcdC346lBgRuZZuHpELBeNd7CPWxTOY8XOLSAb/jysXF+KGilJDT/5b+Og7hcgCdloPdpj7YuYWOOx+u0XwXgr2lsTsnQ+aLU+PVpxGwbMHdASRUEf96HanPSBLWIHKRHQfrt/vfzONMMDIm5vDwwI0SxBXlX+E5xNyMMYgzX0ACStyvHW6tRq61b3cl9PrRgu9u0rX9jAKYc= Content-Type: text/plain; charset="us-ascii" Content-ID: <3CDA4FF6D1BB24438C06ED5E37C5640F@eurprd08.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7c65da05-bb45-4217-f824-08d6d4a34935 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 May 2019 17:25:09.1146 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3764 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: , X-List-Received-Date: Thu, 09 May 2019 17:25:11 -0000 > On May 9, 2019, at 10:48 AM, Wang, Yipeng1 wrote= : >=20 >> -----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 positio= n' >>=20 >> Currently, in rte_hash_free_key_with_position(), the position returned t= o 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)), -EIN= VAL); >> + /* 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)), -EINV= AL); >>=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= integer expressions [-Werror=3Dsign-compare] > if (key_idx >=3D total_entries) > please fix. Thank you for reporting! I have fixed the issue and updated the patch. >=20 > Please run the test-build and test-meson-build scripts. I currently have = some issue with my meson setup on my new system so I will > rely on other reviewers or you guys to pass the meson test. I ran the scripts on my setup. Thanks! >=20 > Logically these two bug fixes are valid and should be upstreamed otherwis= e this API breaks. But this is the experimental tag for :) >=20 > Thanks > Yipeng 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 DD111A0096 for ; Thu, 9 May 2019 19:25:13 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1F28D49E0; Thu, 9 May 2019 19:25:12 +0200 (CEST) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140049.outbound.protection.outlook.com [40.107.14.49]) by dpdk.org (Postfix) with ESMTP id B0C9337B7; Thu, 9 May 2019 19:25: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=pq+EdYCl3EMJxPS+Sm041DB8b9XsaGRnJLB1+9aXlZ8=; b=WxdOhAhv2c2YIXvG0+V1giJZCW3egg043cb0PoH5NZ/5EvUmSdTOPk7roGpw8K21koxzslvlrkNz7gFv5vXtNrm1JFVUcQJozHCV6thnpsFMnYMYpvDERRLVaaJYYxtZhu2CZxApOnzBlhto+29CwMMj3zZYGToG5ljKCTXEVo8= Received: from AM0PR08MB3379.eurprd08.prod.outlook.com (20.177.109.142) by AM0PR08MB3764.eurprd08.prod.outlook.com (20.178.22.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1878.20; Thu, 9 May 2019 17:25:09 +0000 Received: from AM0PR08MB3379.eurprd08.prod.outlook.com ([fe80::b5af:c4b5:376e:ab19]) by AM0PR08MB3379.eurprd08.prod.outlook.com ([fe80::b5af:c4b5:376e:ab19%7]) with mapi id 15.20.1856.012; Thu, 9 May 2019 17:25:09 +0000 From: Dharmik Thakkar To: "Wang, Yipeng1" CC: "Gobriel, Sameh" , "Richardson, Bruce" , "De Lara Guarch, Pablo" , "dev@dpdk.org" , Honnappa Nagarahalli , "zhongdahulinfan@163.com" , "stable@dpdk.org" , nd Thread-Topic: [PATCH v3 1/3] hash: fix position bug in 'free key with position' Thread-Index: AQHVBmylr5zA2kRoLk2AGWIhlMRncqZi8IuAgAAa5wA= Date: Thu, 9 May 2019 17:25:09 +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: 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=Dharmik.Thakkar@arm.com; x-originating-ip: [2605:6000:eb05:8c00:24c5:f0b2:4333:62a3] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 7c65da05-bb45-4217-f824-08d6d4a34935 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(4618075)(2017052603328)(7193020); SRVR:AM0PR08MB3764; x-ms-traffictypediagnostic: AM0PR08MB3764: nodisclaimer: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-forefront-prvs: 003245E729 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(396003)(136003)(376002)(39860400002)(346002)(199004)(189003)(13464003)(66446008)(66946007)(66556008)(66476007)(54906003)(64756008)(36756003)(256004)(2906002)(91956017)(53936002)(316002)(14444005)(73956011)(4326008)(76116006)(8676002)(6246003)(6116002)(25786009)(46003)(86362001)(186003)(102836004)(82746002)(33656002)(486006)(476003)(68736007)(446003)(11346002)(2616005)(6916009)(53546011)(83716004)(71190400001)(71200400001)(6486002)(6436002)(6506007)(5660300002)(229853002)(76176011)(6512007)(14454004)(8936002)(81156014)(81166006)(478600001)(305945005)(72206003)(99286004)(7736002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR08MB3764; H:AM0PR08MB3379.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: Dn/MCmbyk8OlWDZlYmepgWKH6erdHGdvj+8GCe/uzmpva+oPy3F/8pk4DiT7uVr6nwukf42c5u4LaIh1uxswpQin4b4j5c/fZW3JYQZCFrChbca8rk+a2dz7o8Op32kTPq+sReOsRa1BBq7AMCcSG6ifqgUqFjNkJKglLUWFtmWxLtqSZMT+B6abZBs0bHGoSlilcb2sKYmC8XQDnmTIIKkCdAS9TdhcdC346lBgRuZZuHpELBeNd7CPWxTOY8XOLSAb/jysXF+KGilJDT/5b+Og7hcgCdloPdpj7YuYWOOx+u0XwXgr2lsTsnQ+aLU+PVpxGwbMHdASRUEf96HanPSBLWIHKRHQfrt/vfzONMMDIm5vDwwI0SxBXlX+E5xNyMMYgzX0ACStyvHW6tRq61b3cl9PrRgu9u0rX9jAKYc= Content-Type: text/plain; charset="UTF-8" Content-ID: <3CDA4FF6D1BB24438C06ED5E37C5640F@eurprd08.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7c65da05-bb45-4217-f824-08d6d4a34935 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 May 2019 17:25:09.1146 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3764 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: <20190509172509.SQmoClYay_kBHo__oR9trV2POLeK03U-rFjynEFL5UE@z> > On May 9, 2019, at 10:48 AM, Wang, Yipeng1 wrote= : >=20 >> -----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 positio= n' >>=20 >> Currently, in rte_hash_free_key_with_position(), the position returned t= o 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)), -EIN= VAL); >> + /* 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)), -EINV= AL); >>=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= integer expressions [-Werror=3Dsign-compare] > if (key_idx >=3D total_entries) > please fix. Thank you for reporting! I have fixed the issue and updated the patch. >=20 > Please run the test-build and test-meson-build scripts. I currently have = some issue with my meson setup on my new system so I will > rely on other reviewers or you guys to pass the meson test. I ran the scripts on my setup. Thanks! >=20 > Logically these two bug fixes are valid and should be upstreamed otherwis= e this API breaks. But this is the experimental tag for :) >=20 > Thanks > Yipeng