From patchwork Fri Oct 27 08:00:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 133480 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 58E0543214; Fri, 27 Oct 2023 10:01:08 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4596E40698; Fri, 27 Oct 2023 10:01:08 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 5D3F340649 for ; Fri, 27 Oct 2023 10:01:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698393666; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=W9kYVbppSGJVo3qwc4ln3LQ1uT56fntqrv4lhV8k1Pc=; b=Iiu5z44ZrNCOiq5Apj46V7UxQFLsFEN3pLPHbrLO1S1W9IMiMkKXpFo9ONaxJvOw8bnmUM MvXna2MHT+LNnU+oVr87+o3lnbxlUw5eUYQnYit+cNN4575bX+h3puKlMlwC4ywsCUCa3U Z6DMBv35WtxincwO6JY33Tim9H3/1Ls= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-356-ov_wsPcANHm5xxNy686liA-1; Fri, 27 Oct 2023 04:01:02 -0400 X-MC-Unique: ov_wsPcANHm5xxNy686liA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6050629AB3F1; Fri, 27 Oct 2023 08:01:02 +0000 (UTC) Received: from dmarchan.redhat.com (unknown [10.45.225.98]) by smtp.corp.redhat.com (Postfix) with ESMTP id ADD7C2166B28; Fri, 27 Oct 2023 08:01:01 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: Thomas Monjalon Subject: [PATCH] mem: explicitly initialise shared locks Date: Fri, 27 Oct 2023 10:00:48 +0200 Message-ID: <20231027080048.251483-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 Signed-off-by: David Marchand Acked-by: Chengwen Feng --- 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 = {