From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id DC79AA0487 for ; Thu, 4 Jul 2019 09:56:21 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 760B858C4; Thu, 4 Jul 2019 09:56:21 +0200 (CEST) Received: from mail-vk1-f194.google.com (mail-vk1-f194.google.com [209.85.221.194]) by dpdk.org (Postfix) with ESMTP id 353B84CA6 for ; Thu, 4 Jul 2019 09:56:20 +0200 (CEST) Received: by mail-vk1-f194.google.com with SMTP id f68so460262vkf.5 for ; Thu, 04 Jul 2019 00:56:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=niPqdw97MUckRMdZVIs1zs/abtK8uUC//5z6+hwmBNM=; b=DcGRc+rp3e++12+noG84Y1e3rvS1k/5vIpGuS7tytcUAjHw7vXtyUwZVVI37ZbnoSu Cu9W2YkEE7l4ALhE9igDpG/k+eXI0O+FMJBTDHrPbypG1O9OrFwxMOt6wkM0i9cQa/Or JQN1QScK3uUAvR0TdeWJVQ7ahtNQLFS5ICsdnAJQzD6wcgz6VSiXZZbSS+f+IXrD9rUu BqlBEOjMfrStpu8IXrgisDRCOzp6SY5z4iZuJG03TdEvrS8NlkLQ1yYKf48d53QXhSKn zH2e/OId8gRRbLOkIFo2oHfZjFqrLZ7bE78q+YVzbFiUMdTabrNHNGHFkn+Ou8ZSENR6 NHSQ== X-Gm-Message-State: APjAAAV++X/CMWegg7P32RyxSH/rar6At+pd8T05zRk5DF7vdYeV7/Nj EoyqMqDkkeJPQD+x5sJk65Ne1vyaOJtGW0nA9WiXIQ== X-Google-Smtp-Source: APXvYqyGt20bQ47nBHzFbSxj8ti5Q9V6vRlKIK9skTxA4jdHerSFQuCYlPUesnL305SSJgSk+EQ4ed26Y0G2PRtpAcA= X-Received: by 2002:a1f:9ad7:: with SMTP id c206mr7359477vke.31.1562226979555; Thu, 04 Jul 2019 00:56:19 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: David Marchand Date: Thu, 4 Jul 2019 09:56:08 +0200 Message-ID: To: Anatoly Burakov Cc: dev , Bruce Richardson , Thomas Monjalon , Stephen Hemminger Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH v3 13/14] eal: unify internal config initialization X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Thu, Jul 4, 2019 at 9:50 AM David Marchand wrote: > > > On Thu, Jun 27, 2019 at 1:39 PM Anatoly Burakov > wrote: > >> Currently, each EAL will update internal/shared config in their >> own way at init, resulting in needless duplication of code and >> OS-dependent behavior. Move the functions to a common file and >> add missing FreeBSD steps. >> >> Signed-off-by: Anatoly Burakov >> --- >> lib/librte_eal/common/eal_common_mcfg.c | 18 ++++++++++++++++++ >> lib/librte_eal/common/eal_memcfg.h | 8 ++++++++ >> lib/librte_eal/freebsd/eal/eal.c | 2 ++ >> lib/librte_eal/linux/eal/eal.c | 22 ++-------------------- >> 4 files changed, 30 insertions(+), 20 deletions(-) >> >> diff --git a/lib/librte_eal/common/eal_common_mcfg.c >> b/lib/librte_eal/common/eal_common_mcfg.c >> index dc6665d6a..fe8d2b726 100644 >> --- a/lib/librte_eal/common/eal_common_mcfg.c >> +++ b/lib/librte_eal/common/eal_common_mcfg.c >> @@ -31,6 +31,24 @@ eal_mcfg_wait_complete(void) >> rte_pause(); >> } >> >> +void >> +eal_mcfg_update_internal(void) >> +{ >> + struct rte_mem_config *mcfg = >> rte_eal_get_configuration()->mem_config; >> + >> + internal_config.legacy_mem = mcfg->legacy_mem; >> + internal_config.single_file_segments = mcfg->single_file_segments; >> +} >> + >> +void >> +eal_mcfg_update_from_internal(void) >> +{ >> + struct rte_mem_config *mcfg = >> rte_eal_get_configuration()->mem_config; >> + >> + mcfg->legacy_mem = internal_config.legacy_mem; >> + mcfg->single_file_segments = internal_config.single_file_segments; >> +} >> + >> void >> rte_mcfg_mem_read_lock(void) >> { >> diff --git a/lib/librte_eal/common/eal_memcfg.h >> b/lib/librte_eal/common/eal_memcfg.h >> index a2434417e..d02ac1621 100644 >> --- a/lib/librte_eal/common/eal_memcfg.h >> +++ b/lib/librte_eal/common/eal_memcfg.h >> @@ -68,6 +68,14 @@ struct rte_mem_config { >> uint8_t dma_maskbits; >> }; >> >> +/* update internal config from shared mem config */ >> +void >> +eal_mcfg_update_internal(void); >> + >> +/* update shared mem config from internal config */ >> +void >> +eal_mcfg_update_from_internal(void); >> + >> /* wait until primary process initialization is complete */ >> void >> eal_mcfg_wait_complete(void); >> diff --git a/lib/librte_eal/freebsd/eal/eal.c >> b/lib/librte_eal/freebsd/eal/eal.c >> index 13e230fc8..6bfe203fd 100644 >> --- a/lib/librte_eal/freebsd/eal/eal.c >> +++ b/lib/librte_eal/freebsd/eal/eal.c >> @@ -379,6 +379,7 @@ rte_config_init(void) >> case RTE_PROC_PRIMARY: >> if (rte_eal_config_create() < 0) >> return -1; >> + eal_mcfg_update_internal(); >> break; >> case RTE_PROC_SECONDARY: >> if (rte_eal_config_attach() < 0) >> @@ -386,6 +387,7 @@ rte_config_init(void) >> eal_mcfg_wait_complete(); >> if (rte_eal_config_reattach() < 0) >> return -1; >> + eal_mcfg_update_from_internal(); >> break; >> case RTE_PROC_AUTO: >> case RTE_PROC_INVALID: >> > > > Hum, you swapped eal_mcfg_update_internal and > eal_mcfg_update_from_internal. > The names are a bit ambiguous, and I wonder if we really need those > separate helpers. > Replying to myself... at least those helpers try to do something explicitly: synchronising the local copy of the configuration with the shared mem config. Keeping them separate documents this step. Anyway, your choice, but you must fix freebsd :-) -- David Marchand