Skip to contentSkip to conversation

Two HMM patches from MMOTS

PATCH New Kuehling, Felix 1 participant 3 messages May 28, 2019 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Two HMM patches from MMOTS

These are two important HMM bug fixes to fix the HMM-based userptr implementation. They are alread staged in MMOTS:
https://www.ozlabs.org/~akpm/mmots/broken-out/

Kuehling, Felix (1):
mm/hmm.c: only set FAULT_FLAG_ALLOW_RETRY for non-blocking

Philip Yang (1):
mm/hmm.c: support automatic NUMA balancing

 mm/hmm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20190528224419.14124-1-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org

#2 lore raw

PATCH 1/2 mm/hmm.c: support automatic NUMA balancing

From: Philip Yang <[email protected]>

While the page is migrating by NUMA balancing, HMM failed to detect this condition and still return the old page. Application will use the new page migrated, but driver pass the old page physical address to GPU, this crash the application later.

Use pte_protnone(pte) to return this condition and then hmm_vma_do_fault will allocate new page.

---
 mm/hmm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/hmm.c +1 -1
index 0db8491090b8..599d8e82db67 100644
@@ -559,7 +559,7 @@ static int hmm_vma_handle_pmd(struct mm_walk *walk,
 
 static inline uint64_t pte_to_hmm_pfn_flags(struct hmm_range *range, pte_t pte)
 {
-	if (pte_none(pte) || !pte_present(pte))
+	if (pte_none(pte) || !pte_present(pte) || pte_protnone(pte))
 		return 0;
 	return pte_write(pte) ? range->flags[HMM_PFN_VALID] |
 				range->flags[HMM_PFN_WRITE] :
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#3 lore raw

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

In reply to a message not in the archive

From: "Kuehling, Felix" <[email protected]>

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.

---
 mm/hmm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/hmm.c +1 -1
index 599d8e82db67..018cb5c241a6 100644
@@ -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_ALLOW_RETRY | FAULT_FLAG_REMOTE;
+	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;
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx