[v5,06/11] trace: add size_t field emitter
diff mbox series

Message ID 20200525003720.6410-7-dmitry.kozliuk@gmail.com
State Superseded, archived
Delegated to: Thomas Monjalon
Headers show
Series
  • Windows basic memory management
Related show

Checks

Context Check Description
ci/Intel-compilation fail Compilation issues
ci/checkpatch success coding style OK

Commit Message

Dmitry Kozlyuk May 25, 2020, 12:37 a.m. UTC
It is not guaranteed that sizeof(long) == sizeof(size_t). On Windows,
sizeof(long) == 4 and sizeof(size_t) == 8 for 64-bit programs.
Tracepoints using "long" field emitter are therefore invalid there.
Add dedicated field emitter for size_t and use it to store size_t values
in all existing tracepoints.

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
---
 lib/librte_eal/include/rte_eal_trace.h   |  8 ++++----
 lib/librte_eal/include/rte_trace_point.h |  1 +
 lib/librte_mempool/rte_mempool_trace.h   | 10 +++++-----
 3 files changed, 10 insertions(+), 9 deletions(-)

Comments

Jerin Jacob May 25, 2020, 5:53 a.m. UTC | #1
On Mon, May 25, 2020 at 6:08 AM Dmitry Kozlyuk <dmitry.kozliuk@gmail.com> wrote:
>
> It is not guaranteed that sizeof(long) == sizeof(size_t). On Windows,
> sizeof(long) == 4 and sizeof(size_t) == 8 for 64-bit programs.
> Tracepoints using "long" field emitter are therefore invalid there.
> Add dedicated field emitter for size_t and use it to store size_t values
> in all existing tracepoints.
>
> Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> ---

The Doxygen comment for the new emit function is missing.
See https://github.com/DPDK/dpdk/blob/master/lib/librte_eal/include/rte_trace_point.h#L138

Other than the above nit, rest looks good to me.

Patch
diff mbox series

diff --git a/lib/librte_eal/include/rte_eal_trace.h b/lib/librte_eal/include/rte_eal_trace.h
index 1ebb2905a..bcfef0cfa 100644
--- a/lib/librte_eal/include/rte_eal_trace.h
+++ b/lib/librte_eal/include/rte_eal_trace.h
@@ -143,7 +143,7 @@  RTE_TRACE_POINT(
 	RTE_TRACE_POINT_ARGS(const char *type, size_t size, unsigned int align,
 		int socket, void *ptr),
 	rte_trace_point_emit_string(type);
-	rte_trace_point_emit_long(size);
+	rte_trace_point_emit_size_t(size);
 	rte_trace_point_emit_u32(align);
 	rte_trace_point_emit_int(socket);
 	rte_trace_point_emit_ptr(ptr);
@@ -154,7 +154,7 @@  RTE_TRACE_POINT(
 	RTE_TRACE_POINT_ARGS(const char *type, size_t size, unsigned int align,
 		int socket, void *ptr),
 	rte_trace_point_emit_string(type);
-	rte_trace_point_emit_long(size);
+	rte_trace_point_emit_size_t(size);
 	rte_trace_point_emit_u32(align);
 	rte_trace_point_emit_int(socket);
 	rte_trace_point_emit_ptr(ptr);
@@ -164,7 +164,7 @@  RTE_TRACE_POINT(
 	rte_eal_trace_mem_realloc,
 	RTE_TRACE_POINT_ARGS(size_t size, unsigned int align, int socket,
 		void *ptr),
-	rte_trace_point_emit_long(size);
+	rte_trace_point_emit_size_t(size);
 	rte_trace_point_emit_u32(align);
 	rte_trace_point_emit_int(socket);
 	rte_trace_point_emit_ptr(ptr);
@@ -183,7 +183,7 @@  RTE_TRACE_POINT(
 		unsigned int flags, unsigned int align, unsigned int bound,
 		const void *mz),
 	rte_trace_point_emit_string(name);
-	rte_trace_point_emit_long(len);
+	rte_trace_point_emit_size_t(len);
 	rte_trace_point_emit_int(socket_id);
 	rte_trace_point_emit_u32(flags);
 	rte_trace_point_emit_u32(align);
diff --git a/lib/librte_eal/include/rte_trace_point.h b/lib/librte_eal/include/rte_trace_point.h
index b45171275..3b513bd43 100644
--- a/lib/librte_eal/include/rte_trace_point.h
+++ b/lib/librte_eal/include/rte_trace_point.h
@@ -395,6 +395,7 @@  do { \
 #define rte_trace_point_emit_i8(in) __rte_trace_point_emit(in, int8_t)
 #define rte_trace_point_emit_int(in) __rte_trace_point_emit(in, int32_t)
 #define rte_trace_point_emit_long(in) __rte_trace_point_emit(in, long)
+#define rte_trace_point_emit_size_t(in) __rte_trace_point_emit(in, size_t)
 #define rte_trace_point_emit_float(in) __rte_trace_point_emit(in, float)
 #define rte_trace_point_emit_double(in) __rte_trace_point_emit(in, double)
 #define rte_trace_point_emit_ptr(in) __rte_trace_point_emit(in, uintptr_t)
diff --git a/lib/librte_mempool/rte_mempool_trace.h b/lib/librte_mempool/rte_mempool_trace.h
index e776df0a6..087c913c8 100644
--- a/lib/librte_mempool/rte_mempool_trace.h
+++ b/lib/librte_mempool/rte_mempool_trace.h
@@ -72,7 +72,7 @@  RTE_TRACE_POINT(
 	rte_trace_point_emit_string(mempool->name);
 	rte_trace_point_emit_ptr(vaddr);
 	rte_trace_point_emit_u64(iova);
-	rte_trace_point_emit_long(len);
+	rte_trace_point_emit_size_t(len);
 	rte_trace_point_emit_ptr(free_cb);
 	rte_trace_point_emit_ptr(opaque);
 )
@@ -84,8 +84,8 @@  RTE_TRACE_POINT(
 	rte_trace_point_emit_ptr(mempool);
 	rte_trace_point_emit_string(mempool->name);
 	rte_trace_point_emit_ptr(addr);
-	rte_trace_point_emit_long(len);
-	rte_trace_point_emit_long(pg_sz);
+	rte_trace_point_emit_size_t(len);
+	rte_trace_point_emit_size_t(pg_sz);
 	rte_trace_point_emit_ptr(free_cb);
 	rte_trace_point_emit_ptr(opaque);
 )
@@ -126,7 +126,7 @@  RTE_TRACE_POINT(
 	RTE_TRACE_POINT_ARGS(struct rte_mempool *mempool, size_t pg_sz),
 	rte_trace_point_emit_ptr(mempool);
 	rte_trace_point_emit_string(mempool->name);
-	rte_trace_point_emit_long(pg_sz);
+	rte_trace_point_emit_size_t(pg_sz);
 )
 
 RTE_TRACE_POINT(
@@ -139,7 +139,7 @@  RTE_TRACE_POINT(
 	rte_trace_point_emit_u32(max_objs);
 	rte_trace_point_emit_ptr(vaddr);
 	rte_trace_point_emit_u64(iova);
-	rte_trace_point_emit_long(len);
+	rte_trace_point_emit_size_t(len);
 	rte_trace_point_emit_ptr(obj_cb);
 	rte_trace_point_emit_ptr(obj_cb_arg);
 )