patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] eal/freebsd: lock memory device to prevent conflicts
@ 2021-09-13 11:06 Bruce Richardson
  2021-09-13 13:14 ` Burakov, Anatoly
  2021-09-13 14:08 ` [dpdk-stable] [PATCH v2] " Bruce Richardson
  0 siblings, 2 replies; 9+ messages in thread
From: Bruce Richardson @ 2021-09-13 11:06 UTC (permalink / raw)
  To: dev; +Cc: anatoly.burakov, david.marchand, Bruce Richardson, stable

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",
-- 
2.30.2


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-10-06 14:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-13 11:06 [dpdk-stable] [PATCH] eal/freebsd: lock memory device to prevent conflicts Bruce Richardson
2021-09-13 13:14 ` Burakov, Anatoly
2021-09-13 13:36   ` Bruce Richardson
2021-09-13 14:40     ` Burakov, Anatoly
2021-10-02 14:43       ` David Marchand
2021-09-13 13:59   ` [dpdk-stable] [dpdk-dev] " Dmitry Kozlyuk
2021-10-02 14:42   ` [dpdk-stable] " David Marchand
2021-09-13 14:08 ` [dpdk-stable] [PATCH v2] " Bruce Richardson
2021-10-06 14:56   ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon

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).