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 7FEC9A0528; Thu, 9 Jul 2020 15:49:18 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 076071E934; Thu, 9 Jul 2020 15:48:54 +0200 (CEST) Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id 2AF9E1E918 for ; Thu, 9 Jul 2020 15:48:49 +0200 (CEST) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200709134848euoutp01efe1bb89aea2b80fe6bc98606829fd01~gGbP-DAT-1242712427euoutp01K for ; Thu, 9 Jul 2020 13:48:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200709134848euoutp01efe1bb89aea2b80fe6bc98606829fd01~gGbP-DAT-1242712427euoutp01K DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1594302528; bh=nvWmHR/6HrU12HNzSl3vJCP8XCRUUjVBIxeP85Lho/k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m+Y4RN/da5n630pMBv6bOF9T8NXFC4pHDatFJLeA4X5gjo4AkrdttlSTGFCnk4BJd TXHQAIQDkIAvKv/f+XGIjKzzpYqT7VpWZOy7M0BoSrj4x16OvwAo6/tChEosM/xT3E T3llnPCddSCRUvDpXlaqFqWIy4NK58k6I7O+PrOg= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200709134848eucas1p17b3719913cbc495c9e5f8baa21b5be9a~gGbPvuwMK0638806388eucas1p1U; Thu, 9 Jul 2020 13:48:48 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id CD.9D.05997.040270F5; Thu, 9 Jul 2020 14:48:48 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200709134848eucas1p1b78c9b2d4556ae3047d52e9d6e41b11c~gGbPdw8vp1071310713eucas1p1J; Thu, 9 Jul 2020 13:48:48 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200709134848eusmtrp19f6e2a09955ae0a304a98045233ed7d6~gGbPc-4Cw1329113291eusmtrp1Q; Thu, 9 Jul 2020 13:48:48 +0000 (GMT) X-AuditID: cbfec7f4-677ff7000000176d-4f-5f072040983e Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 60.DE.06314.040270F5; Thu, 9 Jul 2020 14:48:48 +0100 (BST) Received: from localhost.localdomain (unknown [106.210.88.70]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200709134847eusmtip2d20098f3158d0331f5c01672ba546542~gGbO1uTto2597825978eusmtip2E; Thu, 9 Jul 2020 13:48:47 +0000 (GMT) From: Lukasz Wojciechowski To: Olivier Matz , Thomas Monjalon , John McNamara , Marko Kovacevic Cc: dev@dpdk.org, l.wojciechow@partner.samsung.com Date: Thu, 9 Jul 2020 15:48:22 +0200 Message-Id: <20200709134823.9176-4-l.wojciechow@partner.samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200709134823.9176-1-l.wojciechow@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrBIsWRmVeSWpSXmKPExsWy7djP87oOCuzxBstPq1m8+7SdyeL8vK2s Fs961jFanN/Yy2qxtWkjk8WnBydYHNg8LvbfYfT4tWApq8fiPS+ZPI7dnMbucfDdHqYA1igu m5TUnMyy1CJ9uwSujBkXWtgL/stUdMwxbWBcJNHFyMkhIWAiMeH5QtYuR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wSJzd8BhvEDDT09rwmNhBbWMBGYvGEhawgNouA qsTvDTdZQGxeAReJxe8WMEJskJdYveEA2FBOAVeJrdv3MUJsa2CU+Px3H+sERr4FjAyrGEVS S4tz03OLDfWKE3OLS/PS9ZLzczcxAkN127Gfm3cwXtoYfIhRgINRiYd3x3+2eCHWxLLiytxD jBIczEoivE5nT8cJ8aYkVlalFuXHF5XmpBYfYjQFumois5Rocj4wjvJK4g1NDc0tLA3Njc2N zSyUxHk7BA7GCAmkJ5akZqemFqQWwfQxcXBKNTAmlF5s+7k7aybnGbGIi6JeZ6fsW5PM3/Oy x8f2rnvJPZ59Tem7yhK3y/G/q2Q8/zLR9c/K1n9zMg22f9rTmvjl9O8J/5gX869ZeyBlMlfm qtx7ATMctlR99Z3MNPlepfLlV0kZoXty/bYaKZ174brltI7lSoeTjza82vfiWWZIsZe2aHYl 86xnSizFGYmGWsxFxYkAEYFesmsCAAA= X-CMS-MailID: 20200709134848eucas1p1b78c9b2d4556ae3047d52e9d6e41b11c X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200709134848eucas1p1b78c9b2d4556ae3047d52e9d6e41b11c X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200709134848eucas1p1b78c9b2d4556ae3047d52e9d6e41b11c References: <20200422214555.11837-1-l.wojciechow@partner.samsung.com> <20200709134823.9176-1-l.wojciechow@partner.samsung.com> Subject: [dpdk-dev] [PATCH v3 3/4] mbuf: standardize library debug flag 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Use standardized debug macro RTE_DEBUG_MBUF instead of RTE_LIBRTE_MBUF_DEBUG for wrapping sanity checks. Add runtime control of running sanity checks basing on rte_log_can_log() function. To run mbuf sanity checks all following conditions must occur: 1) RTE_DEBUG_MBUF - must be defined, this can be done by enabling meson rte_debug option or defining CFLAGS="-DRTE_DEBUG_MBUF" 2) global log level must be set to RTE_LOG_DEBUG 3) mbuf library logtype log level (lib.mbuf) must be set to RTE_LOG_DEBUG Tests and documentation were also updated. Signed-off-by: Lukasz Wojciechowski --- app/test/test_mbuf.c | 3 ++- config/common_base | 2 +- doc/guides/prog_guide/mbuf_lib.rst | 2 +- lib/librte_mbuf/rte_mbuf.h | 12 ++++++++---- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c index 06e44f0a7..b8cdd6efb 100644 --- a/app/test/test_mbuf.c +++ b/app/test/test_mbuf.c @@ -994,7 +994,8 @@ test_pktmbuf_free_segment(struct rte_mempool *pktmbuf_pool) /* * Stress test for rte_mbuf atomic refcnt. * Implies that RTE_MBUF_REFCNT_ATOMIC is defined. - * For more efficiency, recommended to run with RTE_LIBRTE_MBUF_DEBUG defined. + * For more efficiency, recommended to run with RTE_DEBUG_MBUF defined + * or using rte_debug meson build option. */ #ifdef RTE_MBUF_REFCNT_ATOMIC diff --git a/config/common_base b/config/common_base index 897100887..2805c1c2b 100644 --- a/config/common_base +++ b/config/common_base @@ -874,7 +874,7 @@ CONFIG_RTE_LIBRTE_OCTEONTX2_MEMPOOL=y # Compile librte_mbuf # CONFIG_RTE_LIBRTE_MBUF=y -CONFIG_RTE_LIBRTE_MBUF_DEBUG=n +CONFIG_RTE_DEBUG_MBUF=n CONFIG_RTE_MBUF_DEFAULT_MEMPOOL_OPS="ring_mp_mc" CONFIG_RTE_MBUF_REFCNT_ATOMIC=y CONFIG_RTE_PKTMBUF_HEADROOM=128 diff --git a/doc/guides/prog_guide/mbuf_lib.rst b/doc/guides/prog_guide/mbuf_lib.rst index c3dbfb922..86ee29e07 100644 --- a/doc/guides/prog_guide/mbuf_lib.rst +++ b/doc/guides/prog_guide/mbuf_lib.rst @@ -266,7 +266,7 @@ can be found in several of the sample applications, for example, the IPv4 Multic Debug ----- -In debug mode (CONFIG_RTE_MBUF_DEBUG is enabled), +In debug mode (RTE_DEBUG_MBUF is enabled, e.g. by using "rte_debug" option during meson build), the functions of the mbuf library perform sanity checks before any operation (such as, buffer corruption, bad type, and so on). Use Cases diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index f8e492e59..f27d5e26e 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -341,17 +342,20 @@ rte_pktmbuf_priv_flags(struct rte_mempool *mp) #define RTE_MBUF_HAS_PINNED_EXTBUF(mb) \ (rte_pktmbuf_priv_flags(mb->pool) & RTE_PKTMBUF_POOL_F_PINNED_EXT_BUF) -#ifdef RTE_LIBRTE_MBUF_DEBUG +#ifdef RTE_DEBUG_MBUF /** check mbuf type in debug mode */ -#define __rte_mbuf_sanity_check(m, is_h) rte_mbuf_sanity_check(m, is_h) +#define __rte_mbuf_sanity_check(m, is_h) do { \ + if (rte_log_can_log(RTE_LOGTYPE_MBUF, RTE_LOG_DEBUG)) \ + rte_mbuf_sanity_check(m, is_h); \ +} while (0) -#else /* RTE_LIBRTE_MBUF_DEBUG */ +#else /* RTE_DEBUG_MBUF */ /** check mbuf type in debug mode */ #define __rte_mbuf_sanity_check(m, is_h) do { } while (0) -#endif /* RTE_LIBRTE_MBUF_DEBUG */ +#endif /* RTE_DEBUG_MBUF */ #ifdef RTE_MBUF_REFCNT_ATOMIC -- 2.17.1