From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7825CA0598 for ; Sat, 18 Apr 2020 12:00:31 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 590721E955; Sat, 18 Apr 2020 12:00:31 +0200 (CEST) Received: from huawei.com (szxga03-in.huawei.com [45.249.212.189]) by dpdk.org (Postfix) with ESMTP id 3655B1E92D; Sat, 18 Apr 2020 12:00:15 +0200 (CEST) Received: from dggeml406-hub.china.huawei.com (unknown [172.30.72.53]) by Forcepoint Email with ESMTP id 74C2A9AA3CAA01D24015; Sat, 18 Apr 2020 18:00:12 +0800 (CST) Received: from DGGEML424-HUB.china.huawei.com (10.1.199.41) by dggeml406-hub.china.huawei.com (10.3.17.50) with Microsoft SMTP Server (TLS) id 14.3.487.0; Sat, 18 Apr 2020 18:00:11 +0800 Received: from DGGEML529-MBX.china.huawei.com ([169.254.6.71]) by dggeml424-hub.china.huawei.com ([10.1.199.41]) with mapi id 14.03.0487.000; Sat, 18 Apr 2020 18:00:09 +0800 From: "Lilijun (Jerry)" To: "'dev@dpdk.org'" , "'stable@dpdk.org'" Thread-Topic: rte_hash bug: can't iterate all entries when deleting keys in rte_hash iterate loop. Thread-Index: AdYVYgMWpFq5RHj2QzGPZAYcXd4MGQ== Date: Sat, 18 Apr 2020 10:00:09 +0000 Message-ID: <40280F65B1B0B44E8089ED31C01616EBA496BC2A@dggeml529-mbx.china.huawei.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.173.251.98] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-CFilter-Loop: Reflected Subject: [dpdk-stable] rte_hash bug: can't iterate all entries when deleting keys in rte_hash iterate loop. X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi all, In my test, entries can't be cleanup in rte_hash table when deleting ke= ys in rte_hash iterate loop. The test steps: 1. create a hash table table1 with limit 30000, ext bucket enabled, a= nd insert 30000 entries into this hash table. 2. create a larger hash table table2 with limit 60000, , ext bucket en= abled. 3. iterate all entries of table1 and insert them to the table2. Insert= new 10000 entries to this table2. 4. Then flush all entries from table2 by deleting keys in rte_hash ite= rate loop. But there are still some keys leaked in table2. From my analysis, the keys idx are stored in rte_hash main bucket key s= lots and extend bucket key stots.=20 We iterate every no empty Keys in h->buckets and h->buckets_ext from st= art to last.=20 When deleting keys the function __rte_hash_compact_ll() may move last_b= kt's key to previous bucket in order to compact extend bucket list. If the previous bucket has been iterated, the moved key may be missed f= or users.=20 Then those missed keys are leaked and rte_hash table can't be cleanup. Now I retry the iterate and delete keys, that can avoid this bug.=20 Is there any ideas or solutions on this bug? Thanks. Jerry.