[PATCH v5 1/6] eal: trace: add trace point emit for blob

Sunil Kumar Kori skori at marvell.com
Thu Jan 12 17:29:40 CET 2023


> -----Original Message-----
> From: Ankur Dwivedi <adwivedi at marvell.com>
> Sent: Thursday, January 12, 2023 4:52 PM
> To: dev at dpdk.org
> Cc: thomas at monjalon.net; david.marchand at redhat.com; mdr at ashroe.eu;
> orika at nvidia.com; ferruh.yigit at amd.com; chas3 at att.com;
> humin29 at huawei.com; linville at tuxdriver.com; ciara.loftus at intel.com;
> qi.z.zhang at intel.com; mw at semihalf.com; mk at semihalf.com;
> shaibran at amazon.com; evgenys at amazon.com; igorch at amazon.com;
> chandu at amd.com; Igor Russkikh <irusskikh at marvell.com>;
> shepard.siegel at atomicrules.com; ed.czeck at atomicrules.com;
> john.miller at atomicrules.com; ajit.khaparde at broadcom.com;
> somnath.kotur at broadcom.com; Jerin Jacob Kollanukkaran
> <jerinj at marvell.com>; Maciej Czekaj [C] <mczekaj at marvell.com>; Shijith
> Thotton <sthotton at marvell.com>; Srisivasubramanian Srinivasan
> <srinivasan at marvell.com>; Harman Kalra <hkalra at marvell.com>;
> rahul.lakkireddy at chelsio.com; johndale at cisco.com; hyonkim at cisco.com;
> liudongdong3 at huawei.com; yisen.zhuang at huawei.com;
> xuanziyang2 at huawei.com; cloud.wangxiaoyun at huawei.com;
> zhouguoyang at huawei.com; simei.su at intel.com; wenjun1.wu at intel.com;
> qiming.yang at intel.com; Yuying.Zhang at intel.com; beilei.xing at intel.com;
> xiao.w.wang at intel.com; jingjing.wu at intel.com; junfeng.guo at intel.com;
> rosen.xu at intel.com; Nithin Kumar Dabilpuram
> <ndabilpuram at marvell.com>; Kiran Kumar Kokkilagadda
> <kirankumark at marvell.com>; Sunil Kumar Kori <skori at marvell.com>; Satha
> Koteswara Rao Kottidi <skoteshwar at marvell.com>; Liron Himi
> <lironh at marvell.com>; zr at semihalf.com; Radha Chintakuntla
> <radhac at marvell.com>; Veerasenareddy Burru <vburru at marvell.com>;
> Sathesh B Edara <sedara at marvell.com>; matan at nvidia.com;
> viacheslavo at nvidia.com; longli at microsoft.com; spinler at cesnet.cz;
> chaoyong.he at corigine.com; niklas.soderlund at corigine.com;
> hemant.agrawal at nxp.com; sachin.saxena at oss.nxp.com; g.singh at nxp.com;
> apeksha.gupta at nxp.com; sachin.saxena at nxp.com; aboyer at pensando.io;
> Rasesh Mody <rmody at marvell.com>; Shahed Shaikh
> <shshaikh at marvell.com>; Devendra Singh Rawat
> <dsinghrawat at marvell.com>; andrew.rybchenko at oktetlabs.ru;
> jiawenwu at trustnetic.com; jianwang at trustnetic.com;
> jbehrens at vmware.com; maxime.coquelin at redhat.com;
> chenbo.xia at intel.com; steven.webster at windriver.com;
> matt.peters at windriver.com; bruce.richardson at intel.com;
> mtetsuyah at gmail.com; grive at u256.net; jasvinder.singh at intel.com;
> cristian.dumitrescu at intel.com; jgrajcia at cisco.com;
> mb at smartsharesystems.com; Ankur Dwivedi <adwivedi at marvell.com>
> Subject: [PATCH v5 1/6] eal: trace: add trace point emit for blob
> 
> Adds a trace point emit function for emitting a blob. The maximum blob
> bytes which can be captured is maximum value contained in uint16_t, which
> is 65535.
> 
> Also adds test case for emit array tracepoint function.
> 
> Signed-off-by: Ankur Dwivedi <adwivedi at marvell.com>
> ---
>  app/test/test_trace.c                      |  5 +++++
>  lib/eal/common/eal_common_trace_points.c   |  2 ++
>  lib/eal/include/rte_eal_trace.h            |  6 ++++++
>  lib/eal/include/rte_trace_point.h          | 17 +++++++++++++++++
>  lib/eal/include/rte_trace_point_register.h |  7 +++++++
>  lib/eal/version.map                        |  3 +++
>  6 files changed, 40 insertions(+)
> 
> diff --git a/app/test/test_trace.c b/app/test/test_trace.c index
> 6bedf14024..cf781dc25b 100644
> --- a/app/test/test_trace.c
> +++ b/app/test/test_trace.c
> @@ -4,6 +4,7 @@
> 
>  #include <rte_eal_trace.h>
>  #include <rte_lcore.h>
> +#include <rte_random.h>
>  #include <rte_trace.h>
> 
>  #include "test.h"
> @@ -177,6 +178,7 @@ test_fp_trace_points(void)  static int
>  test_generic_trace_points(void)
>  {
> +	uint8_t arr[32] = {0};
>  	int tmp;
> 
>  	rte_eal_trace_generic_void();
> @@ -195,6 +197,9 @@ test_generic_trace_points(void)
>  	rte_eal_trace_generic_ptr(&tmp);
>  	rte_eal_trace_generic_str("my string");
>  	rte_eal_trace_generic_size_t(sizeof(void *));
> +	rte_eal_trace_generic_blob(arr, 17);
Do we need this test case now as (rte_rand % 32) will make sure to validate array of valid size only i.e. 0-31 ?

> +	rte_eal_trace_generic_blob(arr, 32);
> +	rte_eal_trace_generic_blob(arr, rte_rand() % 32);
When executed trace_autotest then I didn't find 3rd generic.blob trace point.
Can you please explain the behavior ?

>  	RTE_EAL_TRACE_GENERIC_FUNC;
> 
>  	return TEST_SUCCESS;
> diff --git a/lib/eal/common/eal_common_trace_points.c
> b/lib/eal/common/eal_common_trace_points.c
> index 0b0b254615..051f89809c 100644
> --- a/lib/eal/common/eal_common_trace_points.c
> +++ b/lib/eal/common/eal_common_trace_points.c
> @@ -40,6 +40,8 @@
> RTE_TRACE_POINT_REGISTER(rte_eal_trace_generic_size_t,
>  	lib.eal.generic.size_t)
>  RTE_TRACE_POINT_REGISTER(rte_eal_trace_generic_func,
>  	lib.eal.generic.func)
> +RTE_TRACE_POINT_REGISTER(rte_eal_trace_generic_blob,
> +	lib.eal.generic.blob)
> 
>  RTE_TRACE_POINT_REGISTER(rte_eal_trace_alarm_set,
>  	lib.eal.alarm.set)
> diff --git a/lib/eal/include/rte_eal_trace.h b/lib/eal/include/rte_eal_trace.h
> index 5ef4398230..02e3a564a1 100644
> --- a/lib/eal/include/rte_eal_trace.h
> +++ b/lib/eal/include/rte_eal_trace.h
> @@ -143,6 +143,12 @@ RTE_TRACE_POINT(
>  	rte_trace_point_emit_string(func);
>  )
> 
> +RTE_TRACE_POINT(
> +	rte_eal_trace_generic_blob,
> +	RTE_TRACE_POINT_ARGS(void *in, uint16_t len),
> +	rte_trace_point_emit_blob(in, len);
> +)
> +
>  #define RTE_EAL_TRACE_GENERIC_FUNC
> rte_eal_trace_generic_func(__func__)
> 
>  /* Interrupt */
> diff --git a/lib/eal/include/rte_trace_point.h
> b/lib/eal/include/rte_trace_point.h
> index 0f8700974f..21b6bf7bf6 100644
> --- a/lib/eal/include/rte_trace_point.h
> +++ b/lib/eal/include/rte_trace_point.h
> @@ -144,6 +144,8 @@ _tp _args \
>  #define rte_trace_point_emit_ptr(val)
>  /** Tracepoint function payload for string datatype */  #define
> rte_trace_point_emit_string(val)
> +/** Tracepoint function payload for char array */ #define
> +rte_trace_point_emit_blob(val, len)
> 
>  #endif /* __DOXYGEN__ */
> 
> @@ -374,12 +376,27 @@ do { \
>  	mem = RTE_PTR_ADD(mem,
> __RTE_TRACE_EMIT_STRING_LEN_MAX); \  } while (0)
> 
> +#define rte_trace_point_emit_blob(in, len) \ do { \
> +	if (unlikely(in == NULL)) \
> +		return; \
> +	__rte_trace_point_emit(len, uint16_t); \
Just to confirm that is there any typo meaning "in should be used in place of len here" ?

> +	memcpy(mem, in, len); \
> +	mem = RTE_PTR_ADD(mem, len); \
Also rte_trace_point_emit copies and increment the memory pointer itself. Then what is the purpose of above 2 instructions ?

> +} while (0)
> +
>  #else
> 
>  #define __rte_trace_point_emit_header_generic(t) RTE_SET_USED(t)
> #define __rte_trace_point_emit_header_fp(t) RTE_SET_USED(t)  #define
> __rte_trace_point_emit(in, type) RTE_SET_USED(in)  #define
> rte_trace_point_emit_string(in) RTE_SET_USED(in)
> +#define rte_trace_point_emit_blob(in, len) \ do { \
> +	RTE_SET_USED(in); \
> +	RTE_SET_USED(len); \
> +} while (0)
> +
> 
>  #endif /* ALLOW_EXPERIMENTAL_API */
>  #endif /* _RTE_TRACE_POINT_REGISTER_H_ */ diff --git
> a/lib/eal/include/rte_trace_point_register.h
> b/lib/eal/include/rte_trace_point_register.h
> index a32f4d731b..a54f9769da 100644
> --- a/lib/eal/include/rte_trace_point_register.h
> +++ b/lib/eal/include/rte_trace_point_register.h
> @@ -47,6 +47,13 @@ do { \
>  		RTE_STR(in)"[32]", "string_bounded_t"); \  } while (0)
> 
> +#define rte_trace_point_emit_blob(in, len) \ do { \
> +	RTE_SET_USED(in); \
> +	__rte_trace_point_emit(len, uint16_t); \
> +	__rte_trace_point_emit_field(len, RTE_STR(in)"["#len"]",
> +RTE_STR(uint8_t)); \ } while (0)
> +
>  #ifdef __cplusplus
>  }
>  #endif
> diff --git a/lib/eal/version.map b/lib/eal/version.map index
> 7ad12a7dc9..67be24686a 100644
> --- a/lib/eal/version.map
> +++ b/lib/eal/version.map
> @@ -440,6 +440,9 @@ EXPERIMENTAL {
>  	rte_thread_detach;
>  	rte_thread_equal;
>  	rte_thread_join;
> +
> +	# added in 23.03
> +	__rte_eal_trace_generic_blob;
>  };
> 
>  INTERNAL {
> --
> 2.25.1



More information about the dev mailing list