DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: "Burakov, Anatoly" <anatoly.burakov@intel.com>
Cc: dev@dpdk.org, david.marchand@redhat.com, stable@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] eal/freebsd: lock memory device to prevent conflicts
Date: Mon, 13 Sep 2021 14:36:58 +0100	[thread overview]
Message-ID: <YT9T+sxJPLtzKBGu@bricha3-MOBL.ger.corp.intel.com> (raw)
In-Reply-To: <48d75bc2-ae55-183c-8132-6e3e150647af@intel.com>

On Mon, Sep 13, 2021 at 02:14:55PM +0100, Burakov, Anatoly wrote:
> On 13-Sep-21 12:06 PM, Bruce Richardson wrote:
> > Only a single DPDK process on the system can be using the /dev/contigmem
> > mappings at a time, but this was never explicitly enforced, e.g. when
> > using --in-memory flag on two processes. To prevent possible conflict
> > issues, we lock the dev node when it's in use, preventing other DPDK
> > processes from starting up and causing problems for us.
> > 
> > Fixes: 764bf26873b9 ("add FreeBSD support")
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > ---
> >   lib/eal/freebsd/eal_hugepage_info.c | 4 ++++
> >   1 file changed, 4 insertions(+)
> > 
> > diff --git a/lib/eal/freebsd/eal_hugepage_info.c b/lib/eal/freebsd/eal_hugepage_info.c
> > index 408f054f7a..4a8d87c23e 100644
> > --- a/lib/eal/freebsd/eal_hugepage_info.c
> > +++ b/lib/eal/freebsd/eal_hugepage_info.c
> > @@ -90,6 +90,10 @@ eal_hugepage_info_init(void)
> >   		RTE_LOG(ERR, EAL, "could not open "CONTIGMEM_DEV"\n");
> >   		return -1;
> >   	}
> > +	if (flock(fd, LOCK_EX) < 0) {
> > +		RTE_LOG(ERR, EAL, "could not lock memory. Is another DPDK process running?\n");
> > +		return -1;
> > +	}
> >   	if (buffer_size >= 1<<30)
> >   		RTE_LOG(INFO, EAL, "Contigmem driver has %d buffers, each of size %dGB\n",
> > 
> 
> This only gets triggered when regular init path is chosen, i.e. --no-huge
> still works.

Yes, but that is ok, I think, since no-huge doesn't use these resources or
suffer from this problem. On the other hand, except for running unit tests,
no-huge mode is pretty useless on FreeBSD as we don't have any
vfio-equivalent support, so all HW access has to use physical addresses
which can only be got using contigmem.

> I'm a bit uneasy with --in-memory mode pretending to work on
> FreeBSD and Windows, but that's a separate problem :)

Yes, it is, though one that does belong is the same area as this one. The
"fix" is probably to just print a warning when --in-memory is used,
informing the user that the flag is ignored and then continue.
Alternatively we can error out, but I think the warn+continue is better,
myself.

> As far as the patch
> goes, the problem it addresses does get fixed.
> 
> Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
> 
Thanks.

/Bruce

  reply	other threads:[~2021-09-13 13:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-13 11:06 Bruce Richardson
2021-09-13 13:14 ` Burakov, Anatoly
2021-09-13 13:36   ` Bruce Richardson [this message]
2021-09-13 14:40     ` Burakov, Anatoly
2021-10-02 14:43       ` David Marchand
2021-09-13 13:59   ` Dmitry Kozlyuk
2021-10-02 14:42   ` David Marchand
2021-09-13 14:08 ` [dpdk-dev] [PATCH v2] " Bruce Richardson
2021-10-06 14:56   ` Thomas Monjalon

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=YT9T+sxJPLtzKBGu@bricha3-MOBL.ger.corp.intel.com \
    --to=bruce.richardson@intel.com \
    --cc=anatoly.burakov@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    /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).