From: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
To: Jan Beulich <JBeulich@suse.com>,
xen-devel <xen-devel@lists.xenproject.org>
Cc: Aravind Gopalakrishnan <aravind.gopalakrishnan@amd.com>
Subject: Re: [PATCH] AMD IOMMU: don't free page table prematurely
Date: Wed, 28 May 2014 00:20:15 -0500 [thread overview]
Message-ID: <5385720F.6040507@amd.com> (raw)
In-Reply-To: <538330AB0200007800015B2F@mail.emea.novell.com>
On 05/26/2014 05:16 AM, Jan Beulich wrote:
> iommu_merge_pages() still wants to look at the next level page table,
> the TLB flush necessary before freeing too happens in that function,
> and if it fails no free should happen at all. Hence the freeing must
> be done after that function returned successfully, not before it's
> being called.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>
> --- a/xen/drivers/passthrough/amd/iommu_map.c
> +++ b/xen/drivers/passthrough/amd/iommu_map.c
> @@ -691,8 +691,6 @@ int amd_iommu_map_page(struct domain *d,
> if ( !iommu_update_pde_count(d, pt_mfn[merge_level],
> gfn, mfn, merge_level) )
> break;
> - /* Deallocate lower level page table */
> - free_amd_iommu_pgtable(mfn_to_page(pt_mfn[merge_level - 1]));
>
> if ( iommu_merge_pages(d, pt_mfn[merge_level], gfn,
> flags, merge_level) )
> @@ -703,6 +701,9 @@ int amd_iommu_map_page(struct domain *d,
> domain_crash(d);
> return -EFAULT;
> }
> +
> + /* Deallocate lower level page table */
> + free_amd_iommu_pgtable(mfn_to_page(pt_mfn[merge_level - 1]));
> }
>
> out:
>
>
>
Reviewed and tested. By the way, is this patch fix any existing known
issues?
Suravee
prev parent reply other threads:[~2014-05-28 5:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-26 10:16 [PATCH] AMD IOMMU: don't free page table prematurely Jan Beulich
2014-05-26 15:55 ` Andrew Cooper
2014-05-28 5:20 ` Suravee Suthikulpanit [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=5385720F.6040507@amd.com \
--to=suravee.suthikulpanit@amd.com \
--cc=JBeulich@suse.com \
--cc=aravind.gopalakrishnan@amd.com \
--cc=xen-devel@lists.xenproject.org \
/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).