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 76E28A0351 for ; Thu, 6 Aug 2020 11:57:43 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 336931C0AE; Thu, 6 Aug 2020 11:57:43 +0200 (CEST) Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by dpdk.org (Postfix) with ESMTP id 56AD91C0AE for ; Thu, 6 Aug 2020 11:57:42 +0200 (CEST) Received: by mail-wr1-f67.google.com with SMTP id y3so43390773wrl.4 for ; Thu, 06 Aug 2020 02:57:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Spf352EQSSdRx6LewWS69go3g4aQ+rzhjCX95+J19VA=; b=TGb3q1ZZVBqiNyCZKG3945OK1MgUK3cSN3q0++EB+WXczdFhd4iw1lj4p9C+61vA+2 dV0PdUKPA0VfLcKHc9/JW1mIcxWFxaknmtlo1AngLKrvLYCMCwdPQNTIDOX2hrJrvCji ECqYhlDO1f1BdiTYwJnxl+0QVSN6gZykvzQvbCEEUo9aN7QyXb8nnZ4n6Q0auf22R5tW oIqT7mMe5ICRqlKw3HwttxuMEUCqydefqoBeq2UPpc8WyYO4kCdWzGZU/GM8T/YGFyiJ d5Oyib0XuPn7Ib+I04QWE5HxyvIiPCcfF/OYzNr0h/V1AnK+XnQesO5XlbpwtOkKYNHK licw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Spf352EQSSdRx6LewWS69go3g4aQ+rzhjCX95+J19VA=; b=FtHkCxoMYzWUV8pwM35kEPyNszrKWU/N2MCiTvEkkbQZCBKNRWPL2ZVM5NNGE+4ptG yVswN1oYNSmIsWawk3U4+odJkUQ9HJZ7gzLwb8qZIIdwN+wMUHNIDWJfQiBMbn70kZSD 5ae/jeDezB2IGYWV3QihhGR44VAnq1jnDKbS92O+vSHDRJfpGDHWtRdG0YyU0VNgNWtk bwv4K/g3lrMnrR7UDL0M9RINO09NlYGROiJDQjMkN2pAZVMsS/AoCmoeSwR0uQC9hUQx EllqZKWvTAHyr+IgbP9lxOpnTnf8wAX1WYajyTA8vUzDl3sSsOowd71GSS4MfTpaaOWr iq6A== X-Gm-Message-State: AOAM533xHwkXSE5+1GYSFpDX/ZzpLXlnT9cDGBAtFv/DeVGKr8XJixT2 TnXtLqiHR638wDpTf73ASUc= X-Google-Smtp-Source: ABdhPJwxbtEIZNRmsD+4UNYrAa6noXzsJwGgHKkZ0pabh6uBHDCh5tKAMnu0FMZnMKhwKuC8ocLggg== X-Received: by 2002:adf:a351:: with SMTP id d17mr6581497wrb.111.1596707861875; Thu, 06 Aug 2020 02:57:41 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id z7sm5712566wmk.6.2020.08.06.02.57.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2020 02:57:41 -0700 (PDT) From: luca.boccassi@gmail.com To: Yunjian Wang Cc: Bin Huang , Honnappa Nagarahalli , Yipeng Wang , dpdk stable Date: Thu, 6 Aug 2020 10:53:29 +0100 Message-Id: <20200806095411.774624-1-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200724120030.1863487-1-luca.boccassi@gmail.com> References: <20200724120030.1863487-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'hash: fix out-of-memory handling in hash creation' has been queued to stable release 19.11.4 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, FYI, your patch has been queued to stable release 19.11.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 08/08/20. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Thanks. Luca Boccassi --- >From 8825b47499d932fea98f7b0c9602ad034610e8d1 Mon Sep 17 00:00:00 2001 From: Yunjian Wang Date: Wed, 22 Jul 2020 11:58:58 +0800 Subject: [PATCH] hash: fix out-of-memory handling in hash creation [ upstream commit a5f803c804c4f75ce7c736a143170c49bb7e72c9 ] The function rte_zmalloc_socket() could return NULL, the return value need to be checked. Fixes: 5915699153d7 ("hash: fix scaling by reducing contention") Reported-by: Bin Huang Signed-off-by: Yunjian Wang Reviewed-by: Honnappa Nagarahalli Acked-by: Yipeng Wang --- lib/librte_hash/rte_cuckoo_hash.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/librte_hash/rte_cuckoo_hash.c b/lib/librte_hash/rte_cuckoo_hash.c index 87a4c01f2..51ebae9cd 100644 --- a/lib/librte_hash/rte_cuckoo_hash.c +++ b/lib/librte_hash/rte_cuckoo_hash.c @@ -144,6 +144,7 @@ rte_hash_create(const struct rte_hash_parameters *params) unsigned int no_free_on_del = 0; uint32_t *ext_bkt_to_free = NULL; uint32_t *tbl_chng_cnt = NULL; + struct lcore_cache *local_free_slots = NULL; unsigned int readwrite_concur_lf_support = 0; rte_hash_function default_hash_func = (rte_hash_function)rte_jhash; @@ -369,9 +370,13 @@ rte_hash_create(const struct rte_hash_parameters *params) #endif if (use_local_cache) { - h->local_free_slots = rte_zmalloc_socket(NULL, + local_free_slots = rte_zmalloc_socket(NULL, sizeof(struct lcore_cache) * RTE_MAX_LCORE, RTE_CACHE_LINE_SIZE, params->socket_id); + if (local_free_slots == NULL) { + RTE_LOG(ERR, HASH, "local free slots memory allocation failed\n"); + goto err_unlock; + } } /* Default hash function */ @@ -402,6 +407,7 @@ rte_hash_create(const struct rte_hash_parameters *params) *h->tbl_chng_cnt = 0; h->hw_trans_mem_support = hw_trans_mem_support; h->use_local_cache = use_local_cache; + h->local_free_slots = local_free_slots; h->readwrite_concur_support = readwrite_concur_support; h->ext_table_support = ext_table_support; h->writer_takes_lock = writer_takes_lock; @@ -447,6 +453,7 @@ err: rte_ring_free(r); rte_ring_free(r_ext); rte_free(te); + rte_free(local_free_slots); rte_free(h); rte_free(buckets); rte_free(buckets_ext); -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-08-06 10:53:15.870047970 +0100 +++ 0001-hash-fix-out-of-memory-handling-in-hash-creation.patch 2020-08-06 10:53:15.696595342 +0100 @@ -1,13 +1,14 @@ -From a5f803c804c4f75ce7c736a143170c49bb7e72c9 Mon Sep 17 00:00:00 2001 +From 8825b47499d932fea98f7b0c9602ad034610e8d1 Mon Sep 17 00:00:00 2001 From: Yunjian Wang Date: Wed, 22 Jul 2020 11:58:58 +0800 Subject: [PATCH] hash: fix out-of-memory handling in hash creation +[ upstream commit a5f803c804c4f75ce7c736a143170c49bb7e72c9 ] + The function rte_zmalloc_socket() could return NULL, the return value need to be checked. Fixes: 5915699153d7 ("hash: fix scaling by reducing contention") -Cc: stable@dpdk.org Reported-by: Bin Huang Signed-off-by: Yunjian Wang @@ -18,18 +19,18 @@ 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/librte_hash/rte_cuckoo_hash.c b/lib/librte_hash/rte_cuckoo_hash.c -index 5f701d579..0a6d47471 100644 +index 87a4c01f2..51ebae9cd 100644 --- a/lib/librte_hash/rte_cuckoo_hash.c +++ b/lib/librte_hash/rte_cuckoo_hash.c -@@ -151,6 +151,7 @@ rte_hash_create(const struct rte_hash_parameters *params) +@@ -144,6 +144,7 @@ rte_hash_create(const struct rte_hash_parameters *params) unsigned int no_free_on_del = 0; uint32_t *ext_bkt_to_free = NULL; uint32_t *tbl_chng_cnt = NULL; + struct lcore_cache *local_free_slots = NULL; unsigned int readwrite_concur_lf_support = 0; - uint32_t i; -@@ -383,9 +384,13 @@ rte_hash_create(const struct rte_hash_parameters *params) + rte_hash_function default_hash_func = (rte_hash_function)rte_jhash; +@@ -369,9 +370,13 @@ rte_hash_create(const struct rte_hash_parameters *params) #endif if (use_local_cache) { @@ -44,7 +45,7 @@ } /* Default hash function */ -@@ -416,6 +421,7 @@ rte_hash_create(const struct rte_hash_parameters *params) +@@ -402,6 +407,7 @@ rte_hash_create(const struct rte_hash_parameters *params) *h->tbl_chng_cnt = 0; h->hw_trans_mem_support = hw_trans_mem_support; h->use_local_cache = use_local_cache; @@ -52,7 +53,7 @@ h->readwrite_concur_support = readwrite_concur_support; h->ext_table_support = ext_table_support; h->writer_takes_lock = writer_takes_lock; -@@ -461,6 +467,7 @@ err: +@@ -447,6 +453,7 @@ err: rte_ring_free(r); rte_ring_free(r_ext); rte_free(te);