DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
To: <dev@dpdk.org>
Cc: <rasland@nvidia.com>, <matan@nvidia.com>, <suanmingm@nvidia.com>,
	<dsosnowski@nvidia.com>, <stable@dpdk.org>
Subject: [PATCH] common/mlx5: fix overlapping memory ranges
Date: Tue, 21 Jul 2026 15:13:37 +0300	[thread overview]
Message-ID: <20260721121337.1608660-1-viacheslavo@nvidia.com> (raw)

The mlx5 driver requires special objects named Memory Regions
(MR) to perform DMA operations with network data. The memory
pool(s) is used to provide memory and to cover pool addresses
the mlx5 PMD -pre-creates the appropriate MRs on Rx queue creation.

The pool memory can be non-contigous and split into segments.
The PMD created MRs on the page alignment segment boundaries
and it could cause the overlapping MRs (in case if the end
address of one segmend is aligned to ceiling and the next
segment start address is aligned to the floor).

The MRs overlapping could cause the wrong MR fetching from the
cache for the mbufs in the overlapping area if the starting
mbuf address falls into overlapped area and raise the
hardware memory protection exception.

Fixes: 690b2a88c2f7 ("common/mlx5: add mempool registration facilities")
Cc: stable@dpdk.org

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
---
 drivers/common/mlx5/mlx5_common_mr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/common/mlx5/mlx5_common_mr.c b/drivers/common/mlx5/mlx5_common_mr.c
index aa2d5e88a4..e968e928a1 100644
--- a/drivers/common/mlx5/mlx5_common_mr.c
+++ b/drivers/common/mlx5/mlx5_common_mr.c
@@ -1504,7 +1504,7 @@ mlx5_get_mempool_ranges(struct rte_mempool *mp, bool is_extmem,
 	qsort(chunks, chunks_n, sizeof(chunks[0]), mlx5_range_compare_start);
 	contig_n = 1;
 	for (i = 1; i < chunks_n; i++)
-		if (chunks[i - 1].end != chunks[i].start) {
+		if (chunks[i - 1].end < chunks[i].start) {
 			chunks[contig_n - 1].end = chunks[i - 1].end;
 			chunks[contig_n] = chunks[i];
 			contig_n++;
-- 
2.34.1


             reply	other threads:[~2026-07-21 12:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-21 12:13 Viacheslav Ovsiienko [this message]
2026-08-03  9:18 ` [PATCH] common/mlx5: fix overlapping memory ranges Raslan Darawsheh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260721121337.1608660-1-viacheslavo@nvidia.com \
    --to=viacheslavo@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=dsosnowski@nvidia.com \
    --cc=matan@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=stable@dpdk.org \
    --cc=suanmingm@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox