[dpdk-stable] patch 'mempool: use actual IOVA addresses when populating' has been queued to LTS release 18.11.6

Kevin Traynor ktraynor at redhat.com
Wed Dec 11 22:26:21 CET 2019


Hi,

FYI, your patch has been queued to LTS release 18.11.6

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 12/17/19. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable-queue

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable-queue/commit/9bf2561cb325022e0591a1fbebcc59867025d596

Thanks.

Kevin.

---
>From 9bf2561cb325022e0591a1fbebcc59867025d596 Mon Sep 17 00:00:00 2001
From: Anatoly Burakov <anatoly.burakov at intel.com>
Date: Thu, 14 Nov 2019 13:58:20 +0000
Subject: [PATCH] mempool: use actual IOVA addresses when populating

[ upstream commit 2a7fd3ef38da19b2805fecd29c527456364ae618 ]

Currently, when mempool is being populated, we get IOVA address
of every segment using rte_mem_virt2iova(). This works for internal
memory, but does not really work for external memory, and does not
work on platforms which return RTE_BAD_IOVA as a result of this
call (such as FreeBSD). Moreover, even when it works, the function
in question will do unnecessary pagewalks in IOVA as PA mode, as
it falls back to rte_mem_virt2phy() instead of just doing a lookup in
internal memseg table.

To fix it, replace the call to first attempt to look through the
internal memseg table (this takes care of internal and external memory),
and fall back to rte_mem_virt2iova() when unable to perform VA->IOVA
translation via memseg table.

Fixes: 66cc45e293ed ("mem: replace memseg with memseg lists")

Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
Acked-by: Olivier Matz <olivier.matz at 6wind.com>
Tested-by: Bo Chen <box.c.chen at intel.com>
---
 lib/librte_mempool/rte_mempool.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
index 683b216f9..99530a595 100644
--- a/lib/librte_mempool/rte_mempool.c
+++ b/lib/librte_mempool/rte_mempool.c
@@ -356,4 +356,17 @@ fail:
 }
 
+static rte_iova_t
+get_iova(void *addr)
+{
+	struct rte_memseg *ms;
+
+	/* try registered memory first */
+	ms = rte_mem_virt2memseg(addr, NULL);
+	if (ms == NULL || ms->iova == RTE_BAD_IOVA)
+		/* fall back to actual physical address */
+		return rte_mem_virt2iova(addr);
+	return ms->iova + RTE_PTR_DIFF(addr, ms->addr);
+}
+
 /* Populate the mempool with a virtual area. Return the number of
  * objects added, or a negative value on error.
@@ -381,5 +394,5 @@ rte_mempool_populate_virt(struct rte_mempool *mp, char *addr,
 		     mp->populated_size < mp->size; off += phys_len) {
 
-		iova = rte_mem_virt2iova(addr + off);
+		iova = get_iova(addr + off);
 
 		if (iova == RTE_BAD_IOVA && rte_eal_has_hugepages()) {
@@ -392,5 +405,5 @@ rte_mempool_populate_virt(struct rte_mempool *mp, char *addr,
 			rte_iova_t iova_tmp;
 
-			iova_tmp = rte_mem_virt2iova(addr + off + phys_len);
+			iova_tmp = get_iova(addr + off + phys_len);
 
 			if (iova_tmp != iova + phys_len)
-- 
2.21.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2019-12-11 21:24:15.049815276 +0000
+++ 0029-mempool-use-actual-IOVA-addresses-when-populating.patch	2019-12-11 21:24:12.657651424 +0000
@@ -1 +1 @@
-From 2a7fd3ef38da19b2805fecd29c527456364ae618 Mon Sep 17 00:00:00 2001
+From 9bf2561cb325022e0591a1fbebcc59867025d596 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 2a7fd3ef38da19b2805fecd29c527456364ae618 ]
+
@@ -21 +22,0 @@
-Cc: stable at dpdk.org
@@ -31 +32 @@
-index 40cae3eb6..8da2e471c 100644
+index 683b216f9..99530a595 100644
@@ -34 +35 @@
-@@ -357,4 +357,17 @@ fail:
+@@ -356,4 +356,17 @@ fail:
@@ -52 +53 @@
-@@ -376,5 +389,5 @@ rte_mempool_populate_virt(struct rte_mempool *mp, char *addr,
+@@ -381,5 +394,5 @@ rte_mempool_populate_virt(struct rte_mempool *mp, char *addr,
@@ -65 +66 @@
- 			if (iova_tmp == RTE_BAD_IOVA ||
+ 			if (iova_tmp != iova + phys_len)



More information about the stable mailing list