Skip to contentSkip to conversation

eal/linux: fix muti-secondary msl create issue

PATCH In review Li Han 3 participants 3 messages Nov 20, 2019

lore
Share & tools
lore

Li Han

author
#0 lore raw

PATCH 1/1 eal/linux: fix muti-secondary msl create issue

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.

---
 lib/librte_eal/linux/eal/eal_memalloc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/librte_eal/linux/eal/eal_memalloc.c +2 -2
index af6d0d0..65a7183 100644
@@ -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,
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 4 lines · Li Han

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/

Signature · 1 line
David Marchand
#2 lore raw
In reply to Li Han
Quoted 5 lines

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/

Quoted 23 lines
---
 lib/librte_eal/linux/eal/eal_memalloc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/librte_eal/linux/eal/eal_memalloc.c +2 -3
index af6d0d0..65a7183 100644
@@ -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