From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id B06101BB40 for ; Fri, 11 Jan 2019 22:52:54 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Jan 2019 13:52:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,466,1539673200"; d="scan'208";a="109224278" Received: from fyigit-mobl.ger.corp.intel.com (HELO [10.237.221.22]) ([10.237.221.22]) by orsmga008.jf.intel.com with ESMTP; 11 Jan 2019 13:52:52 -0800 To: John Ousterhout References: <20161012212917.10760-1-ouster@cs.stanford.edu> <2601191342CEEE43887BDE71AB9772583F0C1256@irsmsx105.ger.corp.intel.com> <1A27633A6DA49C4A92FCD5D4312DBF536B37DF3E@IRSMSX106.ger.corp.intel.com> Cc: dpdk-dev , Thomas Monjalon , Konstantin Ananyev , Harry Van Haaren , Stephen Hemminger , "Tahhan, Maryam" From: Ferruh Yigit Openpgp: preference=signencrypt Autocrypt: addr=ferruh.yigit@intel.com; prefer-encrypt=mutual; keydata= mQINBFXZCFABEADCujshBOAaqPZpwShdkzkyGpJ15lmxiSr3jVMqOtQS/sB3FYLT0/d3+bvy qbL9YnlbPyRvZfnP3pXiKwkRoR1RJwEo2BOf6hxdzTmLRtGtwWzI9MwrUPj6n/ldiD58VAGQ +iR1I/z9UBUN/ZMksElA2D7Jgg7vZ78iKwNnd+vLBD6I61kVrZ45Vjo3r+pPOByUBXOUlxp9 GWEKKIrJ4eogqkVNSixN16VYK7xR+5OUkBYUO+sE6etSxCr7BahMPKxH+XPlZZjKrxciaWQb +dElz3Ab4Opl+ZT/bK2huX+W+NJBEBVzjTkhjSTjcyRdxvS1gwWRuXqAml/sh+KQjPV1PPHF YK5LcqLkle+OKTC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q6/6 LY+nQQ3OdHlBkflzYMPcWgDcvcTAO6yasLEUf7UcYoSWTyMYjLB4QuNlXzTswzGVMssJF/vo V8lD1eqqaSUWG3STF6GVLQOr1NLvN5+kUBiEStHFxBpgSCvYY9sNV8FS6N24CAWMBl+10W+D 2h1yiiP5dOdPcBDYKsgqDD91/sP0WdyMJkwdQJtD49f9f+lYloxHnSAxMleOpyscg1pldw+i mPaUY1bmIknLhhkqfMmjywQOXpac5LRMibAAYkcB8v7y3kwELnt8mhqqZy6LUsqcWygNbH/W K3GGt5tRpeIXeJ25x8gg5EBQ0Jnvp/IbBYQfPLtXH0Myq2QuAhk/1q2yEIbVjS+7iowEZNyE 56K63WBJxsJPB2mvmLgn98GqB4G6GufP1ndS0XDti/2K0o8rep9xoY/JDGi0n0L0tk9BHyoP Y7kaEpu7UyY3nVdRLe5H1/MnFG8hdJ97WqnPS0buYZlrbTV0nRFL/NI2VABl18vEEXvNQiO+ vM8= Message-ID: <573ae9ca-5ee4-5858-a6f3-d9407f0e9f3b@intel.com> Date: Fri, 11 Jan 2019 21:52:51 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] eal: avoid unnecessary conflicts over rte_config file X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Jan 2019 21:52:55 -0000 On 10/14/2016 5:27 PM, ouster at cs.stanford.edu (John Ousterhout) wrote: > It sounds like my patch would break some existing software, so it probably > doesn't make sense right now. > > I'd still argue that the current mechanism has a number of problems, and it > should probably undergo a comprehensive overhaul at some point in the > future. Hi John, It seems there weren't any conclusion on the patch and it is sitting on patchwork more than two years, I am updating it as rejected, if it is still relevant please let us know. Sorry for any inconvenience caused. For record, patch: https://patches.dpdk.org/patch/16527/ Regards, ferruh > > -John- > > On Thu, Oct 13, 2016 at 2:39 PM, Tahhan, Maryam > wrote: > >>> Hi John, >>> >>>> Before this patch, DPDK used the file ~/.rte_config as a lock to >>>> detect potential interference between multiple DPDK applications >>>> running on the same machine. However, if a single user ran DPDK >>>> applications concurrently on several different machines, and if the >>>> user's home directory was shared between the machines via NFS, DPDK >>>> would incorrectly detect conflicts for all but the first application >>>> and abort them. This patch fixes the problem by incorporating the >>>> machine name into the config file name (e.g., ~/.rte_hostname_config). >>>> >>>> Signed-off-by: John Ousterhout >>>> --- >>>> doc/guides/prog_guide/multi_proc_support.rst | 11 +++++++---- >>>> lib/librte_eal/common/eal_common_proc.c | 8 ++------ >>>> lib/librte_eal/common/eal_filesystem.h | 15 +++++++++++++-- >>>> 3 files changed, 22 insertions(+), 12 deletions(-) >>>> >>>> diff --git a/doc/guides/prog_guide/multi_proc_support.rst >>>> b/doc/guides/prog_guide/multi_proc_support.rst >>>> index badd102..a54fa1c 100644 >>>> --- a/doc/guides/prog_guide/multi_proc_support.rst >>>> +++ b/doc/guides/prog_guide/multi_proc_support.rst >>>> @@ -129,10 +129,13 @@ Support for this usage scenario is provided >>>> using the ``--file-prefix`` paramete >>>> >>>> By default, the EAL creates hugepage files on each hugetlbfs >>>> filesystem using the rtemap_X filename, where X is in the range 0 to >> the >>> maximum number of hugepages -1. >>>> -Similarly, it creates shared configuration files, memory mapped in >>>> each process, using the /var/run/.rte_config filename, -when run as >>>> root (or $HOME/.rte_config when run as a non-root user; -if filesystem >> and >>> device permissions are set up to allow this). >>>> -The rte part of the filenames of each of the above is configurable >> using the >>> file-prefix parameter. >>>> +Similarly, it creates shared configuration files, memory mapped in >> each >>> process. >>>> +When run as root, the name of the configuration file will be >>>> +/var/run/.rte_*host*_config, where *host* is the name of the machine. >>>> +When run as a non-root user, the the name of the configuration file >>>> +will be $HOME/.rte_*host*_config (if filesystem and device permissions >>> are set up to allow this). >>>> +If the ``--file-prefix`` parameter has been specified, its value will >>>> +be used in place of "rte" in the file names. >>> >>> I am not sure that we need to handle all such cases inside EAL. >>> User can easily overcome that problem by just adding something like: >>> --file-prefix=`uname -n` >>> to his command-line. >>> Konstantin >>> >> >> I agree with Konstantin, there's no need to include the hostname in the >> rte config file + I'm not sure this will be backward compatible with >> existing DPDK applications that use a secondary processes that use the >> config file (as in, multiprocess DPDK applications in use would all need to >> be updated). What Konstantin suggests fixes the issue you were encountering >> without breaking backward compatibility. >> Is addition, the hostname is not unique... you could in theory have 2 >> hosts with the same hostname and encounter the issue you were seeing again. >> >>>> >>>> In addition to specifying the file-prefix parameter, any DPDK >>>> applications that are to be run side-by-side must explicitly limit >> their >>> memory use. >>>> diff --git a/lib/librte_eal/common/eal_common_proc.c >>>> b/lib/librte_eal/common/eal_common_proc.c >>>> index 12e0fca..517aa0c 100644 >>>> --- a/lib/librte_eal/common/eal_common_proc.c >>>> +++ b/lib/librte_eal/common/eal_common_proc.c >>>> @@ -45,12 +45,8 @@ rte_eal_primary_proc_alive(const char >>>> *config_file_path) >>>> >>>> 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); >>>> - } >>>> + else >>>> + config_fd = open(eal_runtime_config_path(), O_RDONLY); >>>> if (config_fd < 0) >>>> return 0; >>>> >>>> diff --git a/lib/librte_eal/common/eal_filesystem.h >>>> b/lib/librte_eal/common/eal_filesystem.h >>>> index fdb4a70..4929aa3 100644 >>>> --- a/lib/librte_eal/common/eal_filesystem.h >>>> +++ b/lib/librte_eal/common/eal_filesystem.h >>>> @@ -41,7 +41,7 @@ >>>> #define EAL_FILESYSTEM_H >>>> >>>> /** Path of rte config file. */ >>>> -#define RUNTIME_CONFIG_FMT "%s/.%s_config" >>>> +#define RUNTIME_CONFIG_FMT "%s/.%s_%s_config" >>>> >>>> #include >>>> #include >>>> @@ -59,11 +59,22 @@ eal_runtime_config_path(void) >>>> static char buffer[PATH_MAX]; /* static so auto-zeroed */ >>>> const char *directory = default_config_dir; >>>> const char *home_dir = getenv("HOME"); >>>> + static char nameBuffer[1000]; >>>> + int result; >>>> >>>> if (getuid() != 0 && home_dir != NULL) >>>> directory = home_dir; >>>> + >>>> + /* >>>> + * Include the name of the host in the config file path. Otherwise, >>>> + * if DPDK applications run on different hosts but share a home >>>> + * directory (e.g. via NFS), they will choose the same config >>>> + * file and conflict unnecessarily. >>>> + */ >>>> + result = gethostname(nameBuffer, sizeof(nameBuffer)-1); >>>> snprintf(buffer, sizeof(buffer) - 1, RUNTIME_CONFIG_FMT, >>> directory, >>>> - internal_config.hugefile_prefix); >>>> + internal_config.hugefile_prefix, >>>> + (result == 0) ? nameBuffer : "unknown-host"); >>>> return buffer; >>>> } >>>> >>>> -- >>>> 2.8.3 >> >> >