From: David Marchand <david.marchand@redhat.com>
To: Anatoly Burakov <anatoly.burakov@intel.com>
Cc: dev <dev@dpdk.org>, Bruce Richardson <bruce.richardson@intel.com>,
Thomas Monjalon <thomas@monjalon.net>,
Stephen Hemminger <stephen@networkplumber.org>
Subject: Re: [dpdk-dev] [PATCH v3 13/14] eal: unify internal config initialization
Date: Thu, 4 Jul 2019 09:50:43 +0200 [thread overview]
Message-ID: <CAJFAV8wdXhfzRAHCdTGKm9DyY9y4WhNYoK=vvxzSNk1vSmuujA@mail.gmail.com> (raw)
In-Reply-To: <b49510c5323cceaea7405292637f8bd3d24e8ad7.1561635481.git.anatoly.burakov@intel.com>
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 <anatoly.burakov@intel.com>
> ---
> 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.
rte_eal_config_create and rte_eal_config_attach are already awfully close
in linux and freebsd implementation.
Can't we have them as common code and put those helpers bits direct in them
?
> diff --git a/lib/librte_eal/linux/eal/eal.c
> b/lib/librte_eal/linux/eal/eal.c
> index 4fd18b15f..fa205fd29 100644
> --- a/lib/librte_eal/linux/eal/eal.c
> +++ b/lib/librte_eal/linux/eal/eal.c
> @@ -472,24 +472,6 @@ eal_proc_type_detect(void)
> return ptype;
> }
>
> -/* copies data from internal config to shared config */
> -static void
> -eal_update_mem_config(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;
> -}
> -
> -/* copies data from shared config to internal config */
> -static void
> -eal_update_internal_config(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;
> -}
> -
> /* Sets up rte_config structure with the pointer to shared memory
> config.*/
> static int
> rte_config_init(void)
> @@ -500,7 +482,7 @@ rte_config_init(void)
> case RTE_PROC_PRIMARY:
> if (rte_eal_config_create() < 0)
> return -1;
> - eal_update_mem_config();
> + eal_mcfg_update_from_internal();
> break;
> case RTE_PROC_SECONDARY:
> if (rte_eal_config_attach() < 0)
> @@ -508,7 +490,7 @@ rte_config_init(void)
> eal_mcfg_wait_complete();
> if (rte_eal_config_reattach() < 0)
> return -1;
> - eal_update_internal_config();
> + eal_mcfg_update_internal();
> break;
> case RTE_PROC_AUTO:
> case RTE_PROC_INVALID:
> --
> 2.17.1
>
--
David Marchand
next prev parent reply other threads:[~2019-07-04 7:50 UTC|newest]
Thread overview: 117+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-29 16:30 [dpdk-dev] [PATCH 00/25] Make shared memory config non-public Anatoly Burakov
2019-05-29 16:30 ` [dpdk-dev] [PATCH 01/25] eal: add API to lock/unlock memory hotplug Anatoly Burakov
2019-05-29 16:41 ` Stephen Hemminger
2019-05-29 16:30 ` [dpdk-dev] [PATCH 02/25] bus/fslmc: use new memory locking API Anatoly Burakov
2019-06-03 6:41 ` Shreyansh Jain
2019-05-29 16:30 ` [dpdk-dev] [PATCH 03/25] net/mlx4: " Anatoly Burakov
2019-05-29 16:30 ` [dpdk-dev] [PATCH 04/25] net/mlx5: " Anatoly Burakov
2019-05-29 16:30 ` [dpdk-dev] [PATCH 05/25] net/virtio: " Anatoly Burakov
2019-05-30 6:39 ` Tiwei Bie
2019-05-29 16:30 ` [dpdk-dev] [PATCH 06/25] mem: " Anatoly Burakov
2019-05-29 16:30 ` [dpdk-dev] [PATCH 07/25] malloc: " Anatoly Burakov
2019-05-29 16:30 ` [dpdk-dev] [PATCH 08/25] vfio: " Anatoly Burakov
2019-05-29 16:30 ` [dpdk-dev] [PATCH 09/25] eal: add EAL tailq list lock/unlock API Anatoly Burakov
2019-05-29 16:30 ` [dpdk-dev] [PATCH 10/25] acl: use new tailq locking API Anatoly Burakov
2019-05-29 16:30 ` [dpdk-dev] [PATCH 11/25] distributor: " Anatoly Burakov
2019-05-29 16:30 ` [dpdk-dev] [PATCH 12/25] efd: " Anatoly Burakov
2019-05-29 16:30 ` [dpdk-dev] [PATCH 13/25] eventdev: " Anatoly Burakov
2019-05-29 16:31 ` [dpdk-dev] [PATCH 14/25] hash: " Anatoly Burakov
2019-05-29 16:31 ` [dpdk-dev] [PATCH 15/25] lpm: " Anatoly Burakov
2019-05-29 16:31 ` [dpdk-dev] [PATCH 16/25] member: " Anatoly Burakov
2019-05-29 16:31 ` [dpdk-dev] [PATCH 17/25] mempool: " Anatoly Burakov
2019-05-29 16:47 ` Andrew Rybchenko
2019-05-29 16:31 ` [dpdk-dev] [PATCH 18/25] reorder: " Anatoly Burakov
2019-05-29 16:31 ` [dpdk-dev] [PATCH 19/25] ring: " Anatoly Burakov
2019-05-29 16:31 ` [dpdk-dev] [PATCH 20/25] stack: " Anatoly Burakov
2019-05-29 18:20 ` Eads, Gage
2019-05-29 16:31 ` [dpdk-dev] [PATCH 21/25] eal: add new API to lock/unlock mempool list Anatoly Burakov
2019-05-29 16:31 ` [dpdk-dev] [PATCH 22/25] mempool: use new mempool list locking API Anatoly Burakov
2019-05-29 16:50 ` Andrew Rybchenko
2019-05-29 16:31 ` [dpdk-dev] [PATCH 23/25] eal: remove unused macros Anatoly Burakov
2019-05-29 16:31 ` [dpdk-dev] [PATCH 24/25] net/ena: fix direct access to shared memory config Anatoly Burakov
2019-06-03 7:33 ` Michał Krawczyk
2019-06-03 13:36 ` Michał Krawczyk
2019-06-04 10:28 ` Burakov, Anatoly
2019-06-04 10:45 ` Michał Krawczyk
2019-06-04 12:38 ` Burakov, Anatoly
2019-05-29 16:31 ` [dpdk-dev] [PATCH 25/25] eal: hide " Anatoly Burakov
2019-05-29 16:40 ` Stephen Hemminger
2019-05-30 8:02 ` Burakov, Anatoly
2019-05-29 20:14 ` David Marchand
2019-05-29 20:11 ` [dpdk-dev] [PATCH 00/25] Make shared memory config non-public David Marchand
2019-05-30 8:07 ` Burakov, Anatoly
2019-05-30 10:15 ` Bruce Richardson
2019-06-03 9:42 ` Thomas Monjalon
2019-06-25 16:05 ` [dpdk-dev] [PATCH v2 00/14] " Anatoly Burakov
2019-06-27 11:38 ` [dpdk-dev] [PATCH v3 " Anatoly Burakov
2019-06-27 15:36 ` Stephen Hemminger
2019-07-03 9:38 ` David Marchand
2019-07-03 10:47 ` Burakov, Anatoly
2019-07-04 8:09 ` David Marchand
2019-07-04 19:52 ` Thomas Monjalon
2019-07-05 13:10 ` [dpdk-dev] [PATCH v4 0/8] " Anatoly Burakov
2019-07-05 17:26 ` [dpdk-dev] [PATCH v5 0/9] " Anatoly Burakov
2019-07-05 19:30 ` David Marchand
2019-07-05 21:09 ` Thomas Monjalon
2019-07-31 10:07 ` David Marchand
2019-07-31 10:32 ` Burakov, Anatoly
2019-07-31 10:48 ` David Marchand
2019-07-05 17:26 ` [dpdk-dev] [PATCH v5 1/9] eal: add API to lock/unlock memory hotplug Anatoly Burakov
2019-07-05 17:26 ` [dpdk-dev] [PATCH v5 2/9] eal: add EAL tailq list lock/unlock API Anatoly Burakov
2019-07-05 17:26 ` [dpdk-dev] [PATCH v5 3/9] eal: add new API to lock/unlock mempool list Anatoly Burakov
2019-07-05 17:26 ` [dpdk-dev] [PATCH v5 4/9] eal: hide shared memory config Anatoly Burakov
2019-07-05 19:08 ` Thomas Monjalon
2019-07-08 9:22 ` Burakov, Anatoly
2019-07-08 9:38 ` Thomas Monjalon
2019-07-05 17:26 ` [dpdk-dev] [PATCH v5 5/9] eal: remove packed attribute from mcfg structure Anatoly Burakov
2019-07-05 17:26 ` [dpdk-dev] [PATCH v5 6/9] eal: uninline wait for mcfg complete function Anatoly Burakov
2019-07-05 17:26 ` [dpdk-dev] [PATCH v5 7/9] eal: unify and move " Anatoly Burakov
2019-07-05 17:26 ` [dpdk-dev] [PATCH v5 8/9] eal: unify internal config initialization Anatoly Burakov
2019-07-05 17:26 ` [dpdk-dev] [PATCH v5 9/9] eal: prevent different primary/secondary process versions Anatoly Burakov
2019-07-05 13:10 ` [dpdk-dev] [PATCH v4 1/8] eal: add API to lock/unlock memory hotplug Anatoly Burakov
2019-07-05 13:10 ` [dpdk-dev] [PATCH v4 2/8] eal: add EAL tailq list lock/unlock API Anatoly Burakov
2019-07-05 13:10 ` [dpdk-dev] [PATCH v4 3/8] eal: add new API to lock/unlock mempool list Anatoly Burakov
2019-07-05 13:10 ` [dpdk-dev] [PATCH v4 4/8] eal: hide shared memory config Anatoly Burakov
2019-07-05 13:10 ` [dpdk-dev] [PATCH v4 5/8] eal: remove packed attribute from mcfg structure Anatoly Burakov
2019-07-05 13:10 ` [dpdk-dev] [PATCH v4 6/8] eal: uninline wait for mcfg complete function Anatoly Burakov
2019-07-05 13:10 ` [dpdk-dev] [PATCH v4 7/8] eal: unify and move " Anatoly Burakov
2019-07-05 13:10 ` [dpdk-dev] [PATCH v4 8/8] eal: unify internal config initialization Anatoly Burakov
2019-06-27 11:38 ` [dpdk-dev] [PATCH v3 01/14] eal: add API to lock/unlock memory hotplug Anatoly Burakov
2019-06-27 11:38 ` [dpdk-dev] [PATCH v3 02/14] drivers: use new memory locking API Anatoly Burakov
2019-06-27 11:38 ` [dpdk-dev] [PATCH v3 03/14] lib: " Anatoly Burakov
2019-06-27 11:38 ` [dpdk-dev] [PATCH v3 04/14] eal: add EAL tailq list lock/unlock API Anatoly Burakov
2019-06-27 11:39 ` [dpdk-dev] [PATCH v3 05/14] lib: use new tailq locking API Anatoly Burakov
2019-06-27 11:39 ` [dpdk-dev] [PATCH v3 06/14] eal: add new API to lock/unlock mempool list Anatoly Burakov
2019-06-27 11:39 ` [dpdk-dev] [PATCH v3 07/14] mempool: use new mempool list locking API Anatoly Burakov
2019-06-27 11:39 ` [dpdk-dev] [PATCH v3 08/14] eal: remove unused macros Anatoly Burakov
2019-06-27 11:39 ` [dpdk-dev] [PATCH v3 09/14] eal: hide shared memory config Anatoly Burakov
2019-07-04 7:43 ` David Marchand
2019-07-04 10:47 ` Burakov, Anatoly
2019-07-04 10:52 ` David Marchand
2019-07-04 19:51 ` Thomas Monjalon
2019-06-27 11:39 ` [dpdk-dev] [PATCH v3 10/14] eal: remove packed attribute from mcfg structure Anatoly Burakov
2019-06-27 11:39 ` [dpdk-dev] [PATCH v3 11/14] eal: uninline wait for mcfg complete function Anatoly Burakov
2019-06-27 11:39 ` [dpdk-dev] [PATCH v3 12/14] eal: unify and move " Anatoly Burakov
2019-06-27 11:39 ` [dpdk-dev] [PATCH v3 13/14] eal: unify internal config initialization Anatoly Burakov
2019-07-04 7:50 ` David Marchand [this message]
2019-07-04 7:56 ` David Marchand
2019-07-04 10:50 ` Burakov, Anatoly
2019-07-04 10:54 ` David Marchand
2019-07-04 11:26 ` Burakov, Anatoly
2019-06-27 11:39 ` [dpdk-dev] [PATCH v3 14/14] eal: prevent different primary/secondary process versions Anatoly Burakov
2019-06-25 16:05 ` [dpdk-dev] [PATCH v2 01/14] eal: add API to lock/unlock memory hotplug Anatoly Burakov
2019-06-25 16:05 ` [dpdk-dev] [PATCH v2 02/14] drivers: use new memory locking API Anatoly Burakov
2019-06-27 9:24 ` Hemant Agrawal
2019-06-28 15:21 ` Yongseok Koh
2019-06-25 16:05 ` [dpdk-dev] [PATCH v2 03/14] lib: " Anatoly Burakov
2019-06-25 16:05 ` [dpdk-dev] [PATCH v2 04/14] eal: add EAL tailq list lock/unlock API Anatoly Burakov
2019-06-25 16:05 ` [dpdk-dev] [PATCH v2 05/14] lib: use new tailq locking API Anatoly Burakov
2019-06-25 16:05 ` [dpdk-dev] [PATCH v2 06/14] eal: add new API to lock/unlock mempool list Anatoly Burakov
2019-06-25 16:05 ` [dpdk-dev] [PATCH v2 07/14] mempool: use new mempool list locking API Anatoly Burakov
2019-06-25 16:05 ` [dpdk-dev] [PATCH v2 08/14] eal: remove unused macros Anatoly Burakov
2019-06-25 16:05 ` [dpdk-dev] [PATCH v2 09/14] eal: hide shared memory config Anatoly Burakov
2019-06-25 16:05 ` [dpdk-dev] [PATCH v2 10/14] eal: remove packed attribute from mcfg structure Anatoly Burakov
2019-06-25 16:05 ` [dpdk-dev] [PATCH v2 11/14] eal: uninline wait for mcfg complete function Anatoly Burakov
2019-06-25 16:05 ` [dpdk-dev] [PATCH v2 12/14] eal: unify and move " Anatoly Burakov
2019-06-25 16:05 ` [dpdk-dev] [PATCH v2 13/14] eal: unify internal config initialization Anatoly Burakov
2019-06-25 16:05 ` [dpdk-dev] [PATCH v2 14/14] eal: prevent different primary/secondary process versions Anatoly Burakov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAJFAV8wdXhfzRAHCdTGKm9DyY9y4WhNYoK=vvxzSNk1vSmuujA@mail.gmail.com' \
--to=david.marchand@redhat.com \
--cc=anatoly.burakov@intel.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=stephen@networkplumber.org \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).