From: Davidlohr Bueso <dave@xxxxxxxxxxxx> This becomes quite straightforward with the mmrange in place. Signed-off-by: Davidlohr Bueso <dbueso@xxxxxxx> --- drivers/iommu/amd_iommu_v2.c | 4 ++-- drivers/iommu/intel-svm.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/amd_iommu_v2.c b/drivers/iommu/amd_iommu_v2.c index 15a7103fd84c..d3aee158d251 100644 --- a/drivers/iommu/amd_iommu_v2.c +++ b/drivers/iommu/amd_iommu_v2.c @@ -523,7 +523,7 @@ static void do_fault(struct work_struct *work) flags |= FAULT_FLAG_WRITE; flags |= FAULT_FLAG_REMOTE; - down_read(&mm->mmap_sem); + mm_read_lock(mm, &mmrange); vma = find_extend_vma(mm, address, &mmrange); if (!vma || address < vma->vm_start) /* failed to get a vma in the right range */ @@ -535,7 +535,7 @@ static void do_fault(struct work_struct *work) ret = handle_mm_fault(vma, address, flags, &mmrange); out: - up_read(&mm->mmap_sem); + mm_read_unlock(mm, &mmrange); if (ret & VM_FAULT_ERROR) /* failed to service fault */ diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c index 6a74386ee83f..c4d0d2398052 100644 --- a/drivers/iommu/intel-svm.c +++ b/drivers/iommu/intel-svm.c @@ -643,7 +643,7 @@ static irqreturn_t prq_event_thread(int irq, void *d) if (!is_canonical_address(address)) goto bad_req; - down_read(&svm->mm->mmap_sem); + mm_read_lock(svm->mm, &mmrange); vma = find_extend_vma(svm->mm, address, &mmrange); if (!vma || address < vma->vm_start) goto invalid; @@ -658,7 +658,7 @@ static irqreturn_t prq_event_thread(int irq, void *d) result = QI_RESP_SUCCESS; invalid: - up_read(&svm->mm->mmap_sem); + mm_read_unlock(svm->mm, &mmrange); mmput(svm->mm); bad_req: /* Accounting for major/minor faults? */ -- 2.13.6 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>