[dpdk-dev] [PATCH v6] eal: add function to check if primary proc alive

David Marchand david.marchand at 6wind.com
Tue Mar 8 09:42:34 CET 2016


Hello Harry,

On Mon, Mar 7, 2016 at 1:02 PM, Harry van Haaren
<harry.van.haaren at intel.com> wrote:
> This patch adds a new function to the EAL API:
> int rte_eal_primary_proc_alive(const char *path);
>
> The function indicates if a primary process is alive right now.
> This functionality is implemented by testing for a write-
> lock on the config file, and the function tests for a lock.
>
> The use case for this functionality is that a secondary
> process can wait until a primary process starts by polling
> the function and waiting. When the primary is running, the
> secondary continues to poll to detect if the primary process
> has quit unexpectedly, the secondary process can detect this.
>
> The RTE_MAGIC number is written to the shared config by the
> primary process, this is the signal to the secondary process
> that the EAL is set up, and ready to be used. The function
> rte_eal_mcfg_complete() writes RTE_MAGIC. This has been
> delayed in the EAL init proceedure, as the PCI probing in
> the primary process can interfere with the secondary running.

Well, this sounds odd.
There might be an issue, but I can't see it at the moment.
When I look at this new api, I am under the impression that you are
supposed to check for primary liveliness once dpdk init has finished
(from your secondary process point of view), not before and not while
it is initialising.

Why do you need to move this ?


> diff --git a/lib/librte_eal/common/eal_common_proc.c b/lib/librte_eal/common/eal_common_proc.c
> new file mode 100644
> index 0000000..12e0fca
> --- /dev/null
> +++ b/lib/librte_eal/common/eal_common_proc.c

[snip]

> +int
> +rte_eal_primary_proc_alive(const char *config_file_path)
> +{
> +       int config_fd;
> +
> +       if (config_file_path)
> +               config_fd = open(config_file_path, O_RDONLY);
> +       else {
> +               char default_path[PATH_MAX+1];
> +               snprintf(default_path, PATH_MAX, RUNTIME_CONFIG_FMT,
> +                        default_config_dir, "rte");
> +               config_fd = open(default_path, O_RDONLY);

Can't you reuse eal_runtime_config_path() here ?


-- 
David Marchand


More information about the dev mailing list