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 CF070A0487 for ; Thu, 4 Jul 2019 12:54:28 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C36931BE09; Thu, 4 Jul 2019 12:54:27 +0200 (CEST) Received: from mail-ua1-f68.google.com (mail-ua1-f68.google.com [209.85.222.68]) by dpdk.org (Postfix) with ESMTP id 4216F1BDED for ; Thu, 4 Jul 2019 12:54:26 +0200 (CEST) Received: by mail-ua1-f68.google.com with SMTP id j8so993986uan.6 for ; Thu, 04 Jul 2019 03:54:26 -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=umx5SqSyH0gh0Z4e6yAqyjcu9tCXj0cSno4+6kXsJso=; b=hr9IkN+jeKrwKVf+roPt5LKEg39DKbL69HpG3b8zeb3nmLuUYMF/Zm0c6Lc+pBuO5p VtQeIQUOV44ONlHwe3GcRGRXNy56j/8bd48Oy8K72mq1YP5YQmQUBN8cfoFAm2ABKIeW cwUUVvnb+gzK+v1xittFSs6mF5TK0h26LcurALbKHAhjySxvBwzjGNR5vyVe87tFNuRj Kg/hTA2EKc0CvPSytrU6V94VRTq/W9ddTwC8qjJfyziEyzHki3MtD1CnffC9LNxyer46 0f3cXqN/ETlCN8U7ejbgQYqcuDWRUW5GionqlyTLhGp35UhE5hcDWiYTlC+UTtBUlzm+ vavw== X-Gm-Message-State: APjAAAUDEicOlISohYiaSzjt1hC2G4YNGprKingR35OANGAQg3HMdxNs sU7dKty1h8/Dw6hteiulcXdkWoODofoKbbkFVK8WxNbTNk4= X-Google-Smtp-Source: APXvYqzxifs1WGIIGpy/POgXLrXJfpvQsxNg/xZDxzRnk4xyQELwMaynq2VAC+XEOX3DmMEFAa1F7Xuxq0cb/p/nV/Q= X-Received: by 2002:ab0:168a:: with SMTP id e10mr20845597uaf.87.1562237665679; Thu, 04 Jul 2019 03:54:25 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: David Marchand Date: Thu, 4 Jul 2019 12:54:14 +0200 Message-ID: To: "Burakov, Anatoly" 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 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 < > anatoly.burakov@intel.com> > >> 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. -- David Marchand