Received: by 10.223.176.5 with SMTP id f5csp1988969wra; Sun, 4 Feb 2018 17:33:06 -0800 (PST) X-Google-Smtp-Source: AH8x224wE6oNFRlbpvTPkK4RLGDuBncrmAYUIKgH854/4OkrRD+rMovqw0XMSJPoieMGA/3uG1Wz X-Received: by 10.99.128.73 with SMTP id j70mr4566971pgd.37.1517794386601; Sun, 04 Feb 2018 17:33:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517794386; cv=none; d=google.com; s=arc-20160816; b=MNVHo3yiOsuIEUGs1BZoVpJGXje7lLGolhXKr9OOpJVt4uIMnNX6yqBwAz48uG3qU2 2KBROPQnC7x1kQOLUVsKrtFT4sHZlsBjbDAwuGzR6dkdU/7jWqmjbhI6KKg5Rz1c4pHP eks5kp0R2U06osDPr7ERH8frOvgtEvHgedpaO3GZ6vShGkij1PFtmNTGwzj6EWZzGUtj DG3XpCoYU628bFC42qyELKJ49ELRloW0ehXQyCAxj9B24USJLtpF631Rw6HN0ZWOTdXN mkGpefczekTXQ8rBXipclmFr/QEKa7k7Ownf9xB1CEJe7MNwspXzbOOwMFjx+PsXQL0G nGiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=CcV4OeCIVN9xBbRhWSunsQhJWTIOEhSME4Jx4n7fVKE=; b=k+u5tribfQLwfQDep2jGPlAn5Ad099bNTfHffr65LFJyr9GXrdkkOnqJLAToHMiI6U Z391/yA0ss+uSOow8JdvnJBksGYUxH6q5EpPjmO4EnPit6KGqDy8iWvP66W8fMmL/8SZ kb3WNzIILd+gfLcCODnzw5ES+7LnwpZQm13/uRggC43mz9mi2omMHbJBSEwDZ7eGJTAF tKQCZxjEyYFXr6p3a37qEXbB0IStMi8FcRw4/23aDce+ukEQxRox05jkRZp1Sduyn5Cv Tns7hX/2/379lM7aVJRBOeXnvt7zv+bvUd2LkUTIYK0La9piXRc5W9JPKE/LkC0S3Wwk ptnA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c80si6043199pfb.182.2018.02.04.17.32.52; Sun, 04 Feb 2018 17:33:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752256AbeBEBcL (ORCPT + 99 others); Sun, 4 Feb 2018 20:32:11 -0500 Received: from mx2.suse.de ([195.135.220.15]:43468 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752315AbeBEB32 (ORCPT ); Sun, 4 Feb 2018 20:29:28 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id CD0EAAE25; Mon, 5 Feb 2018 01:28:01 +0000 (UTC) From: Davidlohr Bueso To: akpm@linux-foundation.org, mingo@kernel.org Cc: peterz@infradead.org, ldufour@linux.vnet.ibm.com, jack@suse.cz, mhocko@kernel.org, kirill.shutemov@linux.intel.com, mawilcox@microsoft.com, mgorman@techsingularity.net, dave@stgolabs.net, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Davidlohr Bueso Subject: [PATCH 59/64] drivers/iommu: use mm locking helpers Date: Mon, 5 Feb 2018 02:27:49 +0100 Message-Id: <20180205012754.23615-60-dbueso@wotan.suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180205012754.23615-1-dbueso@wotan.suse.de> References: <20180205012754.23615-1-dbueso@wotan.suse.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Davidlohr Bueso This becomes quite straightforward with the mmrange in place. Signed-off-by: Davidlohr Bueso --- 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