[21.02] mem: don't warn about base addr if not requested

Message ID 0ae7d9b2c1ee0e12f8ae7faa2d154c03ae7e0c92.1604935662.git.anatoly.burakov@intel.com (mailing list archive)
State Superseded, archived
Headers
Series [21.02] mem: don't warn about base addr if not requested |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed
ci/iol-mellanox-Performance success Performance Testing PASS

Commit Message

Anatoly Burakov Nov. 9, 2020, 3:27 p.m. UTC
  Any EAL memory allocation often goes through eal_get_virtual_area()
function, which will print a warning whenever the resulting allocation
didn't match the specified address requirements. This is useful for
when we have requested a specific base virtual address, to let the user
know that the mapping has deviated from that address.

However, on Linux, we also have a default base address that's there to
ensure better chances of successful secondary process initialization,
as well as higher likelihood of the virtual areas to fit inside the
IOMMU address width. Because of this default base address, there are
warnings printed even when no base address was explicitly requested,
which can be confusing to the user.

Disable this warning unless base address was explicitly requested.

Cc: Damjan Marion <damarion@cisco.com>

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---

Notes:
    I'm not entirely sure the trade off between user confusion and helpful debug
    information is worth it, but in my experience, i've stopped getting any emails
    about secondary processes a long time ago and this isn't a widely used feature,
    so i believe this is worth it.

 lib/librte_eal/common/eal_common_memory.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Patch

diff --git a/lib/librte_eal/common/eal_common_memory.c b/lib/librte_eal/common/eal_common_memory.c
index 33917fa835..6e0d6a0b1c 100644
--- a/lib/librte_eal/common/eal_common_memory.c
+++ b/lib/librte_eal/common/eal_common_memory.c
@@ -139,7 +139,8 @@  eal_get_virtual_area(void *requested_addr, size_t *size,
 		rte_errno = EADDRNOTAVAIL;
 		return NULL;
 	} else if (requested_addr != NULL && addr_is_hint &&
-			aligned_addr != requested_addr) {
+			aligned_addr != requested_addr &&
+			internal_conf->base_virtaddr != 0) {
 		RTE_LOG(WARNING, EAL, "WARNING! Base virtual address hint (%p != %p) not respected!\n",
 			requested_addr, aligned_addr);
 		RTE_LOG(WARNING, EAL, "   This may cause issues with mapping memory into secondary processes\n");