Skip to content

Commit

Permalink
eal/freebsd: lock memory device to prevent conflicts
Browse files Browse the repository at this point in the history
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: 764bf26 ("add FreeBSD support")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
  • Loading branch information
bruce-richardson authored and david-marchand committed Oct 2, 2021
1 parent 8f532a3 commit 47a4f26
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/eal/freebsd/eal_hugepage_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 | LOCK_NB) < 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",
Expand Down

0 comments on commit 47a4f26

Please sign in to comment.