From mboxrd@z Thu Jan 1 00:00:00 1970 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=xSwGVmdgoenryB9oMoQfVPYNL9Lx3ZS/J7qPuf5+2RY=; b=13A4pVnf2vTodMHbMpDE6ngGJNoD33EeXcKWAupgDZLXr/eCJncoYpTSZdR53iJezT 8deK7EMJMZs4IV0BsPH60h60ATbgslTGzi9hSjD+3SLcS+DTJuequOapHprs6yGJ8PLE I2W7Ya6fXY2O8bawUb7lio0u2CAi1RvlnCurz8+hLs+kVbyAtd+c8b2yDN+iTVXbQ8Jz HwfBVQ9pCMqBR82TlsN4Oz29gKMpEmTZqA8040ralMMSFIazXqjDqzarzimj4wekgYcb gTpPqhrbRlm3RXN8TRjz0dSvKXXRv5qqlnHpfh+wiFlkrTkFlwVFysEUC7sVdMaiMBu5 Vdfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=xSwGVmdgoenryB9oMoQfVPYNL9Lx3ZS/J7qPuf5+2RY=; b=ZvHtpWLaL9kwSwO+ucJ2P5SNgTrgin/Rxexp7QHsN/EIuLQaJ9ZrvSr8Gl45mL/QTK 2pDMUylsHhSRhKDm7T0+YRge/Iyc4LpKTJbubjK6i8EM/XkmkULKC8N6r/UMGig12GJ5 l4h24D7yUbdjh8ttBcC9zgkODrVIm6rS9yi8+rNA2aTbZLncQ6NVPBD7Hea6DzYQ3qBG WdFk7reBx7xeLlfgkqbkOhHJJqtc8PIDOlknB+CVS6roBvXlFOXjtihmUJO52QeYzeIa +z53pPl1yFej3Usrh8ftj/NNOPYFnJX3SO7qZoXJqIKxLfiJnjUQx8qPrTiYoLVqQoBr hBsw== X-Gm-Message-State: AD7BkJKcRLaMcENNnxywu17xhtx2/2tSBgBNycICUvtp+9+IhzgoTckYYpAjuH0fcr6x21OQGfnp5x8iJSY4q3cW X-Received: by 10.202.48.130 with SMTP id w124mr16448517oiw.61.1457426573938; Tue, 08 Mar 2016 00:42:53 -0800 (PST) MIME-Version: 1.0 Received: by 10.76.180.72 with HTTP; Tue, 8 Mar 2016 00:42:34 -0800 (PST) In-Reply-To: <1457352177-12567-1-git-send-email-harry.van.haaren@intel.com> References: <1457350669-32582-1-git-send-email-harry.van.haaren@intel.com> <1457352177-12567-1-git-send-email-harry.van.haaren@intel.com> From: David Marchand Date: Tue, 8 Mar 2016 09:42:34 +0100 Message-ID: To: Harry van Haaren Content-Type: text/plain; charset=UTF-8 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH v6] eal: add function to check if primary proc alive X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Mar 2016 08:42:54 -0000 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