[EXT] [PATCH v2 6/9] trace: fix race in debug dump

Sunil Kumar Kori skori at marvell.com
Wed Oct 12 11:25:32 CEST 2022


> -----Original Message-----
> From: David Marchand <david.marchand at redhat.com>
> Sent: Tuesday, October 4, 2022 3:14 PM
> To: dev at dpdk.org
> Cc: skori at mavell.com; Jerin Jacob Kollanukkaran <jerinj at marvell.com>;
> stable at dpdk.org; Sunil Kumar Kori <skori at marvell.com>
> Subject: [EXT] [PATCH v2 6/9] trace: fix race in debug dump
> 
> External Email
> 
> ----------------------------------------------------------------------
> trace->nb_trace_mem_list access must be under trace->lock to avoid
> races with threads allocating/freeing their trace buffers.
> 
> Fixes: f6b2d65dcd5d ("trace: implement debug dump")
> Cc: stable at dpdk.org
> 
> Signed-off-by: David Marchand <david.marchand at redhat.com>
> ---
>  lib/eal/common/eal_common_trace.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 

Acked-by: Sunil Kumar Kori <skori at marvell.com>

> diff --git a/lib/eal/common/eal_common_trace.c
> b/lib/eal/common/eal_common_trace.c
> index 6aa11a3b50..ec168e37b3 100644
> --- a/lib/eal/common/eal_common_trace.c
> +++ b/lib/eal/common/eal_common_trace.c
> @@ -259,10 +259,9 @@ trace_lcore_mem_dump(FILE *f)
>  	struct __rte_trace_header *header;
>  	uint32_t count;
> 
> -	if (trace->nb_trace_mem_list == 0)
> -		return;
> -
>  	rte_spinlock_lock(&trace->lock);
> +	if (trace->nb_trace_mem_list == 0)
> +		goto out;
>  	fprintf(f, "nb_trace_mem_list = %d\n", trace->nb_trace_mem_list);
>  	fprintf(f, "\nTrace mem info\n--------------\n");
>  	for (count = 0; count < trace->nb_trace_mem_list; count++) { @@ -
> 273,6 +272,7 @@ trace_lcore_mem_dump(FILE *f)
>  		header->stream_header.lcore_id,
>  		header->stream_header.thread_name);
>  	}
> +out:
>  	rte_spinlock_unlock(&trace->lock);
>  }
> 
> --
> 2.37.3



More information about the stable mailing list