From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id EE249A058A; Fri, 17 Apr 2020 15:53:04 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C08741DCBF; Fri, 17 Apr 2020 15:53:03 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id A4BDB1DC6F for ; Fri, 17 Apr 2020 15:53:01 +0200 (CEST) IronPort-SDR: ftEil/10EcC7Cx+ZkBmF6R/MylHuS9B4WU3vKB57Ai9g40Z9xcQm/ijFJNapEhKjo2M1SS/PJs Et0fquMBp5ZA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Apr 2020 06:53:00 -0700 IronPort-SDR: W592knYJBBuYlYB8L2Iug3ldaAY3J3LW/IJsyin5QlkuHmjlcw5o3WiLIyqu9VnQyEPXOoczDf oOjO4FGwgCJQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,395,1580803200"; d="scan'208";a="278383929" Received: from aburakov-mobl.ger.corp.intel.com (HELO [10.252.62.102]) ([10.252.62.102]) by fmsmga004.fm.intel.com with ESMTP; 17 Apr 2020 06:52:59 -0700 To: =?UTF-8?B?6ZmI5Lqa6L6JLeS6keadieeglOWPkemDqA==?= , dev@dpdk.org, jiping@yunshan.net, xiangyang@yunshan.net References: From: "Burakov, Anatoly" Message-ID: <8f5bb1c4-7572-0c18-ecab-89c1340430cb@intel.com> Date: Fri, 17 Apr 2020 14:52:58 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] eal: can not run secondary process on openstack environment 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 15-Apr-20 11:06 AM, 陈亚辉-云杉研发部 wrote: > dpdk version: 18.11 > > Ovs-dpdk runs as openvswitch account on the openstack environment. Use the > root account to run another --proc-type=secondary program, > such as dpdk-pdump or helloword with parameter --proc-type=secondary , and > it will report an Err: Cannot open '/var/run/dpdk/rte/config' for > rte_mem_config. > > Check the source code eal.c: > > int > eal_create_runtime_dir(void) > { > const char *directory = default_runtime_dir; > const char *xdg_runtime_dir = getenv("XDG_RUNTIME_DIR"); > const char *fallback = "/tmp"; > char tmp[PATH_MAX]; > int ret; > > if (getuid() != 0) { > /* try XDG path first, fall back to /tmp */ > if (xdg_runtime_dir != NULL) > directory = xdg_runtime_dir; > else > directory = fallback; > } > > /* create DPDK subdirectory under runtime dir */ > ret = snprintf(tmp, sizeof(tmp), "%s/dpdk", directory); > if (ret < 0 || ret == sizeof(tmp)) { > RTE_LOG(ERR, EAL, "Error creating DPDK runtime path > name\n"); > return -1; > } > > /* create prefix-specific subdirectory under DPDK runtime dir */ > ret = snprintf(runtime_dir, sizeof(runtime_dir), "%s/%s", > tmp, eal_get_hugefile_prefix()); > if (ret < 0 || ret == sizeof(runtime_dir)) { > RTE_LOG(ERR, EAL, "Error creating prefix-specific runtime > path name\n"); > return -1; > } > > The root account is corresponds to the directory /var/run/DPDK/rte, but > openvswitch account is directory /var/run/openvswitch DPDK/rte. > Then, I changed to the openvswitch account and run the process again, > errors below were reported: > EAL: Detected 40 lcore(s) > EAL: Detected 2 NUMA nodes > EAL: Multi-process socket > /var/run/openvswitch/dpdk/rte/mp_socket_306857_7e76690dafe702 > EAL: Probing VFIO support... > EAL: VFIO support initialized > EAL: Could not map memory from primary process > EAL: FATAL: Cannot init memory > EAL: Cannot init memory > > There seems to be insufficient permissions. So, I change the code blow and > all the things get to be OK: > > int > eal_create_runtime_dir(void) > { > const char *directory = default_runtime_dir; > const char *xdg_runtime_dir = getenv("XDG_RUNTIME_DIR"); > const char *fallback = "/tmp"; > char tmp[PATH_MAX]; > int ret; > > if (getuid() != 0) { > /* try XDG path first, fall back to /tmp */ > if (xdg_runtime_dir != NULL) > directory = xdg_runtime_dir; > else > directory = fallback; > } > > directory = "/var/run/openvswitch"; // added by my for test......... > /* create DPDK subdirectory under runtime dir */ > ret = snprintf(tmp, sizeof(tmp), "%s/dpdk", directory); > if (ret < 0 || ret == sizeof(tmp)) { > RTE_LOG(ERR, EAL, "Error creating DPDK runtime path > name\n"); > return -1; > } > > This is supposed to be a DPDK BUG. Considering that the primary and > secondary processes may not be the same account, > process with parameter --proc-type=secondary should get the runtime > directory from the primary process instead of > generating a directory as it does now. > I'm not sure how would that even be accomplished, because there is no way the initializing secondary process knows where to look for primary processes. Do you have any suggestions as to the mechanism of finding a primary process in such case? -- Thanks, Anatoly