DPDK patches and discussions
 help / color / mirror / Atom feed
From: thiery.ouattara@outscale.com
To: dev@dpdk.org
Cc: thiery.ouattara@outscale.com, anatoly.burakov@intel.com
Subject: [dpdk-dev] [PATCH] eal: allow start two dpdk with no-huge option
Date: Tue, 10 Jul 2018 16:54:25 +0200	[thread overview]
Message-ID: <1531234465-31339-1-git-send-email-thiery.ouattara@outscale.com> (raw)

From: Kignelman OUATTARA <thiery.ouattara@outscale.com>

in last version (v18.02), we was using no-huge option to
start 2 dpdk instances simultanusly (for testing purpose).

but since v18.05 when we start 2 instances:
- the first dpdk app start normaly
- the 2nd can't start because LOCK_EX option is set in
  flock(fd, LOCK_EX | LOCK_NB).

So i did this patch to change LOCK_EX to LOCK_SH if no-huge
option is set.

Signed-off-by: Kignelman OUATTARA <thiery.ouattara@outscale.com>
---
 lib/librte_eal/common/eal_common_fbarray.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eal/common/eal_common_fbarray.c b/lib/librte_eal/common/eal_common_fbarray.c
index 019f84c..7a7b9af 100644
--- a/lib/librte_eal/common/eal_common_fbarray.c
+++ b/lib/librte_eal/common/eal_common_fbarray.c
@@ -414,6 +414,7 @@ struct used_mask {
 	struct used_mask *msk;
 	void *data = NULL;
 	int fd = -1;
+	int lock_opt = LOCK_EX;
 
 	if (arr == NULL) {
 		rte_errno = EINVAL;
@@ -436,6 +437,9 @@ struct used_mask {
 
 	eal_get_fbarray_path(path, sizeof(path), name);
 
+	if (internal_config.no_hugetlbfs)
+		lock_opt = LOCK_SH;
+
 	/*
 	 * Each fbarray is unique to process namespace, i.e. the filename
 	 * depends on process prefix. Try to take out a lock and see if we
@@ -447,7 +451,7 @@ struct used_mask {
 				path, strerror(errno));
 		rte_errno = errno;
 		goto fail;
-	} else if (flock(fd, LOCK_EX | LOCK_NB)) {
+	} else if (flock(fd, lock_opt | LOCK_NB)) {
 		RTE_LOG(DEBUG, EAL, "%s(): couldn't lock %s: %s\n", __func__,
 				path, strerror(errno));
 		rte_errno = EBUSY;
-- 
1.9.1

             reply	other threads:[~2018-07-10 14:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-10 14:54 thiery.ouattara [this message]
2018-07-10 15:00 ` Burakov, Anatoly
2018-07-10 15:19   ` Thiery Ouattara

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=1531234465-31339-1-git-send-email-thiery.ouattara@outscale.com \
    --to=thiery.ouattara@outscale.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@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).