From: Daniel Jordan <daniel.m.jordan@oracle.com>
To: "Suthikulpanit, Suravee" <suravee.suthikulpanit@amd.com>
Cc: iommu@lists.linux-foundation.org
Subject: Re: iommu/amd: bug report: page table memory leak
Date: Wed, 9 Feb 2022 19:59:48 -0500 [thread overview]
Message-ID: <20220210005948.cpfij2teecka7v7w@oracle.com> (raw)
In-Reply-To: <02aa873f-ad42-f310-a3ae-453a95ba8063@amd.com>
Hello Suravee,
On Wed, Feb 09, 2022 at 12:04:40AM +0700, Suthikulpanit, Suravee wrote:
> Could you please try the following change to see if this fix the problem?
>
> diff --git a/drivers/iommu/amd/io_pgtable.c b/drivers/iommu/amd/io_pgtable.c
> index 182c93a43efd..1eddf557636d 100644
> --- a/drivers/iommu/amd/io_pgtable.c
> +++ b/drivers/iommu/amd/io_pgtable.c
> @@ -519,12 +519,6 @@ static void v1_free_pgtable(struct io_pgtable *iop)
>
> dom = container_of(pgtable, struct protection_domain, iop);
>
> - /* Update data structure */
> - amd_iommu_domain_clr_pt_root(dom);
> -
> - /* Make changes visible to IOMMUs */
> - amd_iommu_domain_update(dom);
> -
> /* Page-table is not visible to IOMMU anymore, so free it */
> BUG_ON(pgtable->mode < PAGE_MODE_NONE ||
> pgtable->mode > PAGE_MODE_6_LEVEL);
> @@ -532,6 +526,12 @@ static void v1_free_pgtable(struct io_pgtable *iop)
> root = (unsigned long)pgtable->root;
> freelist = free_sub_pt(root, pgtable->mode, freelist);
>
> + /* Update data structure */
> + amd_iommu_domain_clr_pt_root(dom);
> +
> + /* Make changes visible to IOMMUs */
> + amd_iommu_domain_update(dom);
> +
> free_page_list(freelist);
> }
Thanks! That fixes the leak. Feel free to add
Reported-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Tested-by: Daniel Jordan <daniel.m.jordan@oracle.com>
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
prev parent reply other threads:[~2022-02-10 1:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-18 19:47 iommu/amd: bug report: page table memory leak Daniel Jordan
2022-02-02 20:03 ` Daniel Jordan
2022-02-08 17:04 ` Suthikulpanit, Suravee via iommu
2022-02-10 0:59 ` Daniel Jordan [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=20220210005948.cpfij2teecka7v7w@oracle.com \
--to=daniel.m.jordan@oracle.com \
--cc=iommu@lists.linux-foundation.org \
--cc=suravee.suthikulpanit@amd.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