From: "Leizhen (ThunderTown)" <thunder.leizhen@huawei.com>
To: Joerg Roedel <joro@8bytes.org>,
iommu <iommu@lists.linux-foundation.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Cc: Robin Murphy <robin.murphy@arm.com>
Subject: Re: [PATCH 1/1] iommu/amd: make sure TLB to be flushed before IOVA freed
Date: Thu, 21 Jun 2018 14:08:54 +0800 [thread overview]
Message-ID: <5B2B40F6.50309@huawei.com> (raw)
In-Reply-To: <1528251526-11408-1-git-send-email-thunder.leizhen@huawei.com>
Hi Joerg:
Can you take a look at it?
On 2018/6/6 10:18, Zhen Lei wrote:
> Although the mapping has already been removed in the page table, it maybe
> still exist in TLB. Suppose the freed IOVAs is reused by others before the
> flush operation completed, the new user can not correctly access to its
> meomory.
>
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
> ---
> drivers/iommu/amd_iommu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
> index 8fb8c73..93aa389 100644
> --- a/drivers/iommu/amd_iommu.c
> +++ b/drivers/iommu/amd_iommu.c
> @@ -2402,9 +2402,9 @@ static void __unmap_single(struct dma_ops_domain *dma_dom,
> }
>
> if (amd_iommu_unmap_flush) {
> - dma_ops_free_iova(dma_dom, dma_addr, pages);
> domain_flush_tlb(&dma_dom->domain);
> domain_flush_complete(&dma_dom->domain);
> + dma_ops_free_iova(dma_dom, dma_addr, pages);
> } else {
> pages = __roundup_pow_of_two(pages);
> queue_iova(&dma_dom->iovad, dma_addr >> PAGE_SHIFT, pages, 0);
> --
> 1.8.3
>
>
>
> .
>
--
Thanks!
BestRegards
next prev parent reply other threads:[~2018-06-21 6:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-06 2:18 [PATCH 1/1] iommu/amd: make sure TLB to be flushed before IOVA freed Zhen Lei
2018-06-21 6:08 ` Leizhen (ThunderTown) [this message]
2018-07-06 11:21 ` Joerg Roedel
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=5B2B40F6.50309@huawei.com \
--to=thunder.leizhen@huawei.com \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robin.murphy@arm.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