DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Burakov, Anatoly" <anatoly.burakov@intel.com>
To: 陈亚辉-云杉研发部 <goodluckwillcomesoon@gmail.com>,
	dev@dpdk.org, jiping@yunshan.net, xiangyang@yunshan.net
Subject: Re: [dpdk-dev] eal: can not run secondary process on openstack environment
Date: Fri, 17 Apr 2020 14:52:58 +0100	[thread overview]
Message-ID: <8f5bb1c4-7572-0c18-ecab-89c1340430cb@intel.com> (raw)
In-Reply-To: <CAPydje-rYD=Ce+_vYXbV1bzwW3no4qnW-+XvHyTht9QAfMvbDQ@mail.gmail.com>

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

  reply	other threads:[~2020-04-17 13:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-15 10:06 陈亚辉-云杉研发部
2020-04-17 13:52 ` Burakov, Anatoly [this message]
2020-04-30  4:14 陈亚辉-云杉研发部
2020-04-30  9:14 ` Burakov, Anatoly
2020-04-30 16:09   ` Stephen Hemminger
2020-04-30 16:36     ` Bruce Richardson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8f5bb1c4-7572-0c18-ecab-89c1340430cb@intel.com \
    --to=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=goodluckwillcomesoon@gmail.com \
    --cc=jiping@yunshan.net \
    --cc=xiangyang@yunshan.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).