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 C9B32A0542; Sun, 9 Oct 2022 13:12:01 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A61C0400D5; Sun, 9 Oct 2022 13:12:00 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 48F6E40042 for ; Sun, 9 Oct 2022 13:11:59 +0200 (CEST) Received: by shelob.oktetlabs.ru (Postfix, from userid 115) id 9E8067F; Sun, 9 Oct 2022 14:11:58 +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 F065766; Sun, 9 Oct 2022 14:11:57 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru F065766 Authentication-Results: shelob.oktetlabs.ru/F065766; dkim=none; dkim-atps=neutral From: Andrew Rybchenko To: Olivier Matz Cc: dev@dpdk.org, =?UTF-8?q?Morten=20Br=C3=B8rup?= Subject: [PATCH 1/2] mempool: check driver enqueue result in one place Date: Sun, 9 Oct 2022 14:11:53 +0300 Message-Id: <20221009111154.213253-1-andrew.rybchenko@oktetlabs.ru> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220202103354.79832-1-mb@smartsharesystems.com> References: <20220202103354.79832-1-mb@smartsharesystems.com> MIME-Version: 1.0 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 --- 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 4c4af2a8ed..95d64901e5 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