[PATCH 2/2] mm/hmm.c: only set FAULT_FLAG_ALLOW_RETRY for non-blocking

Kuehling, Felix Felix.Kuehling at amd.com
Tue May 28 22:44:36 UTC 2019

From: "Kuehling, Felix" <Felix.Kuehling at amd.com>

Don't set this flag by default in hmm_vma_do_fault. It is set
conditionally just a few lines below. Setting it unconditionally
can lead to handle_mm_fault doing a non-blocking fault, returning
-EBUSY and unlocking mmap_sem unexpectedly.

Link: http://lkml.kernel.org/r/20190510195258.9930-3-Felix.Kuehling@amd.com
Signed-off-by: Felix Kuehling <Felix.Kuehling at amd.com>
Reviewed-by: Jérôme Glisse <jglisse at redhat.com>
Cc: Alex Deucher <alex.deucher at amd.com>
Cc: Dave Airlie <airlied at gmail.com>
Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
 mm/hmm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/hmm.c b/mm/hmm.c
index 599d8e82db67..018cb5c241a6 100644
--- a/mm/hmm.c
+++ b/mm/hmm.c
@@ -339,7 +339,7 @@ struct hmm_vma_walk {
 static int hmm_vma_do_fault(struct mm_walk *walk, unsigned long addr,
 			    bool write_fault, uint64_t *pfn)
+	unsigned int flags = FAULT_FLAG_REMOTE;
 	struct hmm_vma_walk *hmm_vma_walk = walk->private;
 	struct hmm_range *range = hmm_vma_walk->range;
 	struct vm_area_struct *vma = walk->vma;

More information about the amd-gfx mailing list