xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>,
	xen-devel <xen-devel@lists.xenproject.org>
Cc: Aravind Gopalakrishnan <aravind.gopalakrishnan@amd.com>,
	suravee.suthikulpanit@amd.com
Subject: Re: [PATCH] AMD IOMMU: don't free page table prematurely
Date: Mon, 26 May 2014 16:55:01 +0100	[thread overview]
Message-ID: <538363D5.9070206@citrix.com> (raw)
In-Reply-To: <538330AB0200007800015B2F@mail.emea.novell.com>


[-- Attachment #1.1: Type: text/plain, Size: 1440 bytes --]

On 26/05/2014 11:16, 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>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.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:
>
>
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel


[-- Attachment #1.2: Type: text/html, Size: 2306 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2014-05-26 15:55 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 [this message]
2014-05-28  5:20 ` Suravee Suthikulpanit

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=538363D5.9070206@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=aravind.gopalakrishnan@amd.com \
    --cc=suravee.suthikulpanit@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).