[dpdk-dev,v3,1/5] eal: add internal flag indicating init has completed

Message ID 3f4fab71b0d17fb9d0b15e3634f4fe7d12dd3e92.1519740527.git.anatoly.burakov@intel.com (mailing list archive)
State Superseded, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail apply patch file failure

Commit Message

Burakov, Anatoly Feb. 27, 2018, 2:35 p.m. UTC
  Currently, primary process initialization is finalized by setting
the RTE_MAGIC value in the shared config. However, it is not
possible to check whether secondary process initialization has
completed. Add such a value to internal config.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---

Notes:
    This patch is dependent upon earlier IPC fixes patchset [1].
    
    [1] http://dpdk.org/dev/patchwork/bundle/aburakov/IPC_Fixes/
    
    v3: no changes
    
    v2: no changes

 lib/librte_eal/common/eal_common_options.c | 1 +
 lib/librte_eal/common/eal_internal_cfg.h   | 2 ++
 lib/librte_eal/linuxapp/eal/eal.c          | 2 ++
 3 files changed, 5 insertions(+)
  

Comments

Jianfeng Tan Feb. 28, 2018, 2:12 a.m. UTC | #1
Hi Anatoly,

> -----Original Message-----
> From: Burakov, Anatoly
> Sent: Tuesday, February 27, 2018 10:36 PM
> To: dev@dpdk.org
> Cc: Tan, Jianfeng
> Subject: [PATCH v3 1/5] eal: add internal flag indicating init has completed
> 
> Currently, primary process initialization is finalized by setting
> the RTE_MAGIC value in the shared config. However, it is not
> possible to check whether secondary process initialization has
> completed. Add such a value to internal config.

A nit:
"check whether secondary process initialization has completed" sounds like checking comes from another process.
Does it look better, "check whether initialization has completed in secondary process"?

> 
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>

Reviewed-by: Jianfeng Tan <jianfeng.tan@intel.com>

Thanks,
Jianfeng

> ---
> 
> Notes:
>     This patch is dependent upon earlier IPC fixes patchset [1].
> 
>     [1] http://dpdk.org/dev/patchwork/bundle/aburakov/IPC_Fixes/
> 
>     v3: no changes
> 
>     v2: no changes
> 
>  lib/librte_eal/common/eal_common_options.c | 1 +
>  lib/librte_eal/common/eal_internal_cfg.h   | 2 ++
>  lib/librte_eal/linuxapp/eal/eal.c          | 2 ++
>  3 files changed, 5 insertions(+)
> 
> diff --git a/lib/librte_eal/common/eal_common_options.c
> b/lib/librte_eal/common/eal_common_options.c
> index 9f2f8d2..0be80cb 100644
> --- a/lib/librte_eal/common/eal_common_options.c
> +++ b/lib/librte_eal/common/eal_common_options.c
> @@ -194,6 +194,7 @@ eal_reset_internal_config(struct internal_config
> *internal_cfg)
>  	internal_cfg->vmware_tsc_map = 0;
>  	internal_cfg->create_uio_dev = 0;
>  	internal_cfg->user_mbuf_pool_ops_name = NULL;
> +	internal_cfg->init_complete = 0;
>  }
> 
>  static int
> diff --git a/lib/librte_eal/common/eal_internal_cfg.h
> b/lib/librte_eal/common/eal_internal_cfg.h
> index 1169fcc..4e2c2e6 100644
> --- a/lib/librte_eal/common/eal_internal_cfg.h
> +++ b/lib/librte_eal/common/eal_internal_cfg.h
> @@ -56,6 +56,8 @@ struct internal_config {
>  			/**< user defined mbuf pool ops name */
>  	unsigned num_hugepage_sizes;      /**< how many sizes on this
> system */
>  	struct hugepage_info hugepage_info[MAX_HUGEPAGE_SIZES];
> +	unsigned int init_complete;
> +	/**< indicates whether EAL has completed initialization */
>  };
>  extern struct internal_config internal_config; /**< Global EAL configuration.
> */
> 
> diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
> index 38306bf..2ecd07b 100644
> --- a/lib/librte_eal/linuxapp/eal/eal.c
> +++ b/lib/librte_eal/linuxapp/eal/eal.c
> @@ -669,6 +669,8 @@ rte_eal_mcfg_complete(void)
>  	/* ALL shared mem_config related INIT DONE */
>  	if (rte_config.process_type == RTE_PROC_PRIMARY)
>  		rte_config.mem_config->magic = RTE_MAGIC;
> +
> +	internal_config.init_complete = 1;
>  }
> 
>  /*
> --
> 2.7.4
  
Burakov, Anatoly Feb. 28, 2018, 9:43 a.m. UTC | #2
On 28-Feb-18 2:12 AM, Tan, Jianfeng wrote:
> Hi Anatoly,
> 
>> -----Original Message-----
>> From: Burakov, Anatoly
>> Sent: Tuesday, February 27, 2018 10:36 PM
>> To: dev@dpdk.org
>> Cc: Tan, Jianfeng
>> Subject: [PATCH v3 1/5] eal: add internal flag indicating init has completed
>>
>> Currently, primary process initialization is finalized by setting
>> the RTE_MAGIC value in the shared config. However, it is not
>> possible to check whether secondary process initialization has
>> completed. Add such a value to internal config.
> 
> A nit:
> "check whether secondary process initialization has completed" sounds like checking comes from another process.
> Does it look better, "check whether initialization has completed in secondary process"?
> 
>>
>> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> 
> Reviewed-by: Jianfeng Tan <jianfeng.tan@intel.com>
> 
> Thanks,
> Jianfeng

You're probably right, i should reword that. Thanks!
  

Patch

diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index 9f2f8d2..0be80cb 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -194,6 +194,7 @@  eal_reset_internal_config(struct internal_config *internal_cfg)
 	internal_cfg->vmware_tsc_map = 0;
 	internal_cfg->create_uio_dev = 0;
 	internal_cfg->user_mbuf_pool_ops_name = NULL;
+	internal_cfg->init_complete = 0;
 }
 
 static int
diff --git a/lib/librte_eal/common/eal_internal_cfg.h b/lib/librte_eal/common/eal_internal_cfg.h
index 1169fcc..4e2c2e6 100644
--- a/lib/librte_eal/common/eal_internal_cfg.h
+++ b/lib/librte_eal/common/eal_internal_cfg.h
@@ -56,6 +56,8 @@  struct internal_config {
 			/**< user defined mbuf pool ops name */
 	unsigned num_hugepage_sizes;      /**< how many sizes on this system */
 	struct hugepage_info hugepage_info[MAX_HUGEPAGE_SIZES];
+	unsigned int init_complete;
+	/**< indicates whether EAL has completed initialization */
 };
 extern struct internal_config internal_config; /**< Global EAL configuration. */
 
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index 38306bf..2ecd07b 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -669,6 +669,8 @@  rte_eal_mcfg_complete(void)
 	/* ALL shared mem_config related INIT DONE */
 	if (rte_config.process_type == RTE_PROC_PRIMARY)
 		rte_config.mem_config->magic = RTE_MAGIC;
+
+	internal_config.init_complete = 1;
 }
 
 /*