From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Marchand Subject: Re: [PATCH v6] eal: add function to check if primary proc alive Date: Tue, 8 Mar 2016 09:42:34 +0100 Message-ID: References: <1457350669-32582-1-git-send-email-harry.van.haaren@intel.com> <1457352177-12567-1-git-send-email-harry.van.haaren@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Cc: "dev@dpdk.org" To: Harry van Haaren Return-path: Received: from mail-oi0-f44.google.com (mail-oi0-f44.google.com [209.85.218.44]) by dpdk.org (Postfix) with ESMTP id 733BE2C4E for ; Tue, 8 Mar 2016 09:42:54 +0100 (CET) Received: by mail-oi0-f44.google.com with SMTP id m82so5854276oif.1 for ; Tue, 08 Mar 2016 00:42:54 -0800 (PST) In-Reply-To: <1457352177-12567-1-git-send-email-harry.van.haaren@intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hello Harry, On Mon, Mar 7, 2016 at 1:02 PM, Harry van Haaren 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