[EXT] [PATCH v3 5/9] trace: fix dynamically enabling trace points

Harman Kalra hkalra at marvell.com
Thu Oct 13 16:53:04 CEST 2022


> -int
> +static int
>  trace_mkdir(void)
>  {
>  	struct trace *trace = trace_obj_get();
>  	char session[TRACE_DIR_STR_LEN];
> +	static bool already_done;
>  	char *dir_path;
>  	int rc;
> 
> +	if (already_done)
> +		return 0;
> +
Hi David

I was trying out "trace: take live traces via telemetry" patch
I came across following scenario
- Started testpmd with trace=.*
- Executed /trace/save from telemetry script, trace file saved successfully
- Later after stopping application, rte_eal_cleanup() did not save the trace.

With this we lost traces after /trace/save executed

This happened because "already_done" was set after rte_trace_save() called via telemetry.
Later rte_eal_cleanup returned from this point without saving later traces.

What is the purpose of already_done flag?

Thanks
Harman


>  	if (!trace->dir_offset) {
>  		dir_path = calloc(1, sizeof(trace->dir));
>  		if (dir_path == NULL) {
> @@ -365,6 +369,7 @@ trace_mkdir(void)
>  	}
> 
>  	RTE_LOG(INFO, EAL, "Trace dir: %s\n", trace->dir);
> +	already_done = true;


More information about the stable mailing list