DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: Thomas Monjalon <thomas@monjalon.net>
Subject: [PATCH] mem: explicitly initialise shared locks
Date: Fri, 27 Oct 2023 10:00:48 +0200	[thread overview]
Message-ID: <20231027080048.251483-1-david.marchand@redhat.com> (raw)

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 <thomas@monjalon.net>
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 lib/eal/common/eal_common_config.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lib/eal/common/eal_common_config.c b/lib/eal/common/eal_common_config.c
index 0daf0f3188..2d6c04a49a 100644
--- a/lib/eal/common/eal_common_config.c
+++ b/lib/eal/common/eal_common_config.c
@@ -8,7 +8,14 @@
 #include "eal_memcfg.h"
 
 /* early configuration structure, when memory config is not mmapped */
-static struct rte_mem_config early_mem_config;
+static struct rte_mem_config early_mem_config = {
+	.mlock = RTE_RWLOCK_INITIALIZER,
+	.qlock = RTE_RWLOCK_INITIALIZER,
+	.mplock = RTE_RWLOCK_INITIALIZER,
+	.tlock = RTE_SPINLOCK_INITIALIZER,
+	.ethdev_lock = RTE_SPINLOCK_INITIALIZER,
+	.memory_hotplug_lock = RTE_RWLOCK_INITIALIZER,
+};
 
 /* Address of global and public configuration */
 static struct rte_config rte_config = {
-- 
2.41.0


             reply	other threads:[~2023-10-27  8:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-27  8:00 David Marchand [this message]
2023-10-27  9:33 ` fengchengwen
2024-02-01 15:36 ` David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231027080048.251483-1-david.marchand@redhat.com \
    --to=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).