patches for DPDK stable branches
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: anatoly.burakov@intel.com
Cc: dev@dpdk.org, Yunjian Wang <wangyunjian@huawei.com>,
	xiawei40@huawei.com,  luyicai@huawei.com,
	Lipei Liang <lianglipei@huawei.com>,
	stable@dpdk.org
Subject: Re: [PATCH v2] vfio: check iova if already mapped before do map
Date: Tue, 8 Oct 2024 11:04:27 +0200	[thread overview]
Message-ID: <CAJFAV8wVjfBmarjU=8k-k_MW0CyTPfFwBijNSxdGVeL3AfpiSQ@mail.gmail.com> (raw)
In-Reply-To: <1725974338-56108-1-git-send-email-wangyunjian@huawei.com>

Hello Anatoly,

On Tue, Sep 10, 2024 at 3:19 PM Yunjian Wang <wangyunjian@huawei.com> wrote:
>
> From: Lipei Liang <lianglipei@huawei.com>
>
> When mapping two adjacent memory areas A and B, the current implementation
> merges them into one segment, known as area C. However, if areas A and B
> are mapped again, there will be separate entries for A, C, and B in the
> memory maps, as C divides A and B. This means that if A and B are mapped
> twice, there will be two map entries for each. When partially unmapping
> A and B, the entry for C will remain in the memory maps. If we then map
> area D, which has a different size than A but falls within area C, the
> find_user_mem_maps function may mistakenly identify C when attempting to
> unmap D. This is because A and C have different chunk sizes, resulting in
> a failure to unmap D.
>
> To fix this issue, we can add a check for the iova before performing the
> dma mapping. If the iova is already mapped, we should not perform the vfio
> mapping. If the iova overlaps with an entry in the memory maps, we should
> return an error code of -1 with the ENOTSUP error. However, if the iova
> does not overlap with any entry in the memory maps, we can proceed with
> the dma mapping.
>
> Fixes: 56259f7fc010 ("vfio: allow partially unmapping adjacent memory")
> Cc: stable@dpdk.org
>
> Signed-off-by: Lipei Liang <lianglipei@huawei.com>

Review, please.


-- 
David Marchand


      reply	other threads:[~2024-10-08  9:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-10 13:18 Yunjian Wang
2024-10-08  9:04 ` David Marchand [this message]

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='CAJFAV8wVjfBmarjU=8k-k_MW0CyTPfFwBijNSxdGVeL3AfpiSQ@mail.gmail.com' \
    --to=david.marchand@redhat.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=lianglipei@huawei.com \
    --cc=luyicai@huawei.com \
    --cc=stable@dpdk.org \
    --cc=wangyunjian@huawei.com \
    --cc=xiawei40@huawei.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;
as well as URLs for NNTP newsgroup(s).