From: Jerin Jacob <jer...@marvell.com> Add the following thread related tracepoints.
rte_trace_lib_eal_thread_remote_launch; rte_trace_lib_eal_thread_lcore_ready; Signed-off-by: Jerin Jacob <jer...@marvell.com> --- lib/librte_eal/common/eal_common_trace_points.c | 9 +++++++++ lib/librte_eal/common/include/rte_trace_eal.h | 14 ++++++++++++++ lib/librte_eal/freebsd/eal/eal_interrupts.c | 2 +- lib/librte_eal/freebsd/eal/eal_thread.c | 11 ++++++++--- lib/librte_eal/linux/eal/eal_thread.c | 11 ++++++++--- lib/librte_eal/rte_eal_version.map | 2 ++ 6 files changed, 42 insertions(+), 7 deletions(-) diff --git a/lib/librte_eal/common/eal_common_trace_points.c b/lib/librte_eal/common/eal_common_trace_points.c index aeaeac061..2c0b72b5c 100644 --- a/lib/librte_eal/common/eal_common_trace_points.c +++ b/lib/librte_eal/common/eal_common_trace_points.c @@ -35,6 +35,9 @@ RTE_TRACE_POINT_DEFINE(rte_trace_lib_eal_memzone_reserve); RTE_TRACE_POINT_DEFINE(rte_trace_lib_eal_memzone_lookup); RTE_TRACE_POINT_DEFINE(rte_trace_lib_eal_memzone_free); +RTE_TRACE_POINT_DEFINE(rte_trace_lib_eal_thread_remote_launch); +RTE_TRACE_POINT_DEFINE(rte_trace_lib_eal_thread_lcore_ready); + RTE_INIT(eal_trace_init) { RTE_TRACE_POINT_REGISTER(rte_trace_lib_eal_generic_void, @@ -90,4 +93,10 @@ RTE_INIT(eal_trace_init) lib.eal.memzone.lookup, INFO); RTE_TRACE_POINT_REGISTER(rte_trace_lib_eal_memzone_free, lib.eal.memzone.free, INFO); + + RTE_TRACE_POINT_REGISTER(rte_trace_lib_eal_thread_remote_launch, + lib.eal.thread.remote.launch, INFO); + RTE_TRACE_POINT_REGISTER(rte_trace_lib_eal_thread_lcore_ready, + lib.eal.thread.lcore.ready, INFO); + } diff --git a/lib/librte_eal/common/include/rte_trace_eal.h b/lib/librte_eal/common/include/rte_trace_eal.h index abbaea5e0..8197e198a 100644 --- a/lib/librte_eal/common/include/rte_trace_eal.h +++ b/lib/librte_eal/common/include/rte_trace_eal.h @@ -191,6 +191,20 @@ RTE_TRACE_POINT( rte_trace_ctf_int(rc); ) +/* Thread */ +RTE_TRACE_POINT( + rte_trace_lib_eal_thread_remote_launch, + RTE_TRACE_POINT_ARGS(int (*f)(void *), void *arg, + unsigned int slave_id, int rc), + rte_trace_ctf_ptr(f); rte_trace_ctf_ptr(arg); + rte_trace_ctf_u32(slave_id); rte_trace_ctf_int(rc); +) +RTE_TRACE_POINT( + rte_trace_lib_eal_thread_lcore_ready, + RTE_TRACE_POINT_ARGS(unsigned int lcore_id, const char *cpuset), + rte_trace_ctf_u32(lcore_id); rte_trace_ctf_string(cpuset); +) + #ifdef __cplusplus } diff --git a/lib/librte_eal/freebsd/eal/eal_interrupts.c b/lib/librte_eal/freebsd/eal/eal_interrupts.c index 00991f26a..7def3189b 100644 --- a/lib/librte_eal/freebsd/eal/eal_interrupts.c +++ b/lib/librte_eal/freebsd/eal/eal_interrupts.c @@ -85,7 +85,7 @@ rte_intr_callback_register(const struct rte_intr_handle *intr_handle, { struct rte_intr_callback *callback; struct rte_intr_source *src; - int ret, add_event = 0; + int ret = 0, add_event = 0; /* first do parameter checking */ if (intr_handle == NULL || intr_handle->fd < 0 || cb == NULL) { diff --git a/lib/librte_eal/freebsd/eal/eal_thread.c b/lib/librte_eal/freebsd/eal/eal_thread.c index aaccb4926..66b0765cf 100644 --- a/lib/librte_eal/freebsd/eal/eal_thread.c +++ b/lib/librte_eal/freebsd/eal/eal_thread.c @@ -20,7 +20,7 @@ #include <rte_per_lcore.h> #include <rte_eal.h> #include <rte_lcore.h> -#include <rte_trace.h> +#include <rte_trace_eal.h> #include "eal_private.h" #include "eal_thread.h" @@ -41,9 +41,10 @@ rte_eal_remote_launch(int (*f)(void *), void *arg, unsigned slave_id) char c = 0; int m2s = lcore_config[slave_id].pipe_master2slave[1]; int s2m = lcore_config[slave_id].pipe_slave2master[0]; + int rc = -EBUSY; if (lcore_config[slave_id].state != WAIT) - return -EBUSY; + goto finish; lcore_config[slave_id].f = f; lcore_config[slave_id].arg = arg; @@ -63,7 +64,10 @@ rte_eal_remote_launch(int (*f)(void *), void *arg, unsigned slave_id) if (n <= 0) rte_panic("cannot read on configuration pipe\n"); - return 0; + rc = 0; +finish: + rte_trace_lib_eal_thread_remote_launch(f, arg, slave_id, rc); + return rc; } /* set affinity for current thread */ @@ -126,6 +130,7 @@ eal_thread_loop(__attribute__((unused)) void *arg) lcore_id, thread_id, cpuset, ret == 0 ? "" : "..."); __rte_trace_mem_per_thread_alloc(); + rte_trace_lib_eal_thread_lcore_ready(lcore_id, cpuset); /* read on our pipe to get commands */ while (1) { diff --git a/lib/librte_eal/linux/eal/eal_thread.c b/lib/librte_eal/linux/eal/eal_thread.c index 45f4dce44..afadbcbd7 100644 --- a/lib/librte_eal/linux/eal/eal_thread.c +++ b/lib/librte_eal/linux/eal/eal_thread.c @@ -20,7 +20,7 @@ #include <rte_per_lcore.h> #include <rte_eal.h> #include <rte_lcore.h> -#include <rte_trace.h> +#include <rte_trace_eal.h> #include "eal_private.h" #include "eal_thread.h" @@ -41,9 +41,10 @@ rte_eal_remote_launch(int (*f)(void *), void *arg, unsigned slave_id) char c = 0; int m2s = lcore_config[slave_id].pipe_master2slave[1]; int s2m = lcore_config[slave_id].pipe_slave2master[0]; + int rc = -EBUSY; if (lcore_config[slave_id].state != WAIT) - return -EBUSY; + goto finish; lcore_config[slave_id].f = f; lcore_config[slave_id].arg = arg; @@ -63,7 +64,10 @@ rte_eal_remote_launch(int (*f)(void *), void *arg, unsigned slave_id) if (n <= 0) rte_panic("cannot read on configuration pipe\n"); - return 0; + rc = 0; +finish: + rte_trace_lib_eal_thread_remote_launch(f, arg, slave_id, rc); + return rc; } /* set affinity for current EAL thread */ @@ -126,6 +130,7 @@ eal_thread_loop(__attribute__((unused)) void *arg) lcore_id, (uintptr_t)thread_id, cpuset, ret == 0 ? "" : "..."); __rte_trace_mem_per_thread_alloc(); + rte_trace_lib_eal_thread_lcore_ready(lcore_id, cpuset); /* read on our pipe to get commands */ while (1) { diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map index 5580b2962..afaf16689 100644 --- a/lib/librte_eal/rte_eal_version.map +++ b/lib/librte_eal/rte_eal_version.map @@ -391,4 +391,6 @@ EXPERIMENTAL { __rte_trace_lib_eal_memzone_reserve; __rte_trace_lib_eal_memzone_lookup; __rte_trace_lib_eal_memzone_free; + __rte_trace_lib_eal_thread_remote_launch; + __rte_trace_lib_eal_thread_lcore_ready; }; -- 2.25.1