From patchwork Sun Jul 5 11:46:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fady Bader X-Patchwork-Id: 73133 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 324F9A00C5; Sun, 5 Jul 2020 13:47:05 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BF4381DBE6; Sun, 5 Jul 2020 13:46:58 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 55F8A1DBD7 for ; Sun, 5 Jul 2020 13:46:56 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from fady@mellanox.com) with SMTP; 5 Jul 2020 14:46:52 +0300 Received: from l-wincomp04-vm.labs.mlnx (l-wincomp04-vm.mtl.labs.mlnx [10.237.1.5]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 065Bkq2A018530; Sun, 5 Jul 2020 14:46:52 +0300 From: Fady Bader To: dev@dpdk.org Cc: thomas@monjalon.net, tbashar@mellanox.com, talshn@mellanox.com, yohadt@mellanox.com, dmitry.kozliuk@gmail.com, harini.ramakrishnan@microsoft.com, ocardona@microsoft.com, pallavi.kadam@intel.com, ranjit.menon@intel.com, olivier.matz@6wind.com, arybchenko@solarflare.com, mdr@ashroe.eu, nhorman@tuxdriver.com Date: Sun, 5 Jul 2020 14:46:27 +0300 Message-Id: <20200705114629.2152-2-fady@mellanox.com> X-Mailer: git-send-email 2.16.1.windows.4 In-Reply-To: <20200705114629.2152-1-fady@mellanox.com> References: <20200702131409.17964-2-fady@mellanox.com> <20200705114629.2152-1-fady@mellanox.com> Subject: [dpdk-dev] [PATCH v5 1/3] eal: disable function versioning on Windows 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" Function versioning implementation is not supported by Windows. Function versioning was disabled on Windows. Signed-off-by: Fady Bader --- lib/librte_eal/include/rte_function_versioning.h | 2 +- lib/meson.build | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/include/rte_function_versioning.h b/lib/librte_eal/include/rte_function_versioning.h index f588f2643b..9890551ba1 100644 --- a/lib/librte_eal/include/rte_function_versioning.h +++ b/lib/librte_eal/include/rte_function_versioning.h @@ -7,7 +7,7 @@ #define _RTE_FUNCTION_VERSIONING_H_ #include -#ifndef RTE_USE_FUNCTION_VERSIONING +#if !defined RTE_USE_FUNCTION_VERSIONING && !defined RTE_EXEC_ENV_WINDOWS #error Use of function versioning disabled, is "use_function_versioning=true" in meson.build? #endif diff --git a/lib/meson.build b/lib/meson.build index c1b9e1633f..a1ab582a51 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -107,6 +107,11 @@ foreach l:libraries shared_dep = declare_dependency(include_directories: includes) static_dep = shared_dep else + if is_windows and use_function_versioning + message('@0@: Function versioning is not supported by Windows.' + .format(name)) + use_function_versioning = false + endif if use_function_versioning cflags += '-DRTE_USE_FUNCTION_VERSIONING' From patchwork Sun Jul 5 11:46:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fady Bader X-Patchwork-Id: 73132 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 23C93A00C5; Sun, 5 Jul 2020 13:46:58 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6A8591DBD4; Sun, 5 Jul 2020 13:46:57 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 4CFD51DBC9 for ; Sun, 5 Jul 2020 13:46:56 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from fady@mellanox.com) with SMTP; 5 Jul 2020 14:46:52 +0300 Received: from l-wincomp04-vm.labs.mlnx (l-wincomp04-vm.mtl.labs.mlnx [10.237.1.5]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 065Bkq2B018530; Sun, 5 Jul 2020 14:46:52 +0300 From: Fady Bader To: dev@dpdk.org Cc: thomas@monjalon.net, tbashar@mellanox.com, talshn@mellanox.com, yohadt@mellanox.com, dmitry.kozliuk@gmail.com, harini.ramakrishnan@microsoft.com, ocardona@microsoft.com, pallavi.kadam@intel.com, ranjit.menon@intel.com, olivier.matz@6wind.com, arybchenko@solarflare.com, mdr@ashroe.eu, nhorman@tuxdriver.com Date: Sun, 5 Jul 2020 14:46:28 +0300 Message-Id: <20200705114629.2152-3-fady@mellanox.com> X-Mailer: git-send-email 2.16.1.windows.4 In-Reply-To: <20200705114629.2152-1-fady@mellanox.com> References: <20200702131409.17964-2-fady@mellanox.com> <20200705114629.2152-1-fady@mellanox.com> Subject: [dpdk-dev] [PATCH v5 2/3] mempool: use generic memory management 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" Using generic memory management calls instead of Unix memory management calls for mempool. Signed-off-by: Fady Bader Acked-by: Andrew Rybchenko --- lib/librte_mempool/rte_mempool.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c index 0bde995b52..1f346dcb87 100644 --- a/lib/librte_mempool/rte_mempool.c +++ b/lib/librte_mempool/rte_mempool.c @@ -12,7 +12,6 @@ #include #include #include -#include #include #include @@ -32,6 +31,8 @@ #include #include #include +#include + #include "rte_mempool.h" #include "rte_mempool_trace.h" @@ -148,7 +149,7 @@ get_min_page_size(int socket_id) rte_memseg_list_walk(find_min_pagesz, &wa); - return wa.min == SIZE_MAX ? (size_t) getpagesize() : wa.min; + return wa.min == SIZE_MAX ? (size_t) rte_mem_page_size() : wa.min; } @@ -526,7 +527,7 @@ rte_mempool_get_page_size(struct rte_mempool *mp, size_t *pg_sz) else if (rte_eal_has_hugepages() || alloc_in_ext_mem) *pg_sz = get_min_page_size(mp->socket_id); else - *pg_sz = getpagesize(); + *pg_sz = rte_mem_page_size(); rte_mempool_trace_get_page_size(mp, *pg_sz); return 0; @@ -686,7 +687,7 @@ get_anon_size(const struct rte_mempool *mp) size_t min_chunk_size; size_t align; - pg_sz = getpagesize(); + pg_sz = rte_mem_page_size(); pg_shift = rte_bsf32(pg_sz); size = rte_mempool_ops_calc_mem_size(mp, mp->size, pg_shift, &min_chunk_size, &align); @@ -710,7 +711,7 @@ rte_mempool_memchunk_anon_free(struct rte_mempool_memhdr *memhdr, if (size < 0) return; - munmap(opaque, size); + rte_mem_unmap(opaque, size); } /* populate the mempool with an anonymous mapping */ @@ -740,20 +741,20 @@ rte_mempool_populate_anon(struct rte_mempool *mp) } /* get chunk of virtually continuous memory */ - addr = mmap(NULL, size, PROT_READ | PROT_WRITE, - MAP_SHARED | MAP_ANONYMOUS, -1, 0); - if (addr == MAP_FAILED) { + addr = rte_mem_map(NULL, size, RTE_PROT_READ | RTE_PROT_WRITE, + RTE_MAP_SHARED | RTE_MAP_ANONYMOUS, -1, 0); + if (addr == NULL) { rte_errno = errno; return 0; } /* can't use MMAP_LOCKED, it does not exist on BSD */ - if (mlock(addr, size) < 0) { + if (rte_mem_lock(addr, size) < 0) { rte_errno = errno; - munmap(addr, size); + rte_mem_unmap(addr, size); return 0; } - ret = rte_mempool_populate_virt(mp, addr, size, getpagesize(), + ret = rte_mempool_populate_virt(mp, addr, size, rte_mem_page_size(), rte_mempool_memchunk_anon_free, addr); if (ret == 0) /* should not happen */ ret = -ENOBUFS; From patchwork Sun Jul 5 11:46:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fady Bader X-Patchwork-Id: 73135 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 08235A00C5; Sun, 5 Jul 2020 13:47:18 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EA87B1DC28; Sun, 5 Jul 2020 13:47:01 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 5A9C61DBDF for ; Sun, 5 Jul 2020 13:46:56 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from fady@mellanox.com) with SMTP; 5 Jul 2020 14:46:53 +0300 Received: from l-wincomp04-vm.labs.mlnx (l-wincomp04-vm.mtl.labs.mlnx [10.237.1.5]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 065Bkq2C018530; Sun, 5 Jul 2020 14:46:52 +0300 From: Fady Bader To: dev@dpdk.org Cc: thomas@monjalon.net, tbashar@mellanox.com, talshn@mellanox.com, yohadt@mellanox.com, dmitry.kozliuk@gmail.com, harini.ramakrishnan@microsoft.com, ocardona@microsoft.com, pallavi.kadam@intel.com, ranjit.menon@intel.com, olivier.matz@6wind.com, arybchenko@solarflare.com, mdr@ashroe.eu, nhorman@tuxdriver.com Date: Sun, 5 Jul 2020 14:46:29 +0300 Message-Id: <20200705114629.2152-4-fady@mellanox.com> X-Mailer: git-send-email 2.16.1.windows.4 In-Reply-To: <20200705114629.2152-1-fady@mellanox.com> References: <20200702131409.17964-2-fady@mellanox.com> <20200705114629.2152-1-fady@mellanox.com> Subject: [dpdk-dev] [PATCH v5 3/3] mempool: mempool build on Windows 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" Some eal functions are used by mempool lib but not exported on Windows. The functions were exported. Added mempool to supported libraries for Windows compilation. Signed-off-by: Fady Bader --- lib/librte_eal/rte_eal_exports.def | 6 ++++++ lib/librte_eal/rte_eal_version.map | 1 + lib/meson.build | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/rte_eal_exports.def b/lib/librte_eal/rte_eal_exports.def index 374e654264..984c5d1698 100644 --- a/lib/librte_eal/rte_eal_exports.def +++ b/lib/librte_eal/rte_eal_exports.def @@ -1,6 +1,11 @@ EXPORTS __rte_panic + __rte_trace_mem_per_thread_alloc + __rte_trace_point_emit_field + __rte_trace_point_register per_lcore__rte_errno + per_lcore_trace_mem + per_lcore_trace_point_sz rte_calloc rte_calloc_socket rte_bus_register @@ -58,6 +63,7 @@ EXPORTS rte_vfio_container_dma_unmap rte_vlog rte_realloc + rte_strscpy rte_zmalloc rte_zmalloc_socket diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map index 196eef5afa..9ad843c754 100644 --- a/lib/librte_eal/rte_eal_version.map +++ b/lib/librte_eal/rte_eal_version.map @@ -395,4 +395,5 @@ INTERNAL { rte_mem_map; rte_mem_page_size; rte_mem_unmap; + __rte_trace_mem_per_thread_alloc; }; diff --git a/lib/meson.build b/lib/meson.build index a1ab582a51..9a063def41 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -40,7 +40,7 @@ if is_windows 'kvargs', 'eal', 'ring', - 'pci', + 'mempool', 'pci', ] # only supported libraries for windows endif