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 0393BA0487 for ; Thu, 4 Jul 2019 13:26:27 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id ACCF71BE00; Thu, 4 Jul 2019 13:26:26 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 674DD1BDFD for ; Thu, 4 Jul 2019 13:26:24 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Jul 2019 04:26:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,450,1557212400"; d="scan'208";a="172408601" Received: from aburakov-mobl1.ger.corp.intel.com (HELO [10.237.220.126]) ([10.237.220.126]) by FMSMGA003.fm.intel.com with ESMTP; 04 Jul 2019 04:26:19 -0700 To: David Marchand Cc: dev , Bruce Richardson , Thomas Monjalon , Stephen Hemminger References: From: "Burakov, Anatoly" Message-ID: Date: Thu, 4 Jul 2019 12:26:20 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit 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 04-Jul-19 11:54 AM, David Marchand wrote: > > > On Thu, Jul 4, 2019 at 12:50 PM Burakov, Anatoly > > wrote: > > On 04-Jul-19 8:56 AM, David Marchand wrote: > > 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 :-) > > > > Sorry, i don't follow - what needs to be fixed in FreeBSD? > > > eal_mcfg_update_from_internal() must be called in primary process. > eal_mcfg_update_internal() must be called in secondary processes. > Oh, right, good catch, thanks! > > -- > David Marchand -- Thanks, Anatoly