env: Search DPDK memsegs before /proc/self/pagemap for phys addrs

When running IOMMU enabled the user is actually
interacting with IO addresses - not physical
addresses. The value in the DPDK memseg array is
the correct one in this case, and should be used
at a higher priority than attempting to look up
the address in /proc/self/pagemap (i.e. what
rte_mem_virt2phy() does).

Further, rte_mem_virt2phy() will always fail when
running as an unprivileged user, but scanning
the memory segments will work.

Change-Id: I576e685111b7f9f848337134b7b89a3cf7c85402
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/375208
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Ben Walker 2017-08-22 11:41:38 -07:00 committed by Jim Harris
parent b52e8b2588
commit 3860fa7ef6

View File

@ -450,11 +450,6 @@ vtophys_get_paddr(uint64_t vaddr)
struct rte_memseg *seg;
uint32_t seg_idx;
paddr = vtophys_get_dpdk_paddr((void *)vaddr);
if (paddr != RTE_BAD_PHYS_ADDR) {
return paddr;
}
mcfg = rte_eal_get_configuration()->mem_config;
for (seg_idx = 0; seg_idx < RTE_MAX_MEMSEG; seg_idx++) {
@ -471,6 +466,15 @@ vtophys_get_paddr(uint64_t vaddr)
}
}
/*
* The memory is not registered with DPDK. Try to look it up
* in /proc/self/pagemap.
*/
paddr = vtophys_get_dpdk_paddr((void *)vaddr);
if (paddr != RTE_BAD_PHYS_ADDR) {
return paddr;
}
#ifdef DEBUG
fprintf(stderr, "could not find vaddr 0x%" PRIx64 " in DPDK mem config\n", vaddr);
#endif