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 EFF0AA0597; Fri, 17 Apr 2020 23:59:54 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 351EF1EBD3; Fri, 17 Apr 2020 23:58:19 +0200 (CEST) Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id B84A71EB88 for ; Fri, 17 Apr 2020 23:58:06 +0200 (CEST) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200417215806euoutp01bfdf1c6448f5b34f2d88237706b1efb7~Gujw8CrOv0105301053euoutp01O for ; Fri, 17 Apr 2020 21:58:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200417215806euoutp01bfdf1c6448f5b34f2d88237706b1efb7~Gujw8CrOv0105301053euoutp01O DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1587160686; bh=JK7GvMVPo/tRQQF82iEFycIE0MHkaBWSpEwLpVMYSZY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rmiyf32Q0/0IguixDiQPh+mu0sXXZSXu17a5tzIyukx+ocaiFPwNKJkrkF+foQb8/ JEgDLsZIhWZe2lbHEVh93Y398GRIqSmFGya4aUyWngBI1KKtFGMT1Vn5n0x9ouxdDY hH+DFaOl96S/1vAXmZjfrS8SAyflQpZWpbS3hvUQ= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200417215806eucas1p1e840e8666f3a5f62d047b59a9c00e434~GujwmClun2647326473eucas1p1D; Fri, 17 Apr 2020 21:58:06 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id BE.5E.60698.E662A9E5; Fri, 17 Apr 2020 22:58:06 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200417215805eucas1p2530efed5c5a73df8cc5fb613b11dfdde~GujwRZRR41701917019eucas1p2d; Fri, 17 Apr 2020 21:58:05 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200417215805eusmtrp21d49a613cbf22a2a5dc804d44819429a~GujwQ4OeV2952229522eusmtrp2k; Fri, 17 Apr 2020 21:58:05 +0000 (GMT) X-AuditID: cbfec7f5-a29ff7000001ed1a-b7-5e9a266ef1d1 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 6D.94.08375.D662A9E5; Fri, 17 Apr 2020 22:58:05 +0100 (BST) Received: from localhost.localdomain (unknown [106.210.88.70]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200417215805eusmtip286a19a7568dab24dce0b58bc34a0e75d~GujvmzkF50325203252eusmtip2u; Fri, 17 Apr 2020 21:58:05 +0000 (GMT) From: Lukasz Wojciechowski To: Thomas Monjalon , Olivier Matz , Andrew Rybchenko , John McNamara , Marko Kovacevic Cc: dev@dpdk.org Date: Fri, 17 Apr 2020 23:57:33 +0200 Message-Id: <20200417215739.23180-12-l.wojciechow@partner.samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200417215739.23180-1-l.wojciechow@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrBIsWRmVeSWpSXmKPExsWy7djP87p5arPiDGb9Y7d4MOUum8W7T9uZ LM7P28pqcX5jL6vF1qaNTBafHpxgcWDzuNh/h9Hj14KlrB6L97xk8jh2cxq7x+onP9gCWKO4 bFJSczLLUov07RK4Mrb81inY61jRs/sCWwPjbrMuRk4OCQETiUXP3jN2M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CAxON7z8BsYQFfia87mhlBbBYB VYn5u3+yg9i8Am4Sq6/8YIbYIC+xesMBMJsTKL705XeweiEBV4mHD0+xT2DkW8DIsIpRJLW0 ODc9t9hQrzgxt7g0L10vOT93EyMwVLcd+7l5B+OljcGHGAU4GJV4eA16ZsYJsSaWFVfmHmKU 4GBWEuE96AYU4k1JrKxKLcqPLyrNSS0+xGgKdNREZinR5HxgHOWVxBuaGppbWBqaG5sbm1ko ifN2CByMERJITyxJzU5NLUgtgulj4uCUamBUFNLtNtkekLFPMGTXZ02fR0GfF7+uz4o79bX3 zgy7OcdtDNcazww8+a/xuY+inF3lv5tObiwMV7ZOjj6rf/aOg+BWqU5j1/qtlns+77qZfPem q0gcc1Gm7tMqfqn3EZPPLzdY8PvLr78GGy3Zj+jUnOV9njF9ZdY6BzelkoK0K4Z1Gy4Yr/NQ YinOSDTUYi4qTgQAzTHfbWsCAAA= X-CMS-MailID: 20200417215805eucas1p2530efed5c5a73df8cc5fb613b11dfdde X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200417215805eucas1p2530efed5c5a73df8cc5fb613b11dfdde X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200417215805eucas1p2530efed5c5a73df8cc5fb613b11dfdde References: <20200417215739.23180-1-l.wojciechow@partner.samsung.com> Subject: [dpdk-dev] [PATCH v1 11/17] mempool: replace library debug flag with global one 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 global debug flag RTE_DEBUG instead of RTE_LIBRTE_MEMPOOL_DEBUG. The old define is completely removed from source code and config. Documentation was also updated. Signed-off-by: Lukasz Wojciechowski --- config/common_base | 1 - doc/guides/prog_guide/mempool_lib.rst | 7 ++++--- lib/librte_mempool/rte_mempool.c | 16 ++++++++-------- lib/librte_mempool/rte_mempool.h | 20 ++++++++++---------- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/config/common_base b/config/common_base index c24086789..b975a1feb 100644 --- a/config/common_base +++ b/config/common_base @@ -828,7 +828,6 @@ CONFIG_RTE_LIBRTE_STACK=y # CONFIG_RTE_LIBRTE_MEMPOOL=y CONFIG_RTE_MEMPOOL_CACHE_MAX_SIZE=512 -CONFIG_RTE_LIBRTE_MEMPOOL_DEBUG=n # # Compile Mempool drivers diff --git a/doc/guides/prog_guide/mempool_lib.rst b/doc/guides/prog_guide/mempool_lib.rst index f8b430d65..b8104163e 100644 --- a/doc/guides/prog_guide/mempool_lib.rst +++ b/doc/guides/prog_guide/mempool_lib.rst @@ -17,14 +17,15 @@ This library is used by the :ref:`Mbuf Library `. Cookies ------- -In debug mode (CONFIG_RTE_LIBRTE_MEMPOOL_DEBUG is enabled), cookies are added at the beginning and end of allocated blocks. +In debug mode (RTE_DEBUG is enabled), cookies are added at the beginning and end of allocated blocks. The allocated objects then contain overwrite protection fields to help debugging buffer overflows. +The RTE_DEBUG flag can be enabled using meson "debug" option. Stats ----- -In debug mode (CONFIG_RTE_LIBRTE_MEMPOOL_DEBUG is enabled), -statistics about get from/put in the pool are stored in the mempool structure. +In debug mode (RTE_DEBUG is enabled), statistics about get from/put in the pool +are stored in the mempool structure. Statistics are per-lcore to avoid concurrent access to statistics counters. Memory Alignment Constraints on x86 architecture diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c index 712c839a0..7772895cc 100644 --- a/lib/librte_mempool/rte_mempool.c +++ b/lib/librte_mempool/rte_mempool.c @@ -164,7 +164,7 @@ mempool_add_elem(struct rte_mempool *mp, __rte_unused void *opaque, STAILQ_INSERT_TAIL(&mp->elt_list, hdr, next); mp->populated_size++; -#ifdef RTE_LIBRTE_MEMPOOL_DEBUG +#ifdef RTE_DEBUG hdr->cookie = RTE_MEMPOOL_HEADER_COOKIE2; tlr = __mempool_get_trailer(obj); tlr->cookie = RTE_MEMPOOL_TRAILER_COOKIE; @@ -219,7 +219,7 @@ rte_mempool_calc_obj_size(uint32_t elt_size, uint32_t flags, sz->header_size = RTE_ALIGN_CEIL(sz->header_size, RTE_MEMPOOL_ALIGN); -#ifdef RTE_LIBRTE_MEMPOOL_DEBUG +#ifdef RTE_DEBUG sz->trailer_size = sizeof(struct rte_mempool_objtlr); #else sz->trailer_size = 0; @@ -806,7 +806,7 @@ rte_mempool_create_empty(const char *name, unsigned n, unsigned elt_size, RTE_CACHE_LINE_MASK) != 0); RTE_BUILD_BUG_ON((sizeof(struct rte_mempool_cache) & RTE_CACHE_LINE_MASK) != 0); -#ifdef RTE_LIBRTE_MEMPOOL_DEBUG +#ifdef RTE_DEBUG RTE_BUILD_BUG_ON((sizeof(struct rte_mempool_debug_stats) & RTE_CACHE_LINE_MASK) != 0); RTE_BUILD_BUG_ON((offsetof(struct rte_mempool, stats) & @@ -1033,7 +1033,7 @@ rte_mempool_dump_cache(FILE *f, const struct rte_mempool *mp) void rte_mempool_check_cookies(const struct rte_mempool *mp, void * const *obj_table_const, unsigned n, int free) { -#ifdef RTE_LIBRTE_MEMPOOL_DEBUG +#ifdef RTE_DEBUG struct rte_mempool_objhdr *hdr; struct rte_mempool_objtlr *tlr; uint64_t cookie; @@ -1102,7 +1102,7 @@ void rte_mempool_contig_blocks_check_cookies(const struct rte_mempool *mp, void * const *first_obj_table_const, unsigned int n, int free) { -#ifdef RTE_LIBRTE_MEMPOOL_DEBUG +#ifdef RTE_DEBUG struct rte_mempool_info info; const size_t total_elt_sz = mp->header_size + mp->elt_size + mp->trailer_size; @@ -1128,7 +1128,7 @@ rte_mempool_contig_blocks_check_cookies(const struct rte_mempool *mp, #endif } -#ifdef RTE_LIBRTE_MEMPOOL_DEBUG +#ifdef RTE_DEBUG static void mempool_obj_audit(struct rte_mempool *mp, __rte_unused void *opaque, void *obj, __rte_unused unsigned idx) @@ -1192,7 +1192,7 @@ rte_mempool_audit(struct rte_mempool *mp) void rte_mempool_dump(FILE *f, struct rte_mempool *mp) { -#ifdef RTE_LIBRTE_MEMPOOL_DEBUG +#ifdef RTE_DEBUG struct rte_mempool_info info; struct rte_mempool_debug_stats sum; unsigned lcore_id; @@ -1234,7 +1234,7 @@ rte_mempool_dump(FILE *f, struct rte_mempool *mp) fprintf(f, " common_pool_count=%u\n", common_count); /* sum and dump statistics */ -#ifdef RTE_LIBRTE_MEMPOOL_DEBUG +#ifdef RTE_DEBUG rte_mempool_ops_get_info(mp, &info); memset(&sum, 0, sizeof(sum)); for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) { diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h index c90cf3146..dd16c1146 100644 --- a/lib/librte_mempool/rte_mempool.h +++ b/lib/librte_mempool/rte_mempool.h @@ -59,7 +59,7 @@ extern "C" { #define RTE_MEMPOOL_HEADER_COOKIE2 0xf2eef2eedadd2e55ULL /**< Header cookie. */ #define RTE_MEMPOOL_TRAILER_COOKIE 0xadd2e55badbadbadULL /**< Trailer cookie.*/ -#ifdef RTE_LIBRTE_MEMPOOL_DEBUG +#ifdef RTE_DEBUG /** * A structure that stores the mempool statistics (per-lcore). */ @@ -141,7 +141,7 @@ struct rte_mempool_objhdr { rte_iova_t iova; /**< IO address of the object. */ phys_addr_t physaddr; /**< deprecated - Physical address of the object. */ }; -#ifdef RTE_LIBRTE_MEMPOOL_DEBUG +#ifdef RTE_DEBUG uint64_t cookie; /**< Debug cookie. */ #endif }; @@ -151,7 +151,7 @@ struct rte_mempool_objhdr { */ STAILQ_HEAD(rte_mempool_objhdr_list, rte_mempool_objhdr); -#ifdef RTE_LIBRTE_MEMPOOL_DEBUG +#ifdef RTE_DEBUG /** * Mempool object trailer structure @@ -254,7 +254,7 @@ struct rte_mempool { uint32_t nb_mem_chunks; /**< Number of memory chunks */ struct rte_mempool_memhdr_list mem_list; /**< List of memory chunks */ -#ifdef RTE_LIBRTE_MEMPOOL_DEBUG +#ifdef RTE_DEBUG /** Per-lcore statistics. */ struct rte_mempool_debug_stats stats[RTE_MAX_LCORE]; #endif @@ -279,7 +279,7 @@ struct rte_mempool { * @param n * Number to add to the object-oriented statistics. */ -#ifdef RTE_LIBRTE_MEMPOOL_DEBUG +#ifdef RTE_DEBUG #define __MEMPOOL_STAT_ADD(mp, name, n) do { \ unsigned __lcore_id = rte_lcore_id(); \ if (__lcore_id < RTE_MAX_LCORE) { \ @@ -357,12 +357,12 @@ static inline struct rte_mempool_objtlr *__mempool_get_trailer(void *obj) void rte_mempool_check_cookies(const struct rte_mempool *mp, void * const *obj_table_const, unsigned n, int free); -#ifdef RTE_LIBRTE_MEMPOOL_DEBUG +#ifdef RTE_DEBUG #define __mempool_check_cookies(mp, obj_table_const, n, free) \ rte_mempool_check_cookies(mp, obj_table_const, n, free) #else #define __mempool_check_cookies(mp, obj_table_const, n, free) do {} while(0) -#endif /* RTE_LIBRTE_MEMPOOL_DEBUG */ +#endif /* RTE_DEBUG */ /** * @warning @@ -385,7 +385,7 @@ void rte_mempool_check_cookies(const struct rte_mempool *mp, void rte_mempool_contig_blocks_check_cookies(const struct rte_mempool *mp, void * const *first_obj_table_const, unsigned int n, int free); -#ifdef RTE_LIBRTE_MEMPOOL_DEBUG +#ifdef RTE_DEBUG #define __mempool_contig_blocks_check_cookies(mp, first_obj_table_const, n, \ free) \ rte_mempool_contig_blocks_check_cookies(mp, first_obj_table_const, n, \ @@ -394,7 +394,7 @@ void rte_mempool_contig_blocks_check_cookies(const struct rte_mempool *mp, #define __mempool_contig_blocks_check_cookies(mp, first_obj_table_const, n, \ free) \ do {} while (0) -#endif /* RTE_LIBRTE_MEMPOOL_DEBUG */ +#endif /* RTE_DEBUG */ #define RTE_MEMPOOL_OPS_NAMESIZE 32 /**< Max length of ops struct name. */ @@ -1337,7 +1337,7 @@ __mempool_generic_put(struct rte_mempool *mp, void * const *obj_table, ring_enqueue: /* push remaining objects in ring */ -#ifdef RTE_LIBRTE_MEMPOOL_DEBUG +#ifdef RTE_DEBUG if (rte_mempool_ops_enqueue_bulk(mp, obj_table, n) < 0) rte_panic("cannot put objects in mempool\n"); #else -- 2.17.1