From: Oded Gabbay <oded.gabbay@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "David Airlie" <airlied@linux.ie>,
"Alex Deucher" <alexander.deucher@amd.com>,
"Jerome Glisse" <j.glisse@gmail.com>,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
"John Bridgman" <John.Bridgman@amd.com>,
"Andrew Lewycky" <Andrew.Lewycky@amd.com>,
"Joerg Roedel" <joro@8bytes.org>, linux-mm <linux-mm@kvack.org>,
"Oded Gabbay" <oded.gabbay@amd.com>,
"Naoya Horiguchi" <n-horiguchi@ah.jp.nec.com>,
"Joonsoo Kim" <iamjoonsoo.kim@lge.com>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
"Hugh Dickins" <hughd@google.com>,
"Cyrill Gorcunov" <gorcunov@openvz.org>,
"Jérôme Glisse" <jglisse@redhat.com>,
"Jianyu Zhan" <nasa4836@gmail.com>
Subject: [PATCH 28/83] mm: Change timing of notification to IOMMUs about a page to be invalidated
Date: Fri, 11 Jul 2014 00:53:26 +0300 [thread overview]
Message-ID: <1405029208-6703-1-git-send-email-oded.gabbay@amd.com> (raw)
From: Andrew Lewycky <Andrew.Lewycky@amd.com>
This patch changes the location of the mmu_notifier_invalidate_page function
call inside try_to_unmap_one. The mmu_notifier_invalidate_page function
call tells the IOMMU that a pgae should be invalidated.
The location is changed from after releasing the physical page to
before releasing the physical page.
This change should prevent the bug that would occur in the
(rare) case where the GPU attempts to access a page while the CPU
attempts to swap out that page (or discard it if it is not dirty).
Signed-off-by: Andrew Lewycky <Andrew.Lewycky@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
---
mm/rmap.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/mm/rmap.c b/mm/rmap.c
index 196cd0c..73d4c3d 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -1231,13 +1231,17 @@ static int try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
} else
dec_mm_counter(mm, MM_FILEPAGES);
+ pte_unmap_unlock(pte, ptl);
+
+ mmu_notifier_invalidate_page(vma, address, event);
+
page_remove_rmap(page);
page_cache_release(page);
+ return ret;
+
out_unmap:
pte_unmap_unlock(pte, ptl);
- if (ret != SWAP_FAIL && !(flags & TTU_MUNLOCK))
- mmu_notifier_invalidate_page(vma, address, event);
out:
return ret;
--
1.9.1
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next reply other threads:[~2014-07-10 21:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-10 21:53 Oded Gabbay [this message]
2014-07-10 22:15 ` Andrew Morton
2014-07-10 22:22 ` Joerg Roedel
2014-07-10 22:34 ` Hugh Dickins
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=1405029208-6703-1-git-send-email-oded.gabbay@amd.com \
--to=oded.gabbay@gmail.com \
--cc=Andrew.Lewycky@amd.com \
--cc=John.Bridgman@amd.com \
--cc=airlied@linux.ie \
--cc=akpm@linux-foundation.org \
--cc=alexander.deucher@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=gorcunov@openvz.org \
--cc=hughd@google.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=j.glisse@gmail.com \
--cc=jglisse@redhat.com \
--cc=joro@8bytes.org \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=n-horiguchi@ah.jp.nec.com \
--cc=nasa4836@gmail.com \
--cc=oded.gabbay@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