From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1B3BF43214; Fri, 27 Oct 2023 11:33:33 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E69C44281D; Fri, 27 Oct 2023 11:33:22 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id B91E7402DF for ; Fri, 27 Oct 2023 11:33:15 +0200 (CEST) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4SGy5J0qJvzpWVQ; Fri, 27 Oct 2023 17:28:20 +0800 (CST) Received: from [10.67.121.161] (10.67.121.161) by dggpeml100024.china.huawei.com (7.185.36.115) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 27 Oct 2023 17:33:14 +0800 Subject: Re: [PATCH] mem: explicitly initialise shared locks To: David Marchand , CC: Thomas Monjalon References: <20231027080048.251483-1-david.marchand@redhat.com> From: fengchengwen Message-ID: Date: Fri, 27 Oct 2023 17:33:14 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <20231027080048.251483-1-david.marchand@redhat.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.121.161] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpeml100024.china.huawei.com (7.185.36.115) X-CFilter-Loop: Reflected 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 Acked-by: Chengwen Feng On 2023/10/27 16:00, David Marchand wrote: > 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 > --- > 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 = { >