eal/linux: prevent deadlocks on rte init and cleanup
PATCH 1/1 eal/linux: prevent deadlocks on rte init and cleanup
Resolves a deadlock that can occur when multiple secondary processes are starting and stopping. A deadlock can occur because eal_memalloc_init() is taking a second unnecessary read lock. If another DPDK process that is terminating enters rte_eal_memory_detach() and acquires a write lock wait state before the starting process can acquire it's second read lock then no process will be able to proceed.
--- .mailmap | 2 +- lib/eal/linux/eal_memalloc.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
.mailmap +1 -1
@@ -663,7 +663,7 @@ John OLoughlin <[email protected]> John Ousterhout <[email protected]> John W. Linville <[email protected]> Jonas Pfefferle <[email protected]> <[email protected]> -Jonathan Erb <[email protected]> +Jonathan Erb <[email protected]> Jon DeVree <[email protected]> Jon Loeliger <[email protected]> Joongi Kim <[email protected]>
lib/eal/linux/eal_memalloc.c +2 -2
@@ -1740,7 +1740,7 @@ eal_memalloc_init(void)eal_get_internal_configuration ();if (rte_eal_process_type () ==RTE_PROC_SECONDARY ) -if (rte_memseg_list_walk (secondary_msl_create_walk,NULL ) <0 ) +if (rte_memseg_list_walk_thread_unsafe (secondary_msl_create_walk,NULL ) <0 )return -1 ;if (rte_eal_process_type () ==RTE_PROC_PRIMARY && internal_conf->in_memory) {
@@ -1778,7 +1778,7 @@ eal_memalloc_init(void) }/* initialize all of the fd lists */ -if (rte_memseg_list_walk (fd_list_create_walk,NULL )) +if (rte_memseg_list_walk_thread_unsafe (fd_list_create_walk,NULL ))return -1 ;return 0 ; }
Signature · 1 line
2.34.1
Hello Jonathan,
Quoted 11 lines · Jonathan Erb
Resolves a deadlock that can occur when multiple secondary processes are starting and stopping. A deadlock can occur because
eal_memalloc_init()is taking a second unnecessary read lock. If another DPDK process that is terminating entersrte_eal_memory_detach()and acquires a write lock wait state before the starting process can acquire it's second read lock then no process will be able to proceed.Signed-off-by Jonathan Erb <[email protected]>
Thanks for the report and fix and sorry for the late reply.
Artemy came with a similar report and a more complete fix. Could you confirm it works for you?
https://patchwork.dpdk.org/project/dpdk/list/?series=29463&state=%2A&archive=both
Thanks,
Signature · 1 line
David Marchand
David,
Thanks for the follow-up. The proposed patch below from Artemy will work for me.
Jonathan
Quoted 24 lines · David Marchand
Hello Jonathan,
Quoted 10 lines · Jonathan Erb
Resolves a deadlock that can occur when multiple secondary processes are starting and stopping. A deadlock can occur because
eal_memalloc_init()is taking a second unnecessary read lock. If another DPDK process that is terminating entersrte_eal_memory_detach()and acquires a write lock wait state before the starting process can acquire it's second read lock then no process will be able to proceed.Signed-off-by Jonathan Erb<[email protected]>Thanks for the report and fix and sorry for the late reply.
Artemy came with a similar report and a more complete fix. Could you confirm it works for you?
https://patchwork.dpdk.org/project/dpdk/list/?series=29463&state=%2A&archive=both
Thanks,
Signature · 6 lines
Jonathan Erb Software Engineer *Phone:* 1.855.765.4925 [email protected] <mailto:[email protected]> threatblockr.com <https://threatblockr.com> Threat Blockr Logo <https://threatblockr.com/>