DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v4 0/3] build mempool on Windows
@ 2020-07-02 13:14 Fady Bader
  2020-07-02 13:14 ` [dpdk-dev] [PATCH v4 1/3] eal: disable function versioning " Fady Bader
                   ` (2 more replies)
  0 siblings, 3 replies; 34+ messages in thread
From: Fady Bader @ 2020-07-02 13:14 UTC (permalink / raw)
  To: dev
  Cc: thomas, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	olivier.matz, arybchenko, mdr, nhorman

Added changes in order to build mempool lib on windows.

v4:
    * Fixed some commit messages and added comments to unclear code.

v3:
    * Rebased on current master and v5 of "eal/windows: ring build on Windows".

v2:
    * Replace ifndef of tracepoints with symbol export from memory management
      patchset.

Fady Bader (3):
  eal: disable function versioning on Windows
  mempool: use generic memory management
  mempool: mempool build on Windows

 lib/librte_eal/include/rte_function_versioning.h |  8 ++++++++
 lib/librte_eal/rte_eal_exports.def               |  6 ++++++
 lib/librte_eal/rte_eal_version.map               |  1 +
 lib/librte_mempool/rte_mempool.c                 | 23 ++++++++++++-----------
 lib/meson.build                                  |  2 +-
 5 files changed, 28 insertions(+), 12 deletions(-)

-- 
2.16.1.windows.4


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [dpdk-dev] [PATCH v4 1/3] eal: disable function versioning on Windows
  2020-07-02 13:14 [dpdk-dev] [PATCH v4 0/3] build mempool on Windows Fady Bader
@ 2020-07-02 13:14 ` Fady Bader
  2020-07-05 11:46   ` [dpdk-dev] [PATCH v5 0/3] build mempool " Fady Bader
  2020-07-02 13:14 ` [dpdk-dev] [PATCH v4 2/3] mempool: use generic memory management Fady Bader
  2020-07-02 13:14 ` [dpdk-dev] [PATCH v4 3/3] mempool: mempool build on Windows Fady Bader
  2 siblings, 1 reply; 34+ messages in thread
From: Fady Bader @ 2020-07-02 13:14 UTC (permalink / raw)
  To: dev
  Cc: thomas, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	olivier.matz, arybchenko, mdr, nhorman

Function versioning implementation is not supported by Windows.
Function versioning was disabled on Windows.

Signed-off-by: Fady Bader <fady@mellanox.com>
---
 lib/librte_eal/include/rte_function_versioning.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib/librte_eal/include/rte_function_versioning.h b/lib/librte_eal/include/rte_function_versioning.h
index f588f2643b..c0cb13909f 100644
--- a/lib/librte_eal/include/rte_function_versioning.h
+++ b/lib/librte_eal/include/rte_function_versioning.h
@@ -11,6 +11,14 @@
 #error Use of function versioning disabled, is "use_function_versioning=true" in meson.build?
 #endif
 
+/*
+ * function versioning is disabled for Windows but shared libraries are allowed
+ * for Windows.
+ */
+#ifdef RTE_EXEC_ENV_WINDOWS
+#undef RTE_BUILD_SHARED_LIB
+#endif
+
 #ifdef RTE_BUILD_SHARED_LIB
 
 /*
-- 
2.16.1.windows.4


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [dpdk-dev] [PATCH v4 2/3] mempool: use generic memory management
  2020-07-02 13:14 [dpdk-dev] [PATCH v4 0/3] build mempool on Windows Fady Bader
  2020-07-02 13:14 ` [dpdk-dev] [PATCH v4 1/3] eal: disable function versioning " Fady Bader
@ 2020-07-02 13:14 ` Fady Bader
  2020-07-03 13:16   ` Olivier Matz
  2020-07-02 13:14 ` [dpdk-dev] [PATCH v4 3/3] mempool: mempool build on Windows Fady Bader
  2 siblings, 1 reply; 34+ messages in thread
From: Fady Bader @ 2020-07-02 13:14 UTC (permalink / raw)
  To: dev
  Cc: thomas, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	olivier.matz, arybchenko, mdr, nhorman

mempool used Unix memory management calls, which are not supported
on Windows.
Used generic memory management instead.

Signed-off-by: Fady Bader <fady@mellanox.com>
---
 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 <inttypes.h>
 #include <errno.h>
 #include <sys/queue.h>
-#include <sys/mman.h>
 
 #include <rte_common.h>
 #include <rte_log.h>
@@ -32,6 +31,8 @@
 #include <rte_spinlock.h>
 #include <rte_tailq.h>
 #include <rte_function_versioning.h>
+#include <rte_eal_paging.h>
+
 
 #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;
-- 
2.16.1.windows.4


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [dpdk-dev] [PATCH v4 3/3] mempool: mempool build on Windows
  2020-07-02 13:14 [dpdk-dev] [PATCH v4 0/3] build mempool on Windows Fady Bader
  2020-07-02 13:14 ` [dpdk-dev] [PATCH v4 1/3] eal: disable function versioning " Fady Bader
  2020-07-02 13:14 ` [dpdk-dev] [PATCH v4 2/3] mempool: use generic memory management Fady Bader
@ 2020-07-02 13:14 ` Fady Bader
  2020-07-03 13:17   ` Olivier Matz
  2 siblings, 1 reply; 34+ messages in thread
From: Fady Bader @ 2020-07-02 13:14 UTC (permalink / raw)
  To: dev
  Cc: thomas, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	olivier.matz, arybchenko, mdr, nhorman

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 <fady@mellanox.com>
---
 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 c1b9e1633f..584d601514 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
 
-- 
2.16.1.windows.4


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [dpdk-dev] [PATCH v4 2/3] mempool: use generic memory management
  2020-07-02 13:14 ` [dpdk-dev] [PATCH v4 2/3] mempool: use generic memory management Fady Bader
@ 2020-07-03 13:16   ` Olivier Matz
  0 siblings, 0 replies; 34+ messages in thread
From: Olivier Matz @ 2020-07-03 13:16 UTC (permalink / raw)
  To: Fady Bader
  Cc: dev, thomas, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	arybchenko, mdr, nhorman

On Thu, Jul 02, 2020 at 04:14:08PM +0300, Fady Bader wrote:
> mempool used Unix memory management calls, which are not supported
> on Windows.
> Used generic memory management instead.
> 
> Signed-off-by: Fady Bader <fady@mellanox.com>

Same comment than Thomas about the use of past in the commit log.

Apart from that:
Acked-by: Olivier Matz <olivier.matz@6wind.com>

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [dpdk-dev] [PATCH v4 3/3] mempool: mempool build on Windows
  2020-07-02 13:14 ` [dpdk-dev] [PATCH v4 3/3] mempool: mempool build on Windows Fady Bader
@ 2020-07-03 13:17   ` Olivier Matz
  0 siblings, 0 replies; 34+ messages in thread
From: Olivier Matz @ 2020-07-03 13:17 UTC (permalink / raw)
  To: Fady Bader
  Cc: dev, thomas, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	arybchenko, mdr, nhorman

On Thu, Jul 02, 2020 at 04:14:09PM +0300, Fady Bader wrote:
> 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 <fady@mellanox.com>

Acked-by: Olivier Matz <olivier.matz@6wind.com>

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [dpdk-dev] [PATCH v5 0/3] build mempool on Windows
  2020-07-02 13:14 ` [dpdk-dev] [PATCH v4 1/3] eal: disable function versioning " Fady Bader
@ 2020-07-05 11:46   ` Fady Bader
  2020-07-05 11:46     ` [dpdk-dev] [PATCH v5 1/3] eal: disable function versioning " Fady Bader
                       ` (3 more replies)
  0 siblings, 4 replies; 34+ messages in thread
From: Fady Bader @ 2020-07-05 11:46 UTC (permalink / raw)
  To: dev
  Cc: thomas, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	olivier.matz, arybchenko, mdr, nhorman

Added changes in order to build mempool lib on windows.

v5:
    * disabled function versioning on Windows in lib/meson.build.

v4:
    * Fixed some commit messages and added comments to unclear code.

v3:
    * Rebased on current master and v5 of "eal/windows: ring build on Windows".

v2:
    * Replace ifndef of tracepoints with symbol export from memory management
      patchset.

Fady Bader (3):
  eal: disable function versioning on Windows
  mempool: use generic memory management
  mempool: mempool build on Windows

 lib/librte_eal/include/rte_function_versioning.h |  2 +-
 lib/librte_eal/rte_eal_exports.def               |  6 ++++++
 lib/librte_eal/rte_eal_version.map               |  1 +
 lib/librte_mempool/rte_mempool.c                 | 23 ++++++++++++-----------
 lib/meson.build                                  |  7 ++++++-
 5 files changed, 26 insertions(+), 13 deletions(-)

-- 
2.16.1.windows.4


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [dpdk-dev] [PATCH v5 1/3] eal: disable function versioning on Windows
  2020-07-05 11:46   ` [dpdk-dev] [PATCH v5 0/3] build mempool " Fady Bader
@ 2020-07-05 11:46     ` Fady Bader
  2020-07-06  8:19       ` Bruce Richardson
  2020-07-05 11:46     ` [dpdk-dev] [PATCH v5 2/3] mempool: use generic memory management Fady Bader
                       ` (2 subsequent siblings)
  3 siblings, 1 reply; 34+ messages in thread
From: Fady Bader @ 2020-07-05 11:46 UTC (permalink / raw)
  To: dev
  Cc: thomas, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	olivier.matz, arybchenko, mdr, nhorman

Function versioning implementation is not supported by Windows.
Function versioning was disabled on Windows.

Signed-off-by: Fady Bader <fady@mellanox.com>
---
 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 <rte_common.h>
 
-#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'
-- 
2.16.1.windows.4


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [dpdk-dev] [PATCH v5 2/3] mempool: use generic memory management
  2020-07-05 11:46   ` [dpdk-dev] [PATCH v5 0/3] build mempool " Fady Bader
  2020-07-05 11:46     ` [dpdk-dev] [PATCH v5 1/3] eal: disable function versioning " Fady Bader
@ 2020-07-05 11:46     ` Fady Bader
  2020-07-05 11:50       ` Andrew Rybchenko
  2020-07-05 12:08       ` Dmitry Kozlyuk
  2020-07-05 11:46     ` [dpdk-dev] [PATCH v5 3/3] mempool: mempool build on Windows Fady Bader
  2020-07-05 13:47     ` [dpdk-dev] [PATCH v6 0/3] build mempool " Fady Bader
  3 siblings, 2 replies; 34+ messages in thread
From: Fady Bader @ 2020-07-05 11:46 UTC (permalink / raw)
  To: dev
  Cc: thomas, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	olivier.matz, arybchenko, mdr, nhorman

Using generic memory management calls instead of Unix memory management
calls for mempool.

Signed-off-by: Fady Bader <fady@mellanox.com>
---
 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 <inttypes.h>
 #include <errno.h>
 #include <sys/queue.h>
-#include <sys/mman.h>
 
 #include <rte_common.h>
 #include <rte_log.h>
@@ -32,6 +31,8 @@
 #include <rte_spinlock.h>
 #include <rte_tailq.h>
 #include <rte_function_versioning.h>
+#include <rte_eal_paging.h>
+
 
 #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;
-- 
2.16.1.windows.4


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [dpdk-dev] [PATCH v5 3/3] mempool: mempool build on Windows
  2020-07-05 11:46   ` [dpdk-dev] [PATCH v5 0/3] build mempool " Fady Bader
  2020-07-05 11:46     ` [dpdk-dev] [PATCH v5 1/3] eal: disable function versioning " Fady Bader
  2020-07-05 11:46     ` [dpdk-dev] [PATCH v5 2/3] mempool: use generic memory management Fady Bader
@ 2020-07-05 11:46     ` Fady Bader
  2020-07-05 12:01       ` David Marchand
  2020-07-05 13:47     ` [dpdk-dev] [PATCH v6 0/3] build mempool " Fady Bader
  3 siblings, 1 reply; 34+ messages in thread
From: Fady Bader @ 2020-07-05 11:46 UTC (permalink / raw)
  To: dev
  Cc: thomas, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	olivier.matz, arybchenko, mdr, nhorman

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 <fady@mellanox.com>
---
 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
 
-- 
2.16.1.windows.4


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [dpdk-dev] [PATCH v5 2/3] mempool: use generic memory management
  2020-07-05 11:46     ` [dpdk-dev] [PATCH v5 2/3] mempool: use generic memory management Fady Bader
@ 2020-07-05 11:50       ` Andrew Rybchenko
  2020-07-05 12:08       ` Dmitry Kozlyuk
  1 sibling, 0 replies; 34+ messages in thread
From: Andrew Rybchenko @ 2020-07-05 11:50 UTC (permalink / raw)
  To: Fady Bader, dev
  Cc: thomas, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	olivier.matz, mdr, nhorman

On 7/5/20 2:46 PM, Fady Bader wrote:
> Using generic memory management calls instead of Unix memory management
> calls for mempool.
> 
> Signed-off-by: Fady Bader <fady@mellanox.com>

Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [dpdk-dev] [PATCH v5 3/3] mempool: mempool build on Windows
  2020-07-05 11:46     ` [dpdk-dev] [PATCH v5 3/3] mempool: mempool build on Windows Fady Bader
@ 2020-07-05 12:01       ` David Marchand
  2020-07-05 12:24         ` Fady Bader
  0 siblings, 1 reply; 34+ messages in thread
From: David Marchand @ 2020-07-05 12:01 UTC (permalink / raw)
  To: Fady Bader
  Cc: dev, Thomas Monjalon, Tasnim Bashar, Tal Shnaiderman, yohadt,
	Dmitry Kozlyuk, Harini Ramakrishnan, Omar Cardona, Pallavi Kadam,
	Ranjit Menon, Olivier Matz, Andrew Rybchenko, Ray Kinsella,
	Neil Horman

On Sun, Jul 5, 2020 at 1:47 PM Fady Bader <fady@mellanox.com> wrote:
> 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;

The CI result is not there yet, but I expect issues.
This symbol is marked as experimental, not internal.
+ it is exported already in the experimental section of the EAL map.

Why did you need this line?


-- 
David Marchand


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [dpdk-dev] [PATCH v5 2/3] mempool: use generic memory management
  2020-07-05 11:46     ` [dpdk-dev] [PATCH v5 2/3] mempool: use generic memory management Fady Bader
  2020-07-05 11:50       ` Andrew Rybchenko
@ 2020-07-05 12:08       ` Dmitry Kozlyuk
  2020-07-05 12:25         ` Fady Bader
  1 sibling, 1 reply; 34+ messages in thread
From: Dmitry Kozlyuk @ 2020-07-05 12:08 UTC (permalink / raw)
  To: Fady Bader
  Cc: dev, thomas, tbashar, talshn, yohadt, harini.ramakrishnan,
	ocardona, pallavi.kadam, ranjit.menon, olivier.matz, arybchenko,
	mdr, nhorman

On Sun,  5 Jul 2020 14:46:28 +0300, Fady Bader wrote:
[snip]
>  /* 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;

rte_errno is set by rte_mem_map(), using errno here is incorrect on Windows.

>  		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;

Ditto.

[snip]

-- 
Dmitry Kozlyuk

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [dpdk-dev] [PATCH v5 3/3] mempool: mempool build on Windows
  2020-07-05 12:01       ` David Marchand
@ 2020-07-05 12:24         ` Fady Bader
  0 siblings, 0 replies; 34+ messages in thread
From: Fady Bader @ 2020-07-05 12:24 UTC (permalink / raw)
  To: David Marchand
  Cc: dev, Thomas Monjalon, Tasnim Bashar, Tal Shnaiderman, Yohad Tor,
	Dmitry Kozlyuk, Harini Ramakrishnan, Omar Cardona, Pallavi Kadam,
	Ranjit Menon, Olivier Matz, Andrew Rybchenko, Ray Kinsella,
	Neil Horman



> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Sunday, July 5, 2020 3:01 PM
> To: Fady Bader <fady@mellanox.com>
> Cc: dev <dev@dpdk.org>; Thomas Monjalon <thomas@monjalon.net>; Tasnim
> Bashar <tbashar@mellanox.com>; Tal Shnaiderman <talshn@mellanox.com>;
> Yohad Tor <yohadt@mellanox.com>; Dmitry Kozlyuk
> <dmitry.kozliuk@gmail.com>; Harini Ramakrishnan
> <harini.ramakrishnan@microsoft.com>; Omar Cardona
> <ocardona@microsoft.com>; Pallavi Kadam <pallavi.kadam@intel.com>; Ranjit
> Menon <ranjit.menon@intel.com>; Olivier Matz <olivier.matz@6wind.com>;
> Andrew Rybchenko <arybchenko@solarflare.com>; Ray Kinsella
> <mdr@ashroe.eu>; Neil Horman <nhorman@tuxdriver.com>
> Subject: Re: [dpdk-dev] [PATCH v5 3/3] mempool: mempool build on Windows
> 
> On Sun, Jul 5, 2020 at 1:47 PM Fady Bader <fady@mellanox.com> wrote:
> > 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;
> 
> The CI result is not there yet, but I expect issues.
> This symbol is marked as experimental, not internal.
> + it is exported already in the experimental section of the EAL map.

You are right, I'll remove it in the next version of the patch.

> 
> Why did you need this line? 
> 
> 
> --
> David Marchand


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [dpdk-dev] [PATCH v5 2/3] mempool: use generic memory management
  2020-07-05 12:08       ` Dmitry Kozlyuk
@ 2020-07-05 12:25         ` Fady Bader
  0 siblings, 0 replies; 34+ messages in thread
From: Fady Bader @ 2020-07-05 12:25 UTC (permalink / raw)
  To: Dmitry Kozlyuk
  Cc: dev, Thomas Monjalon, Tasnim Bashar, Tal Shnaiderman, Yohad Tor,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	olivier.matz, arybchenko, mdr, nhorman



> -----Original Message-----
> From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> Sent: Sunday, July 5, 2020 3:08 PM
> To: Fady Bader <fady@mellanox.com>
> Cc: dev@dpdk.org; Thomas Monjalon <thomas@monjalon.net>; Tasnim Bashar
> <tbashar@mellanox.com>; Tal Shnaiderman <talshn@mellanox.com>; Yohad Tor
> <yohadt@mellanox.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
> Subject: Re: [PATCH v5 2/3] mempool: use generic memory management
> 
> On Sun,  5 Jul 2020 14:46:28 +0300, Fady Bader wrote:
> [snip]
> >  /* 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;
> 
> rte_errno is set by rte_mem_map(), using errno here is incorrect on Windows.

Ok, I'll send a new version soon.

> 
> >  		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;
> 
> Ditto.
> 
> [snip]
> 
> --
> Dmitry Kozlyuk

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [dpdk-dev] [PATCH v6 0/3] build mempool on Windows
  2020-07-05 11:46   ` [dpdk-dev] [PATCH v5 0/3] build mempool " Fady Bader
                       ` (2 preceding siblings ...)
  2020-07-05 11:46     ` [dpdk-dev] [PATCH v5 3/3] mempool: mempool build on Windows Fady Bader
@ 2020-07-05 13:47     ` Fady Bader
  2020-07-05 13:47       ` [dpdk-dev] [PATCH v6 1/3] eal: disable function versioning " Fady Bader
                         ` (3 more replies)
  3 siblings, 4 replies; 34+ messages in thread
From: Fady Bader @ 2020-07-05 13:47 UTC (permalink / raw)
  To: dev
  Cc: thomas, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	olivier.matz, arybchenko, mdr, nhorman

Added changes in order to build mempool lib on windows.

v6:
    * fixed generic memory management usage.
    * removed unneeded exports.

v5:
    * disabled function versioning on Windows in lib/meson.build.

v4:
    * Fixed some commit messages and added comments to unclear code.

v3:
    * Rebased on current master and v5 of "eal/windows: ring build on Windows".

v2:
    * Replace ifndef of tracepoints with symbol export from memory management
      patchset.

Fady Bader (3):
  eal: disable function versioning on Windows
  mempool: use generic memory management
  mempool: mempool build on Windows

 lib/librte_eal/include/rte_function_versioning.h |  2 +-
 lib/librte_eal/rte_eal_exports.def               |  6 ++++++
 lib/librte_mempool/rte_mempool.c                 | 26 +++++++++++-------------
 lib/meson.build                                  |  7 ++++++-
 4 files changed, 25 insertions(+), 16 deletions(-)

-- 
2.16.1.windows.4


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [dpdk-dev] [PATCH v6 1/3] eal: disable function versioning on Windows
  2020-07-05 13:47     ` [dpdk-dev] [PATCH v6 0/3] build mempool " Fady Bader
@ 2020-07-05 13:47       ` Fady Bader
  2020-07-05 14:36         ` Tal Shnaiderman
  2020-07-05 20:23         ` Thomas Monjalon
  2020-07-05 13:47       ` [dpdk-dev] [PATCH v6 2/3] mempool: use generic memory management Fady Bader
                         ` (2 subsequent siblings)
  3 siblings, 2 replies; 34+ messages in thread
From: Fady Bader @ 2020-07-05 13:47 UTC (permalink / raw)
  To: dev
  Cc: thomas, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	olivier.matz, arybchenko, mdr, nhorman

Function versioning implementation is not supported by Windows.
Function versioning was disabled on Windows.

Signed-off-by: Fady Bader <fady@mellanox.com>
---
 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 <rte_common.h>
 
-#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'
-- 
2.16.1.windows.4


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [dpdk-dev] [PATCH v6 2/3] mempool: use generic memory management
  2020-07-05 13:47     ` [dpdk-dev] [PATCH v6 0/3] build mempool " Fady Bader
  2020-07-05 13:47       ` [dpdk-dev] [PATCH v6 1/3] eal: disable function versioning " Fady Bader
@ 2020-07-05 13:47       ` Fady Bader
  2020-07-05 15:26         ` Dmitry Kozlyuk
  2020-07-05 20:08         ` Thomas Monjalon
  2020-07-05 13:47       ` [dpdk-dev] [PATCH v6 3/3] mempool: mempool build on Windows Fady Bader
  2020-07-06 11:32       ` [dpdk-dev] [PATCH v7 0/3] build mempool " Fady Bader
  3 siblings, 2 replies; 34+ messages in thread
From: Fady Bader @ 2020-07-05 13:47 UTC (permalink / raw)
  To: dev
  Cc: thomas, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	olivier.matz, arybchenko, mdr, nhorman

Using generic memory management calls instead of Unix memory management
calls for mempool.

Signed-off-by: Fady Bader <fady@mellanox.com>
---
 lib/librte_mempool/rte_mempool.c | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
index 0bde995b52..a2bd24984b 100644
--- a/lib/librte_mempool/rte_mempool.c
+++ b/lib/librte_mempool/rte_mempool.c
@@ -12,7 +12,6 @@
 #include <inttypes.h>
 #include <errno.h>
 #include <sys/queue.h>
-#include <sys/mman.h>
 
 #include <rte_common.h>
 #include <rte_log.h>
@@ -32,6 +31,8 @@
 #include <rte_spinlock.h>
 #include <rte_tailq.h>
 #include <rte_function_versioning.h>
+#include <rte_eal_paging.h>
+
 
 #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,17 @@ 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) {
-		rte_errno = errno;
+	addr = rte_mem_map(NULL, size, RTE_PROT_READ | RTE_PROT_WRITE,
+		RTE_MAP_SHARED | RTE_MAP_ANONYMOUS, -1, 0);
+	if (addr == NULL)
 		return 0;
-	}
 	/* can't use MMAP_LOCKED, it does not exist on BSD */
-	if (mlock(addr, size) < 0) {
-		rte_errno = errno;
-		munmap(addr, size);
+	if (rte_mem_lock(addr, size) < 0) {
+		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;
-- 
2.16.1.windows.4


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [dpdk-dev] [PATCH v6 3/3] mempool: mempool build on Windows
  2020-07-05 13:47     ` [dpdk-dev] [PATCH v6 0/3] build mempool " Fady Bader
  2020-07-05 13:47       ` [dpdk-dev] [PATCH v6 1/3] eal: disable function versioning " Fady Bader
  2020-07-05 13:47       ` [dpdk-dev] [PATCH v6 2/3] mempool: use generic memory management Fady Bader
@ 2020-07-05 13:47       ` Fady Bader
  2020-07-05 20:25         ` Thomas Monjalon
  2020-07-06 11:32       ` [dpdk-dev] [PATCH v7 0/3] build mempool " Fady Bader
  3 siblings, 1 reply; 34+ messages in thread
From: Fady Bader @ 2020-07-05 13:47 UTC (permalink / raw)
  To: dev
  Cc: thomas, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	olivier.matz, arybchenko, mdr, nhorman

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 <fady@mellanox.com>
---
 lib/librte_eal/rte_eal_exports.def | 6 ++++++
 lib/meson.build                    | 2 +-
 2 files changed, 7 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/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
 
-- 
2.16.1.windows.4


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [dpdk-dev] [PATCH v6 1/3] eal: disable function versioning on Windows
  2020-07-05 13:47       ` [dpdk-dev] [PATCH v6 1/3] eal: disable function versioning " Fady Bader
@ 2020-07-05 14:36         ` Tal Shnaiderman
  2020-07-05 20:23         ` Thomas Monjalon
  1 sibling, 0 replies; 34+ messages in thread
From: Tal Shnaiderman @ 2020-07-05 14:36 UTC (permalink / raw)
  To: Fady Bader, dev
  Cc: Thomas Monjalon, Tasnim Bashar, Yohad Tor, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	olivier.matz, arybchenko, mdr, nhorman

> From: Fady Bader <fady@mellanox.com>
> Subject: [PATCH v6 1/3] eal: disable function versioning on Windows
> 
> Function versioning implementation is not supported by Windows.
> Function versioning was disabled on Windows.
> 
> Signed-off-by: Fady Bader <fady@mellanox.com>

Reviewed-by: Tal Shnaiderman <talshn@mellanox.com>

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [dpdk-dev] [PATCH v6 2/3] mempool: use generic memory management
  2020-07-05 13:47       ` [dpdk-dev] [PATCH v6 2/3] mempool: use generic memory management Fady Bader
@ 2020-07-05 15:26         ` Dmitry Kozlyuk
  2020-07-05 20:08         ` Thomas Monjalon
  1 sibling, 0 replies; 34+ messages in thread
From: Dmitry Kozlyuk @ 2020-07-05 15:26 UTC (permalink / raw)
  To: Fady Bader
  Cc: dev, thomas, tbashar, talshn, yohadt, harini.ramakrishnan,
	ocardona, pallavi.kadam, ranjit.menon, olivier.matz, arybchenko,
	mdr, nhorman

On Sun,  5 Jul 2020 16:47:45 +0300, Fady Bader wrote:
> Using generic memory management calls instead of Unix memory management
> calls for mempool.
> 
> Signed-off-by: Fady Bader <fady@mellanox.com>
[snip]

>  /* populate the mempool with an anonymous mapping */
> @@ -740,20 +741,17 @@ 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) {
> -		rte_errno = errno;
> +	addr = rte_mem_map(NULL, size, RTE_PROT_READ | RTE_PROT_WRITE,
> +		RTE_MAP_SHARED | RTE_MAP_ANONYMOUS, -1, 0);
> +	if (addr == NULL)
>  		return 0;
> -	}
>  	/* can't use MMAP_LOCKED, it does not exist on BSD */

This comment is for removed mmap(), OTOH, it explains why map+lock approach
is used, so perhaps it can be kept.

Reviewed-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>

-- 
Dmitry Kozlyuk

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [dpdk-dev] [PATCH v6 2/3] mempool: use generic memory management
  2020-07-05 13:47       ` [dpdk-dev] [PATCH v6 2/3] mempool: use generic memory management Fady Bader
  2020-07-05 15:26         ` Dmitry Kozlyuk
@ 2020-07-05 20:08         ` Thomas Monjalon
  1 sibling, 0 replies; 34+ messages in thread
From: Thomas Monjalon @ 2020-07-05 20:08 UTC (permalink / raw)
  To: Fady Bader
  Cc: dev, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	olivier.matz, arybchenko, mdr, nhorman

05/07/2020 15:47, Fady Bader:
> Using generic memory management calls instead of Unix memory management
> calls for mempool.
> 
> Signed-off-by: Fady Bader <fady@mellanox.com>

Acks received on previous versions are missing.
Please attention to all details.




^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [dpdk-dev] [PATCH v6 1/3] eal: disable function versioning on Windows
  2020-07-05 13:47       ` [dpdk-dev] [PATCH v6 1/3] eal: disable function versioning " Fady Bader
  2020-07-05 14:36         ` Tal Shnaiderman
@ 2020-07-05 20:23         ` Thomas Monjalon
  2020-07-06  7:02           ` Fady Bader
  1 sibling, 1 reply; 34+ messages in thread
From: Thomas Monjalon @ 2020-07-05 20:23 UTC (permalink / raw)
  To: Fady Bader
  Cc: dev, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	olivier.matz, arybchenko, mdr, nhorman

05/07/2020 15:47, Fady Bader:
> Function versioning implementation is not supported by Windows.
> Function versioning was disabled on Windows.

was -> is

> Signed-off-by: Fady Bader <fady@mellanox.com>
> ---
>  lib/librte_eal/include/rte_function_versioning.h | 2 +-
>  lib/meson.build                                  | 5 +++++
>  2 files changed, 6 insertions(+), 1 deletion(-)

As suggested by Ray, we should add a note in the documentation
about the ABI compatibility. Because we have no function versioning,
we cannot ensure ABI compatibility on Windows.

I recommend adding this text in doc/guides/windows_gsg/intro.rst
under "Limitations":
"
The :doc:`../contributing/abi_policy` cannot be respected for Windows.
Minor ABI versions may be incompatible
because function versioning is not supported on Windows.
"



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [dpdk-dev] [PATCH v6 3/3] mempool: mempool build on Windows
  2020-07-05 13:47       ` [dpdk-dev] [PATCH v6 3/3] mempool: mempool build on Windows Fady Bader
@ 2020-07-05 20:25         ` Thomas Monjalon
  0 siblings, 0 replies; 34+ messages in thread
From: Thomas Monjalon @ 2020-07-05 20:25 UTC (permalink / raw)
  To: Fady Bader
  Cc: dev, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	olivier.matz, arybchenko, mdr, nhorman

05/07/2020 15:47, Fady Bader:
> Some eal functions are used by mempool lib but not exported on Windows.

eal -> EAL

> The functions were exported.
> Added mempool to supported libraries for Windows compilation.

Please reserve the past tense for stating how it was before the patch.




^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [dpdk-dev] [PATCH v6 1/3] eal: disable function versioning on Windows
  2020-07-05 20:23         ` Thomas Monjalon
@ 2020-07-06  7:02           ` Fady Bader
  0 siblings, 0 replies; 34+ messages in thread
From: Fady Bader @ 2020-07-06  7:02 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: dev, Tasnim Bashar, Tal Shnaiderman, Yohad Tor, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	olivier.matz, arybchenko, mdr, nhorman



> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Sunday, July 5, 2020 11:24 PM
> To: Fady Bader <fady@mellanox.com>
> Cc: dev@dpdk.org; Tasnim Bashar <tbashar@mellanox.com>; Tal Shnaiderman
> <talshn@mellanox.com>; Yohad Tor <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
> Subject: Re: [dpdk-dev] [PATCH v6 1/3] eal: disable function versioning on
> Windows
> 
> 05/07/2020 15:47, Fady Bader:
> > Function versioning implementation is not supported by Windows.
> > Function versioning was disabled on Windows.
> 
> was -> is
> 
> > Signed-off-by: Fady Bader <fady@mellanox.com>
> > ---
> >  lib/librte_eal/include/rte_function_versioning.h | 2 +-
> >  lib/meson.build                                  | 5 +++++
> >  2 files changed, 6 insertions(+), 1 deletion(-)
> 
> As suggested by Ray, we should add a note in the documentation about the ABI
> compatibility. Because we have no function versioning, we cannot ensure ABI
> compatibility on Windows.
> 
> I recommend adding this text in doc/guides/windows_gsg/intro.rst under
> "Limitations":
> "
> The :doc:`../contributing/abi_policy` cannot be respected for Windows.
> Minor ABI versions may be incompatible
> because function versioning is not supported on Windows.
> "

Ok, I'll send a new patch with the changes soon.

> 


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [dpdk-dev] [PATCH v5 1/3] eal: disable function versioning on Windows
  2020-07-05 11:46     ` [dpdk-dev] [PATCH v5 1/3] eal: disable function versioning " Fady Bader
@ 2020-07-06  8:19       ` Bruce Richardson
  2020-07-06 10:39         ` Fady Bader
  0 siblings, 1 reply; 34+ messages in thread
From: Bruce Richardson @ 2020-07-06  8:19 UTC (permalink / raw)
  To: Fady Bader
  Cc: dev, thomas, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	olivier.matz, arybchenko, mdr, nhorman

On Sun, Jul 05, 2020 at 02:46:27PM +0300, Fady Bader wrote:
> Function versioning implementation is not supported by Windows.
> Function versioning was disabled on Windows.
> 
> Signed-off-by: Fady Bader <fady@mellanox.com>
> ---
>  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 <rte_common.h>
>  
> -#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'
> -- 

I wonder if this patch can be simplified as follows.

Presumably the use of the RTE_USE_FUNCTION_VERSIONING cflag doesn't cause
any problems building on windows, since it's basically nothing except a
flag to indicate the build is configured properly, so that block can be
left intact. Instead what is needed to be disabled is the
RTE_BUILD_SHARED_LIB setting so that we use the static macros. Therefore,
I think the same result can be got by just changing the following line
in lib/meson.build:

@@ -138,7 +138,7 @@ foreach l:libraries
                                        include_directories: includes,
                                        dependencies: static_deps)

-                       if not use_function_versioning
+                       if not use_function_versioning or is_windows
                                # use pre-build objects to build shared lib
                                sources = []
                                objs += static_lib.extract_all_objects(recursive: false)

Then no error message disabling is needed in windows. I also don't think a
message about function versioning not being supported on windows is
necessary. It's not something the user can do anything about himself
anyway. If we want such a message I think it should just be printed once at
the start of the configuration process, rather than each time we hit a
versioned library.

Regards,
/Bruce

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [dpdk-dev] [PATCH v5 1/3] eal: disable function versioning on Windows
  2020-07-06  8:19       ` Bruce Richardson
@ 2020-07-06 10:39         ` Fady Bader
  0 siblings, 0 replies; 34+ messages in thread
From: Fady Bader @ 2020-07-06 10:39 UTC (permalink / raw)
  To: Bruce Richardson
  Cc: dev, Thomas Monjalon, Tasnim Bashar, Tal Shnaiderman, Yohad Tor,
	dmitry.kozliuk, harini.ramakrishnan, ocardona, pallavi.kadam,
	ranjit.menon, olivier.matz, arybchenko, mdr, nhorman



> -----Original Message-----
> From: Bruce Richardson <bruce.richardson@intel.com>
> Sent: Monday, July 6, 2020 11:20 AM
> To: Fady Bader <fady@mellanox.com>
> Cc: dev@dpdk.org; Thomas Monjalon <thomas@monjalon.net>; Tasnim Bashar
> <tbashar@mellanox.com>; Tal Shnaiderman <talshn@mellanox.com>; Yohad Tor
> <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
> Subject: Re: [dpdk-dev] [PATCH v5 1/3] eal: disable function versioning on
> Windows
> 
> On Sun, Jul 05, 2020 at 02:46:27PM +0300, Fady Bader wrote:
> > Function versioning implementation is not supported by Windows.
> > Function versioning was disabled on Windows.
> >
> > Signed-off-by: Fady Bader <fady@mellanox.com>
> > ---
> >  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 <rte_common.h>
> >
> > -#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'
> > --
> 
> I wonder if this patch can be simplified as follows.
> 
> Presumably the use of the RTE_USE_FUNCTION_VERSIONING cflag doesn't
> cause any problems building on windows, since it's basically nothing except a flag
> to indicate the build is configured properly, so that block can be left intact.
> Instead what is needed to be disabled is the RTE_BUILD_SHARED_LIB setting so
> that we use the static macros. Therefore, I think the same result can be got by
> just changing the following line in lib/meson.build:
> 
> @@ -138,7 +138,7 @@ foreach l:libraries
>                                         include_directories: includes,
>                                         dependencies: static_deps)
> 
> -                       if not use_function_versioning
> +                       if not use_function_versioning or is_windows
>                                 # use pre-build objects to build shared lib
>                                 sources = []
>                                 objs += static_lib.extract_all_objects(recursive: false)

Good point, the patch is much simpler now.
I'll send a new version soon.

> 
> Then no error message disabling is needed in windows. I also don't think a
> message about function versioning not being supported on windows is
> necessary. It's not something the user can do anything about himself anyway. If
> we want such a message I think it should just be printed once at the start of the
> configuration process, rather than each time we hit a versioned library.

It was added in order to avoid confusions in case Linux developers try to run the 
project on windows. I'll print it once.

> 
> Regards,
> /Bruce

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [dpdk-dev] [PATCH v7 0/3] build mempool on Windows
  2020-07-05 13:47     ` [dpdk-dev] [PATCH v6 0/3] build mempool " Fady Bader
                         ` (2 preceding siblings ...)
  2020-07-05 13:47       ` [dpdk-dev] [PATCH v6 3/3] mempool: mempool build on Windows Fady Bader
@ 2020-07-06 11:32       ` Fady Bader
  2020-07-06 11:32         ` [dpdk-dev] [PATCH v7 1/3] eal: disable function versioning " Fady Bader
                           ` (3 more replies)
  3 siblings, 4 replies; 34+ messages in thread
From: Fady Bader @ 2020-07-06 11:32 UTC (permalink / raw)
  To: dev
  Cc: thomas, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	olivier.matz, arybchenko, mdr, nhorman

v7:
    * fixed commit messages style issues.
    * disabled function versioning in a simpler way.

v6:
    * fixed generic memory management usage.
    * removed unneeded exports.

v5:
    * disabled function versioning on Windows in lib/meson.build.

v4:
    * Fixed some commit messages and added comments to unclear code.

v3:
    * Rebased on current master and v5 of "eal/windows: ring build on Windows".

v2:
    * Replace ifndef of tracepoints with symbol export from memory management
      patchset.

Fady Bader (3):
  eal: disable function versioning on Windows
  mempool: use generic memory management
  mempool: mempool build on Windows

 doc/guides/windows_gsg/intro.rst   |  4 ++++
 lib/librte_eal/rte_eal_exports.def |  6 ++++++
 lib/librte_mempool/rte_mempool.c   | 26 ++++++++++++--------------
 lib/meson.build                    |  8 ++++++--
 4 files changed, 28 insertions(+), 16 deletions(-)

-- 
2.16.1.windows.4


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [dpdk-dev] [PATCH v7 1/3] eal: disable function versioning on Windows
  2020-07-06 11:32       ` [dpdk-dev] [PATCH v7 0/3] build mempool " Fady Bader
@ 2020-07-06 11:32         ` Fady Bader
  2020-07-06 12:22           ` Bruce Richardson
  2020-07-06 11:32         ` [dpdk-dev] [PATCH v7 2/3] mempool: use generic memory management Fady Bader
                           ` (2 subsequent siblings)
  3 siblings, 1 reply; 34+ messages in thread
From: Fady Bader @ 2020-07-06 11:32 UTC (permalink / raw)
  To: dev
  Cc: thomas, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	olivier.matz, arybchenko, mdr, nhorman

Function versioning implementation is not supported by Windows.
Function versioning is disabled on Windows.

Signed-off-by: Fady Bader <fady@mellanox.com>
---
 doc/guides/windows_gsg/intro.rst | 4 ++++
 lib/meson.build                  | 6 +++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/doc/guides/windows_gsg/intro.rst b/doc/guides/windows_gsg/intro.rst
index a0285732df..58c6246404 100644
--- a/doc/guides/windows_gsg/intro.rst
+++ b/doc/guides/windows_gsg/intro.rst
@@ -18,3 +18,7 @@ DPDK for Windows is currently a work in progress. Not all DPDK source files
 compile. Support is being added in pieces so as to limit the overall scope
 of any individual patch series. The goal is to be able to run any DPDK
 application natively on Windows.
+
+The :doc:`../contributing/abi_policy` cannot be respected for Windows.
+Minor ABI versions may be incompatible
+because function versioning is not supported on Windows.
diff --git a/lib/meson.build b/lib/meson.build
index c1b9e1633f..dadf151f78 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -107,6 +107,10 @@ 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))
+			endif
 
 			if use_function_versioning
 				cflags += '-DRTE_USE_FUNCTION_VERSIONING'
@@ -138,7 +142,7 @@ foreach l:libraries
 					include_directories: includes,
 					dependencies: static_deps)
 
-			if not use_function_versioning
+			if not use_function_versioning or is_windows
 				# use pre-build objects to build shared lib
 				sources = []
 				objs += static_lib.extract_all_objects(recursive: false)
-- 
2.16.1.windows.4


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [dpdk-dev] [PATCH v7 2/3] mempool: use generic memory management
  2020-07-06 11:32       ` [dpdk-dev] [PATCH v7 0/3] build mempool " Fady Bader
  2020-07-06 11:32         ` [dpdk-dev] [PATCH v7 1/3] eal: disable function versioning " Fady Bader
@ 2020-07-06 11:32         ` Fady Bader
  2020-07-06 11:32         ` [dpdk-dev] [PATCH v7 3/3] mempool: mempool build on Windows Fady Bader
  2020-07-06 23:29         ` [dpdk-dev] [PATCH v7 0/3] build mempool " Thomas Monjalon
  3 siblings, 0 replies; 34+ messages in thread
From: Fady Bader @ 2020-07-06 11:32 UTC (permalink / raw)
  To: dev
  Cc: thomas, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	olivier.matz, arybchenko, mdr, nhorman

Using generic memory management calls instead of Unix memory management
calls for mempool.

Signed-off-by: Fady Bader <fady@mellanox.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
---
 lib/librte_mempool/rte_mempool.c | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
index 0bde995b52..a2bd24984b 100644
--- a/lib/librte_mempool/rte_mempool.c
+++ b/lib/librte_mempool/rte_mempool.c
@@ -12,7 +12,6 @@
 #include <inttypes.h>
 #include <errno.h>
 #include <sys/queue.h>
-#include <sys/mman.h>
 
 #include <rte_common.h>
 #include <rte_log.h>
@@ -32,6 +31,8 @@
 #include <rte_spinlock.h>
 #include <rte_tailq.h>
 #include <rte_function_versioning.h>
+#include <rte_eal_paging.h>
+
 
 #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,17 @@ 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) {
-		rte_errno = errno;
+	addr = rte_mem_map(NULL, size, RTE_PROT_READ | RTE_PROT_WRITE,
+		RTE_MAP_SHARED | RTE_MAP_ANONYMOUS, -1, 0);
+	if (addr == NULL)
 		return 0;
-	}
 	/* can't use MMAP_LOCKED, it does not exist on BSD */
-	if (mlock(addr, size) < 0) {
-		rte_errno = errno;
-		munmap(addr, size);
+	if (rte_mem_lock(addr, size) < 0) {
+		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;
-- 
2.16.1.windows.4


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [dpdk-dev] [PATCH v7 3/3] mempool: mempool build on Windows
  2020-07-06 11:32       ` [dpdk-dev] [PATCH v7 0/3] build mempool " Fady Bader
  2020-07-06 11:32         ` [dpdk-dev] [PATCH v7 1/3] eal: disable function versioning " Fady Bader
  2020-07-06 11:32         ` [dpdk-dev] [PATCH v7 2/3] mempool: use generic memory management Fady Bader
@ 2020-07-06 11:32         ` Fady Bader
  2020-07-06 23:29         ` [dpdk-dev] [PATCH v7 0/3] build mempool " Thomas Monjalon
  3 siblings, 0 replies; 34+ messages in thread
From: Fady Bader @ 2020-07-06 11:32 UTC (permalink / raw)
  To: dev
  Cc: thomas, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	olivier.matz, arybchenko, mdr, nhorman

Some EAL functions are used by mempool lib but not exported on Windows.
The functions are exported.
Added mempool to supported libraries for Windows compilation.

Signed-off-by: Fady Bader <fady@mellanox.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
---
 lib/librte_eal/rte_eal_exports.def | 6 ++++++
 lib/meson.build                    | 2 +-
 2 files changed, 7 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/meson.build b/lib/meson.build
index dadf151f78..12d5f81e9b 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
 
-- 
2.16.1.windows.4


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [dpdk-dev] [PATCH v7 1/3] eal: disable function versioning on Windows
  2020-07-06 11:32         ` [dpdk-dev] [PATCH v7 1/3] eal: disable function versioning " Fady Bader
@ 2020-07-06 12:22           ` Bruce Richardson
  2020-07-06 23:16             ` Thomas Monjalon
  0 siblings, 1 reply; 34+ messages in thread
From: Bruce Richardson @ 2020-07-06 12:22 UTC (permalink / raw)
  To: Fady Bader
  Cc: dev, thomas, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	olivier.matz, arybchenko, mdr, nhorman

On Mon, Jul 06, 2020 at 02:32:39PM +0300, Fady Bader wrote:
> Function versioning implementation is not supported by Windows.
> Function versioning is disabled on Windows.
> 
> Signed-off-by: Fady Bader <fady@mellanox.com>
> ---
>  doc/guides/windows_gsg/intro.rst | 4 ++++
>  lib/meson.build                  | 6 +++++-
>  2 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/doc/guides/windows_gsg/intro.rst b/doc/guides/windows_gsg/intro.rst
> index a0285732df..58c6246404 100644
> --- a/doc/guides/windows_gsg/intro.rst
> +++ b/doc/guides/windows_gsg/intro.rst
> @@ -18,3 +18,7 @@ DPDK for Windows is currently a work in progress. Not all DPDK source files
>  compile. Support is being added in pieces so as to limit the overall scope
>  of any individual patch series. The goal is to be able to run any DPDK
>  application natively on Windows.
> +
> +The :doc:`../contributing/abi_policy` cannot be respected for Windows.
> +Minor ABI versions may be incompatible
> +because function versioning is not supported on Windows.
> diff --git a/lib/meson.build b/lib/meson.build
> index c1b9e1633f..dadf151f78 100644
> --- a/lib/meson.build
> +++ b/lib/meson.build
> @@ -107,6 +107,10 @@ 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))
> +			endif
>  

This is ok here, but I think it might be better just moved to somewhere
like config/meson.build, so that it is always just printed once for each
build. I don't see an issue with having it printed even if there is no
function versioning in the build itself.

>  			if use_function_versioning
>  				cflags += '-DRTE_USE_FUNCTION_VERSIONING'
> @@ -138,7 +142,7 @@ foreach l:libraries
>  					include_directories: includes,
>  					dependencies: static_deps)
>  
> -			if not use_function_versioning
> +			if not use_function_versioning or is_windows
>  				# use pre-build objects to build shared lib
>  				sources = []
>  				objs += static_lib.extract_all_objects(recursive: false)
> -- 
> 2.16.1.windows.4
> 

With or without the code move above, which is just a suggestion,

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [dpdk-dev] [PATCH v7 1/3] eal: disable function versioning on Windows
  2020-07-06 12:22           ` Bruce Richardson
@ 2020-07-06 23:16             ` Thomas Monjalon
  0 siblings, 0 replies; 34+ messages in thread
From: Thomas Monjalon @ 2020-07-06 23:16 UTC (permalink / raw)
  To: Bruce Richardson
  Cc: Fady Bader, dev, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	olivier.matz, arybchenko, mdr, nhorman

06/07/2020 14:22, Bruce Richardson:
> On Mon, Jul 06, 2020 at 02:32:39PM +0300, Fady Bader wrote:
> > Function versioning implementation is not supported by Windows.
> > Function versioning is disabled on Windows.
> > 
> > Signed-off-by: Fady Bader <fady@mellanox.com>
> > ---
> >  doc/guides/windows_gsg/intro.rst | 4 ++++
> >  lib/meson.build                  | 6 +++++-
> >  2 files changed, 9 insertions(+), 1 deletion(-)
> > 
> > diff --git a/doc/guides/windows_gsg/intro.rst b/doc/guides/windows_gsg/intro.rst
> > index a0285732df..58c6246404 100644
> > --- a/doc/guides/windows_gsg/intro.rst
> > +++ b/doc/guides/windows_gsg/intro.rst
> > @@ -18,3 +18,7 @@ DPDK for Windows is currently a work in progress. Not all DPDK source files
> >  compile. Support is being added in pieces so as to limit the overall scope
> >  of any individual patch series. The goal is to be able to run any DPDK
> >  application natively on Windows.
> > +
> > +The :doc:`../contributing/abi_policy` cannot be respected for Windows.
> > +Minor ABI versions may be incompatible
> > +because function versioning is not supported on Windows.
> > diff --git a/lib/meson.build b/lib/meson.build
> > index c1b9e1633f..dadf151f78 100644
> > --- a/lib/meson.build
> > +++ b/lib/meson.build
> > @@ -107,6 +107,10 @@ 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))
> > +			endif
> >  
> 
> This is ok here, but I think it might be better just moved to somewhere
> like config/meson.build, so that it is always just printed once for each
> build. I don't see an issue with having it printed even if there is no
> function versioning in the build itself.

Moving such message in config/meson.build is the same
as moving it to the doc.
I prefer having a message each time a library compatibility
is required but not possible.

> With or without the code move above, which is just a suggestion,
> 
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>

OK thanks, I'll merge as is.



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [dpdk-dev] [PATCH v7 0/3] build mempool on Windows
  2020-07-06 11:32       ` [dpdk-dev] [PATCH v7 0/3] build mempool " Fady Bader
                           ` (2 preceding siblings ...)
  2020-07-06 11:32         ` [dpdk-dev] [PATCH v7 3/3] mempool: mempool build on Windows Fady Bader
@ 2020-07-06 23:29         ` Thomas Monjalon
  3 siblings, 0 replies; 34+ messages in thread
From: Thomas Monjalon @ 2020-07-06 23:29 UTC (permalink / raw)
  To: Fady Bader
  Cc: dev, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	olivier.matz, arybchenko, mdr, nhorman

> Fady Bader (3):
>   eal: disable function versioning on Windows
>   mempool: use generic memory management
>   mempool: mempool build on Windows

Applied, thanks




^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2020-07-06 23:29 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-02 13:14 [dpdk-dev] [PATCH v4 0/3] build mempool on Windows Fady Bader
2020-07-02 13:14 ` [dpdk-dev] [PATCH v4 1/3] eal: disable function versioning " Fady Bader
2020-07-05 11:46   ` [dpdk-dev] [PATCH v5 0/3] build mempool " Fady Bader
2020-07-05 11:46     ` [dpdk-dev] [PATCH v5 1/3] eal: disable function versioning " Fady Bader
2020-07-06  8:19       ` Bruce Richardson
2020-07-06 10:39         ` Fady Bader
2020-07-05 11:46     ` [dpdk-dev] [PATCH v5 2/3] mempool: use generic memory management Fady Bader
2020-07-05 11:50       ` Andrew Rybchenko
2020-07-05 12:08       ` Dmitry Kozlyuk
2020-07-05 12:25         ` Fady Bader
2020-07-05 11:46     ` [dpdk-dev] [PATCH v5 3/3] mempool: mempool build on Windows Fady Bader
2020-07-05 12:01       ` David Marchand
2020-07-05 12:24         ` Fady Bader
2020-07-05 13:47     ` [dpdk-dev] [PATCH v6 0/3] build mempool " Fady Bader
2020-07-05 13:47       ` [dpdk-dev] [PATCH v6 1/3] eal: disable function versioning " Fady Bader
2020-07-05 14:36         ` Tal Shnaiderman
2020-07-05 20:23         ` Thomas Monjalon
2020-07-06  7:02           ` Fady Bader
2020-07-05 13:47       ` [dpdk-dev] [PATCH v6 2/3] mempool: use generic memory management Fady Bader
2020-07-05 15:26         ` Dmitry Kozlyuk
2020-07-05 20:08         ` Thomas Monjalon
2020-07-05 13:47       ` [dpdk-dev] [PATCH v6 3/3] mempool: mempool build on Windows Fady Bader
2020-07-05 20:25         ` Thomas Monjalon
2020-07-06 11:32       ` [dpdk-dev] [PATCH v7 0/3] build mempool " Fady Bader
2020-07-06 11:32         ` [dpdk-dev] [PATCH v7 1/3] eal: disable function versioning " Fady Bader
2020-07-06 12:22           ` Bruce Richardson
2020-07-06 23:16             ` Thomas Monjalon
2020-07-06 11:32         ` [dpdk-dev] [PATCH v7 2/3] mempool: use generic memory management Fady Bader
2020-07-06 11:32         ` [dpdk-dev] [PATCH v7 3/3] mempool: mempool build on Windows Fady Bader
2020-07-06 23:29         ` [dpdk-dev] [PATCH v7 0/3] build mempool " Thomas Monjalon
2020-07-02 13:14 ` [dpdk-dev] [PATCH v4 2/3] mempool: use generic memory management Fady Bader
2020-07-03 13:16   ` Olivier Matz
2020-07-02 13:14 ` [dpdk-dev] [PATCH v4 3/3] mempool: mempool build on Windows Fady Bader
2020-07-03 13:17   ` Olivier Matz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).