From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 119062C8 for ; Fri, 7 Jul 2017 15:55:39 +0200 (CEST) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Jul 2017 06:55:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,323,1496127600"; d="scan'208";a="123859995" Received: from irsmsx106.ger.corp.intel.com ([163.33.3.31]) by fmsmga005.fm.intel.com with ESMTP; 07 Jul 2017 06:55:37 -0700 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.133]) by IRSMSX106.ger.corp.intel.com ([169.254.8.236]) with mapi id 14.03.0319.002; Fri, 7 Jul 2017 14:55:36 +0100 From: "De Lara Guarch, Pablo" To: "De Lara Guarch, Pablo" , mstolarchuk , "Richardson, Bruce" CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] __rte_hash_add_key_with_hash not releasing multiwriter_lock in failure paths Thread-Index: AQHS9Z4wn/PYjLJVzki2V9GfbLTMEqJIZehw Date: Fri, 7 Jul 2017 13:55:36 +0000 Message-ID: References: <1495801830-36849-1-git-send-email-mike.stolarchuk@bigswitch.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 10.0.102.7 dlp-reaction: no-action x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] __rte_hash_add_key_with_hash not releasing multiwriter_lock in failure paths 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: Fri, 07 Jul 2017 13:55:40 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of De Lara Guarch, > Pablo > Sent: Wednesday, July 5, 2017 3:51 PM > To: mstolarchuk ; Richardson, Bruce > > Cc: dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH] __rte_hash_add_key_with_hash not > releasing multiwriter_lock in failure paths >=20 >=20 >=20 > > -----Original Message----- > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of mstolarchuk > > Sent: Friday, May 26, 2017 1:31 PM > > To: bruce.richardson@intel.co > > Cc: dev@dpdk.org > > Subject: [dpdk-dev] [PATCH] __rte_hash_add_key_with_hash not > releasing > > multiwriter_lock in failure paths > > > > Signed-off-by: mstolarchuk > > --- > > lib/librte_hash/rte_cuckoo_hash.c | 13 +++++++++---- > > 1 file changed, 9 insertions(+), 4 deletions(-) > > > > diff --git a/lib/librte_hash/rte_cuckoo_hash.c > > b/lib/librte_hash/rte_cuckoo_hash.c > > index 645c0cf..37a8110 100644 > > --- a/lib/librte_hash/rte_cuckoo_hash.c > > +++ b/lib/librte_hash/rte_cuckoo_hash.c > > @@ -538,8 +538,10 @@ struct rte_hash * > > n_slots =3D rte_ring_mc_dequeue_burst(h- > > >free_slots, > > cached_free_slots->objs, > > LCORE_CACHE_SIZE, NULL); > > - if (n_slots =3D=3D 0) > > - return -ENOSPC; > > + if (n_slots =3D=3D 0) { > > + ret =3D -ENOSPC; > > + goto failure; > > + } > > > > cached_free_slots->len +=3D n_slots; > > } > > @@ -548,8 +550,10 @@ struct rte_hash * > > cached_free_slots->len--; > > slot_id =3D cached_free_slots->objs[cached_free_slots->len]; > > } else { > > - if (rte_ring_sc_dequeue(h->free_slots, &slot_id) !=3D 0) > > - return -ENOSPC; > > + if (rte_ring_sc_dequeue(h->free_slots, &slot_id) !=3D 0) { > > + ret =3D -ENOSPC; > > + goto failure; > > + } > > } > > > > new_k =3D RTE_PTR_ADD(keys, (uintptr_t)slot_id * h- > > >key_entry_size); @@ -659,6 +663,7 @@ struct rte_hash * > > /* Error in addition, store new slot back in the ring and return > > error */ > > enqueue_slot_back(h, cached_free_slots, (void *)((uintptr_t) > > new_idx)); > > > > +failure: > > if (h->add_key =3D=3D ADD_KEY_MULTIWRITER) > > rte_spinlock_unlock(h->multiwriter_lock); > > return ret; > > -- > > 1.9.1 >=20 > Hi Mike, >=20 > Thanks for the patch, it looks correct to me. > The code is fine, but the commit message needs some rework. > Title should start with: "hash: ...", since this is aiming the hash libra= ry, So > the title could be: "hash: fix lock release on add" >=20 > Then, some explanation on what the fix is doing would be good. >=20 > Lastly, since this is a fix, it requires a fixes line and CC to the stabl= e branch: >=20 > Fixes: be856325cba3 ("hash: add scalable multi-writer insertion with Inte= l > TSX") > CC: stable@dpdk.org FYI, I just submitted a v2 with the commit fixed for you, as you might not = be available these days and the RC1 will be created soon. Pablo >=20 > Thanks, > Pablo