eal/linux: fix muti-secondary msl create issue
diff mbox series

Message ID 1574214917-7700-1-git-send-email-han.li1@zte.com.cn
State Rejected, archived
Delegated to: David Marchand
Headers show
Series
  • eal/linux: fix muti-secondary msl create issue
Related show

Checks

Context Check Description
ci/Intel-compilation fail Compilation issues
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-compilation success Compile Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/travis-robot warning Travis build: failed
ci/checkpatch success coding style OK

Commit Message

Li Han Nov. 20, 2019, 1:55 a.m. UTC
when we run dpdk in docker, process pid may the same.
add rte_rdtsc() to ensure all the names used in rte_fbarray_init
are different.

Signed-off-by: Li Han <han.li1@zte.com.cn>
---
 lib/librte_eal/linux/eal/eal_memalloc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

David Marchand Nov. 20, 2019, 7:36 a.m. UTC | #1
On Wed, Nov 20, 2019 at 3:48 AM Li Han <han.li1@zte.com.cn> wrote:
>
> when we run dpdk in docker, process pid may the same.
> add rte_rdtsc() to ensure all the names used in rte_fbarray_init
> are different.

There is already a fix being prepared by Yasufumi Ogawa.
https://patchwork.dpdk.org/patch/62972/
Konstantin Ananyev Nov. 20, 2019, 10:45 a.m. UTC | #2
> 
> when we run dpdk in docker, process pid may the same.
> add rte_rdtsc() to ensure all the names used in rte_fbarray_init
> are different.

There is another patch addressing similar issue, but in a slightly
different way:
http://patches.dpdk.org/patch/62972/


> 
> Signed-off-by: Li Han <han.li1@zte.com.cn>
> ---
>  lib/librte_eal/linux/eal/eal_memalloc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/librte_eal/linux/eal/eal_memalloc.c b/lib/librte_eal/linux/eal/eal_memalloc.c
> index af6d0d0..65a7183 100644
> --- a/lib/librte_eal/linux/eal/eal_memalloc.c
> +++ b/lib/librte_eal/linux/eal/eal_memalloc.c
> @@ -1374,8 +1374,8 @@ struct rte_memseg *
>  	local_msl = &local_memsegs[msl_idx];
> 
>  	/* create distinct fbarrays for each secondary */
> -	snprintf(name, RTE_FBARRAY_NAME_LEN, "%s_%i",
> -		primary_msl->memseg_arr.name, getpid());
> +	snprintf(name, RTE_FBARRAY_NAME_LEN, "%s_%i_%"PRIx64,
> +		primary_msl->memseg_arr.name, getpid(), rte_rdtsc());
> 
>  	ret = rte_fbarray_init(&local_msl->memseg_arr, name,
>  		primary_msl->memseg_arr.len,
> --
> 1.8.3.1

Patch
diff mbox series

diff --git a/lib/librte_eal/linux/eal/eal_memalloc.c b/lib/librte_eal/linux/eal/eal_memalloc.c
index af6d0d0..65a7183 100644
--- a/lib/librte_eal/linux/eal/eal_memalloc.c
+++ b/lib/librte_eal/linux/eal/eal_memalloc.c
@@ -1374,8 +1374,8 @@  struct rte_memseg *
 	local_msl = &local_memsegs[msl_idx];
 
 	/* create distinct fbarrays for each secondary */
-	snprintf(name, RTE_FBARRAY_NAME_LEN, "%s_%i",
-		primary_msl->memseg_arr.name, getpid());
+	snprintf(name, RTE_FBARRAY_NAME_LEN, "%s_%i_%"PRIx64,
+		primary_msl->memseg_arr.name, getpid(), rte_rdtsc());
 
 	ret = rte_fbarray_init(&local_msl->memseg_arr, name,
 		primary_msl->memseg_arr.len,