iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Baoquan He <bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Vincent.Wan-5C7GfCeVMHo@public.gmane.org,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
	dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Subject: [PATCH 1/4] iommu/amd: clean up the cmpxchg64 invocation
Date: Thu, 15 Sep 2016 16:50:50 +0800	[thread overview]
Message-ID: <1473929453-3533-2-git-send-email-bhe@redhat.com> (raw)
In-Reply-To: <1473929453-3533-1-git-send-email-bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

Change it as it's designed for and keep it consistent with other
places.

Signed-off-by: Baoquan He <bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 drivers/iommu/amd_iommu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index 96de97a..160fc6a 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -1274,7 +1274,8 @@ static u64 *alloc_pte(struct protection_domain *domain,
 
 			__npte = PM_LEVEL_PDE(level, virt_to_phys(page));
 
-			if (cmpxchg64(pte, __pte, __npte)) {
+			/* pte could have been changed somewhere. */
+			if (cmpxchg64(pte, __pte, __npte) != __pte) {
 				free_page((unsigned long)page);
 				continue;
 			}
-- 
2.5.5

  parent reply	other threads:[~2016-09-15  8:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-15  8:50 [PATCH 0/4] iommu/amd: Clean up patches Baoquan He
     [not found] ` <1473929453-3533-1-git-send-email-bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-09-15  8:50   ` Baoquan He [this message]
2016-09-15  8:50   ` [PATCH 2/4] iommu/amd: Use standard bitmap operation to set bitmap Baoquan He
2016-09-15  8:50   ` [PATCH 3/4] iommu/amd: Free domain id when free a domain of struct dma_ops_domain Baoquan He
2016-09-15  8:50   ` [PATCH 4/4] iommu/amd: No need to wait iommu completion if no dte irq entry change Baoquan He
     [not found]     ` <1473929453-3533-5-git-send-email-bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-09-20  1:05       ` [PATCH RESEND " Baoquan He
2016-09-20  9:56         ` Joerg Roedel
2016-09-20 10:14           ` Baoquan He
2016-09-19 14:20 ` [PATCH 0/4] iommu/amd: Clean up patches Joerg Roedel
     [not found]   ` <20160919142058.GA7566-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2016-09-20  1:07     ` Baoquan He

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=1473929453-3533-2-git-send-email-bhe@redhat.com \
    --to=bhe-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=Vincent.Wan-5C7GfCeVMHo@public.gmane.org \
    --cc=dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.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).