trace: add thread tracepoints
authorJerin Jacob <jerinj@marvell.com>
Wed, 22 Apr 2020 19:03:37 +0000 (00:33 +0530)
committerDavid Marchand <david.marchand@redhat.com>
Thu, 23 Apr 2020 13:39:53 +0000 (15:39 +0200)
Add the following thread related tracepoints.

- rte_eal_trace_thread_remote_launch()
- rte_eal_trace_thread_lcore_ready()

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
lib/librte_eal/common/eal_common_trace_points.c
lib/librte_eal/freebsd/eal_thread.c
lib/librte_eal/include/rte_eal_trace.h
lib/librte_eal/linux/eal_thread.c
lib/librte_eal/rte_eal_version.map

index e76a66d..aca1846 100644 (file)
@@ -35,6 +35,9 @@ RTE_TRACE_POINT_DEFINE(rte_eal_trace_memzone_reserve);
 RTE_TRACE_POINT_DEFINE(rte_eal_trace_memzone_lookup);
 RTE_TRACE_POINT_DEFINE(rte_eal_trace_memzone_free);
 
+RTE_TRACE_POINT_DEFINE(rte_eal_trace_thread_remote_launch);
+RTE_TRACE_POINT_DEFINE(rte_eal_trace_thread_lcore_ready);
+
 RTE_INIT(eal_trace_init)
 {
        RTE_TRACE_POINT_REGISTER(rte_eal_trace_generic_void,
@@ -90,4 +93,9 @@ RTE_INIT(eal_trace_init)
                lib.eal.memzone.lookup);
        RTE_TRACE_POINT_REGISTER(rte_eal_trace_memzone_free,
                lib.eal.memzone.free);
+
+       RTE_TRACE_POINT_REGISTER(rte_eal_trace_thread_remote_launch,
+               lib.eal.thread.remote.launch);
+       RTE_TRACE_POINT_REGISTER(rte_eal_trace_thread_lcore_ready,
+               lib.eal.thread.lcore.ready);
 }
index c25b4a0..b520197 100644 (file)
@@ -20,8 +20,7 @@
 #include <rte_per_lcore.h>
 #include <rte_eal.h>
 #include <rte_lcore.h>
-#include <rte_trace.h>
-#include <rte_trace_point.h>
+#include <rte_eal_trace.h>
 
 #include "eal_private.h"
 #include "eal_thread.h"
@@ -42,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;
@@ -64,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_eal_trace_thread_remote_launch(f, arg, slave_id, rc);
+       return rc;
 }
 
 /* set affinity for current thread */
@@ -127,6 +130,7 @@ eal_thread_loop(__rte_unused void *arg)
                lcore_id, thread_id, cpuset, ret == 0 ? "" : "...");
 
        __rte_trace_mem_per_thread_alloc();
+       rte_eal_trace_thread_lcore_ready(lcore_id, cpuset);
 
        /* read on our pipe to get commands */
        while (1) {
index d399893..22ae136 100644 (file)
@@ -205,6 +205,23 @@ RTE_TRACE_POINT(
        rte_trace_point_emit_int(rc);
 )
 
+/* Thread */
+RTE_TRACE_POINT(
+       rte_eal_trace_thread_remote_launch,
+       RTE_TRACE_POINT_ARGS(int (*f)(void *), void *arg,
+               unsigned int slave_id, int rc),
+       rte_trace_point_emit_ptr(f);
+       rte_trace_point_emit_ptr(arg);
+       rte_trace_point_emit_u32(slave_id);
+       rte_trace_point_emit_int(rc);
+)
+RTE_TRACE_POINT(
+       rte_eal_trace_thread_lcore_ready,
+       RTE_TRACE_POINT_ARGS(unsigned int lcore_id, const char *cpuset),
+       rte_trace_point_emit_u32(lcore_id);
+       rte_trace_point_emit_string(cpuset);
+)
+
 #ifdef __cplusplus
 }
 #endif
index 24772fc..cd9d6e0 100644 (file)
@@ -20,8 +20,7 @@
 #include <rte_per_lcore.h>
 #include <rte_eal.h>
 #include <rte_lcore.h>
-#include <rte_trace.h>
-#include <rte_trace_point.h>
+#include <rte_eal_trace.h>
 
 #include "eal_private.h"
 #include "eal_thread.h"
@@ -42,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;
@@ -64,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_eal_trace_thread_remote_launch(f, arg, slave_id, rc);
+       return rc;
 }
 
 /* set affinity for current EAL thread */
@@ -127,6 +130,7 @@ eal_thread_loop(__rte_unused void *arg)
                lcore_id, (uintptr_t)thread_id, cpuset, ret == 0 ? "" : "...");
 
        __rte_trace_mem_per_thread_alloc();
+       rte_eal_trace_thread_lcore_ready(lcore_id, cpuset);
 
        /* read on our pipe to get commands */
        while (1) {
index edec61a..0ccfed7 100644 (file)
@@ -362,6 +362,8 @@ EXPERIMENTAL {
        __rte_eal_trace_memzone_free;
        __rte_eal_trace_memzone_lookup;
        __rte_eal_trace_memzone_reserve;
+       __rte_eal_trace_thread_lcore_ready;
+       __rte_eal_trace_thread_remote_launch;
        __rte_trace_mem_per_thread_alloc;
        __rte_trace_point_emit_field;
        __rte_trace_point_register;