Skip to content

Commit a4ce111

Browse files
mem: initialise shared locks explicitly
Locks in the DPDK shared memory were not initialised so far. This is not really a problem as the early_mem_config structure is stored in the bss section (and so set to 0 by default). Yet, for consistency, explicitly initialise those locks with relevant initialiser macros. Suggested-by: Thomas Monjalon <[email protected]> Signed-off-by: David Marchand <[email protected]> Acked-by: Chengwen Feng <[email protected]>
1 parent e14bb5f commit a4ce111

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/eal/common/eal_common_config.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,14 @@
88
#include "eal_memcfg.h"
99

1010
/* early configuration structure, when memory config is not mmapped */
11-
static struct rte_mem_config early_mem_config;
11+
static struct rte_mem_config early_mem_config = {
12+
.mlock = RTE_RWLOCK_INITIALIZER,
13+
.qlock = RTE_RWLOCK_INITIALIZER,
14+
.mplock = RTE_RWLOCK_INITIALIZER,
15+
.tlock = RTE_SPINLOCK_INITIALIZER,
16+
.ethdev_lock = RTE_SPINLOCK_INITIALIZER,
17+
.memory_hotplug_lock = RTE_RWLOCK_INITIALIZER,
18+
};
1219

1320
/* Address of global and public configuration */
1421
static struct rte_config rte_config = {

0 commit comments

Comments
 (0)