From 009868730cbaea4c90163c0854d2e749a222d889 Mon Sep 17 00:00:00 2001 From: Seth Howell Date: Mon, 25 Feb 2019 16:53:04 -0700 Subject: [PATCH] init: add --match-allocations to init params. This feature was added to DPDK by Jim to avoid the failures that can come from splitting a buffer over memory regions in RDMA. Change-Id: I13b646e22a4e2a4ccf915b0274061d31d02c03f7 Signed-off-by: Seth Howell Reviewed-on: https://review.gerrithub.io/c/446166 Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- lib/env_dpdk/init.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/env_dpdk/init.c b/lib/env_dpdk/init.c index 11c8a9485..48d023a4d 100644 --- a/lib/env_dpdk/init.c +++ b/lib/env_dpdk/init.c @@ -329,6 +329,18 @@ spdk_build_eal_cmdline(const struct spdk_env_opts *opts) return -1; } + /* --match-allocation prevents DPDK from merging or splitting system memory allocations under the hood. + * This is critical for RDMA when attempting to use an rte_mempool based buffer pool. If DPDK merges two + * physically or IOVA contiguous memory regions, then when we go to allocate a buffer pool, it can split + * the memory for a buffer over two allocations meaning the buffer will be split over a memory region. + */ +#if RTE_VERSION >= RTE_VERSION_NUM(19, 02, 0, 0) + args = spdk_push_arg(args, &argcount, _sprintf_alloc("%s", "--match-allocations")); + if (args == NULL) { + return -1; + } +#endif + if (opts->shm_id < 0) { args = spdk_push_arg(args, &argcount, _sprintf_alloc("--file-prefix=spdk_pid%d", getpid()));