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.jor...@oracle.com>
Tested-by: Daniel Jordan <daniel.m.jor...@oracle.com>
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to