memalloc: check for contiguousness in external segments

Message ID 8533ab3a49f63e9700764ead8b9147a098911b41.1542204687.git.anatoly.burakov@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series memalloc: check for contiguousness in external segments |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/intel-Performance-Testing success Performance Testing PASS
ci/Intel-compilation success Compilation OK

Commit Message

Burakov, Anatoly Nov. 14, 2018, 2:51 p.m. UTC
  For IOVA as VA mode, we assume that memory is contiguous. However,
for external segments that assumption may not necessarily hold.
Fix the code to not assume that external memory segments are
contiguous even in IOVA as VA mode.

Fixes: 5282bb1c3695 ("mem: allow memseg lists to be marked as external")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 lib/librte_eal/common/eal_common_memalloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Thomas Monjalon Nov. 18, 2018, 1:05 p.m. UTC | #1
14/11/2018 15:51, Anatoly Burakov:
> For IOVA as VA mode, we assume that memory is contiguous. However,
> for external segments that assumption may not necessarily hold.
> Fix the code to not assume that external memory segments are
> contiguous even in IOVA as VA mode.
> 
> Fixes: 5282bb1c3695 ("mem: allow memseg lists to be marked as external")
> 
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>

Applied, thanks
  
Thomas Monjalon Nov. 18, 2018, 4:21 p.m. UTC | #2
14/11/2018 15:51, Anatoly Burakov:
> For IOVA as VA mode, we assume that memory is contiguous. However,
> for external segments that assumption may not necessarily hold.
> Fix the code to not assume that external memory segments are
> contiguous even in IOVA as VA mode.
> 
> Fixes: 5282bb1c3695 ("mem: allow memseg lists to be marked as external")
> 
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>

Applied, thanks
  

Patch

diff --git a/lib/librte_eal/common/eal_common_memalloc.c b/lib/librte_eal/common/eal_common_memalloc.c
index 1d41ea112..371271979 100644
--- a/lib/librte_eal/common/eal_common_memalloc.c
+++ b/lib/librte_eal/common/eal_common_memalloc.c
@@ -77,7 +77,7 @@  eal_memalloc_is_contig(const struct rte_memseg_list *msl, void *start,
 	const struct rte_memseg *ms;
 
 	/* for IOVA_VA, it's always contiguous */
-	if (rte_eal_iova_mode() == RTE_IOVA_VA)
+	if (rte_eal_iova_mode() == RTE_IOVA_VA && !msl->external)
 		return true;
 
 	/* for legacy memory, it's always contiguous */