From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 350A7A0542; Sun, 9 Oct 2022 15:37:45 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 07E0A40146; Sun, 9 Oct 2022 15:37:45 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 2A8B0400D5 for ; Sun, 9 Oct 2022 15:37:43 +0200 (CEST) Received: by shelob.oktetlabs.ru (Postfix, from userid 115) id C88207D; Sun, 9 Oct 2022 16:37:42 +0300 (MSK) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mail1.oktetlabs.ru X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=ALL_TRUSTED, DKIM_ADSP_DISCARD autolearn=no autolearn_force=no version=3.4.6 Received: from aros.oktetlabs.ru (aros.oktetlabs.ru [192.168.38.17]) by shelob.oktetlabs.ru (Postfix) with ESMTP id 53BF169; Sun, 9 Oct 2022 16:37:41 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 53BF169 Authentication-Results: shelob.oktetlabs.ru/53BF169; dkim=none; dkim-atps=neutral From: Andrew Rybchenko To: Olivier Matz Cc: dev@dpdk.org, =?UTF-8?q?Morten=20Br=C3=B8rup?= , Bruce Richardson Subject: [PATCH v6 1/4] mempool: check driver enqueue result in one place Date: Sun, 9 Oct 2022 16:37:34 +0300 Message-Id: <20221009133737.795377-2-andrew.rybchenko@oktetlabs.ru> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221009133737.795377-1-andrew.rybchenko@oktetlabs.ru> References: <98CBD80474FA8B44BF855DF32C47DC35D86DB2@smartserver.smartshare.dk> <20221009133737.795377-1-andrew.rybchenko@oktetlabs.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Enqueue operation must not fail. Move corresponding debug check from one particular case to dequeue operation helper in order to do it for all invocations. Log critical message with useful information instead of rte_panic(). Make rte_mempool_do_generic_put() implementation more readable and fix incosistency when return value is not checked in one place and checked in another. Signed-off-by: Andrew Rybchenko Reviewed-by: Morten Brørup --- lib/mempool/rte_mempool.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/mempool/rte_mempool.h b/lib/mempool/rte_mempool.h index 2401c4ac80..bc29d49aab 100644 --- a/lib/mempool/rte_mempool.h +++ b/lib/mempool/rte_mempool.h @@ -786,12 +786,19 @@ rte_mempool_ops_enqueue_bulk(struct rte_mempool *mp, void * const *obj_table, unsigned n) { struct rte_mempool_ops *ops; + int ret; RTE_MEMPOOL_STAT_ADD(mp, put_common_pool_bulk, 1); RTE_MEMPOOL_STAT_ADD(mp, put_common_pool_objs, n); rte_mempool_trace_ops_enqueue_bulk(mp, obj_table, n); ops = rte_mempool_get_ops(mp->ops_index); - return ops->enqueue(mp, obj_table, n); + ret = ops->enqueue(mp, obj_table, n); +#ifdef RTE_LIBRTE_MEMPOOL_DEBUG + if (unlikely(ret < 0)) + RTE_LOG(CRIT, MEMPOOL, "cannot enqueue %u objects to mempool %s\n", + n, mp->name); +#endif + return ret; } /** @@ -1351,12 +1358,7 @@ rte_mempool_do_generic_put(struct rte_mempool *mp, void * const *obj_table, ring_enqueue: /* push remaining objects in ring */ -#ifdef RTE_LIBRTE_MEMPOOL_DEBUG - if (rte_mempool_ops_enqueue_bulk(mp, obj_table, n) < 0) - rte_panic("cannot put objects in mempool\n"); -#else rte_mempool_ops_enqueue_bulk(mp, obj_table, n); -#endif } -- 2.30.2