All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: "Jérôme Glisse" <jglisse@redhat.com>,
	"Jason Gunthorpe" <jgg@mellanox.com>,
	"Ben Skeggs" <bskeggs@redhat.com>,
	"Felix Kuehling" <Felix.Kuehling@amd.com>
Cc: Ralph Campbell <rcampbell@nvidia.com>,
	linux-mm@kvack.org, nouveau@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 01/13] amdgpu: remove -EAGAIN handling for hmm_range_fault
Date: Tue, 30 Jul 2019 08:51:51 +0300	[thread overview]
Message-ID: <20190730055203.28467-2-hch@lst.de> (raw)
In-Reply-To: <20190730055203.28467-1-hch@lst.de>

hmm_range_fault can only return -EAGAIN if called with the block
argument set to false, so remove the special handling for it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 23 +++--------------------
 1 file changed, 3 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 12a59ac83f72..f0821638bbc6 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -778,7 +778,6 @@ int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo *bo, struct page **pages)
 	struct hmm_range *range;
 	unsigned long i;
 	uint64_t *pfns;
-	int retry = 0;
 	int r = 0;
 
 	if (!mm) /* Happens during process shutdown */
@@ -822,7 +821,6 @@ int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo *bo, struct page **pages)
 	hmm_range_register(range, mirror, start,
 			   start + ttm->num_pages * PAGE_SIZE, PAGE_SHIFT);
 
-retry:
 	/*
 	 * Just wait for range to be valid, safe to ignore return value as we
 	 * will use the return value of hmm_range_fault() below under the
@@ -831,24 +829,12 @@ int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo *bo, struct page **pages)
 	hmm_range_wait_until_valid(range, HMM_RANGE_DEFAULT_TIMEOUT);
 
 	down_read(&mm->mmap_sem);
-
 	r = hmm_range_fault(range, 0);
-	if (unlikely(r < 0)) {
-		if (likely(r == -EAGAIN)) {
-			/*
-			 * return -EAGAIN, mmap_sem is dropped
-			 */
-			if (retry++ < MAX_RETRY_HMM_RANGE_FAULT)
-				goto retry;
-			else
-				pr_err("Retry hmm fault too many times\n");
-		}
-
-		goto out_up_read;
-	}
-
 	up_read(&mm->mmap_sem);
 
+	if (unlikely(r < 0))
+		goto out_free_pfns;
+
 	for (i = 0; i < ttm->num_pages; i++) {
 		pages[i] = hmm_device_entry_to_page(range, pfns[i]);
 		if (unlikely(!pages[i])) {
@@ -864,9 +850,6 @@ int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo *bo, struct page **pages)
 
 	return 0;
 
-out_up_read:
-	if (likely(r != -EAGAIN))
-		up_read(&mm->mmap_sem);
 out_free_pfns:
 	hmm_range_unregister(range);
 	kvfree(pfns);
-- 
2.20.1


  reply	other threads:[~2019-07-30  5:52 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-30  5:51 hmm_range_fault related fixes and legacy API removal v3 Christoph Hellwig
2019-07-30  5:51 ` Christoph Hellwig [this message]
2019-07-30 12:33   ` [PATCH 01/13] amdgpu: remove -EAGAIN handling for hmm_range_fault Jason Gunthorpe
2019-07-31 13:13   ` Kuehling, Felix
2019-07-30  5:51 ` [PATCH 02/13] amdgpu: don't initialize range->list in amdgpu_hmm_init_range Christoph Hellwig
2019-07-30  5:51 ` [PATCH 03/13] nouveau: pass struct nouveau_svmm to nouveau_range_fault Christoph Hellwig
2019-07-30  5:51 ` [PATCH 04/13] mm: remove the pgmap field from struct hmm_vma_walk Christoph Hellwig
2019-07-30  5:51 ` [PATCH 05/13] mm: remove the unused vma argument to hmm_range_dma_unmap Christoph Hellwig
2019-07-30  5:51 ` [PATCH 06/13] mm: remove superflous arguments from hmm_range_register Christoph Hellwig
2019-07-30 17:51   ` Jason Gunthorpe
     [not found]   ` <20190730055203.28467-7-hch-jcswGhMUV9g@public.gmane.org>
2019-07-31 13:31     ` Kuehling, Felix
2019-07-31 13:31   ` Kuehling, Felix
     [not found] ` <20190730055203.28467-1-hch-jcswGhMUV9g@public.gmane.org>
2019-07-30  5:51   ` [PATCH 02/13] amdgpu: don't initialize range->list in amdgpu_hmm_init_range Christoph Hellwig
2019-07-30 12:33     ` Jason Gunthorpe
     [not found]     ` <20190730055203.28467-3-hch-jcswGhMUV9g@public.gmane.org>
2019-07-30 12:33       ` Jason Gunthorpe
2019-07-31 13:25     ` Kuehling, Felix
     [not found]       ` <a4586f5c-0ae4-8cbd-65ff-dfe70d34f99b-5C7GfCeVMHo@public.gmane.org>
2019-07-31 17:02         ` Jason Gunthorpe
2019-07-31 17:02       ` Jason Gunthorpe
2019-07-30  5:51   ` [PATCH 03/13] nouveau: pass struct nouveau_svmm to nouveau_range_fault Christoph Hellwig
2019-07-30 12:35     ` Jason Gunthorpe
2019-07-30 13:10       ` Christoph Hellwig
2019-07-30 13:14         ` Jason Gunthorpe
2019-07-30 14:40           ` Christoph Hellwig
2019-07-30  5:51   ` [PATCH 04/13] mm: remove the pgmap field from struct hmm_vma_walk Christoph Hellwig
2019-07-30  5:51   ` [PATCH 05/13] mm: remove the unused vma argument to hmm_range_dma_unmap Christoph Hellwig
2019-07-30 12:45     ` Jason Gunthorpe
2019-07-30  5:51   ` [PATCH 07/13] mm: remove the page_shift member from struct hmm_range Christoph Hellwig
2019-07-30 12:55     ` Jason Gunthorpe
2019-07-30 13:14       ` Christoph Hellwig
2019-07-30 17:50         ` Jason Gunthorpe
2019-08-01  6:49           ` Christoph Hellwig
2019-07-31 13:38     ` Kuehling, Felix
2019-07-30  5:51   ` [PATCH 08/13] mm: remove the mask variable in hmm_vma_walk_hugetlb_entry Christoph Hellwig
2019-07-30 17:39     ` Jason Gunthorpe
2019-07-31  1:01     ` Ralph Campbell
     [not found]     ` <20190730055203.28467-9-hch-jcswGhMUV9g@public.gmane.org>
2019-07-30 17:39       ` Jason Gunthorpe
2019-07-31  1:01       ` Ralph Campbell
2019-07-30  5:51   ` [PATCH 09/13] mm: don't abuse pte_index() in hmm_vma_handle_pmd Christoph Hellwig
2019-07-30  5:52   ` [PATCH 10/13] mm: only define hmm_vma_walk_pud if needed Christoph Hellwig
2019-07-30 18:02     ` Jason Gunthorpe
2019-07-30  5:52   ` [PATCH 11/13] mm: cleanup the hmm_vma_handle_pmd stub Christoph Hellwig
2019-07-30 17:53     ` Jason Gunthorpe
     [not found]     ` <20190730055203.28467-12-hch-jcswGhMUV9g@public.gmane.org>
2019-07-30 17:53       ` Jason Gunthorpe
2019-08-01  7:01         ` Christoph Hellwig
2019-07-30  5:52   ` [PATCH 12/13] mm: cleanup the hmm_vma_walk_hugetlb_entry stub Christoph Hellwig
2019-07-30 18:02     ` Jason Gunthorpe
2019-07-30  5:52   ` [PATCH 13/13] mm: allow HMM_MIRROR on all architectures with MMU Christoph Hellwig
2019-07-30 18:03     ` Jason Gunthorpe
2019-07-30 18:04       ` Jason Gunthorpe
2019-08-01  7:04         ` Christoph Hellwig
     [not found]         ` <20190730180452.GS24038-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2019-08-01  7:04           ` Christoph Hellwig
2019-07-30  5:51 ` [PATCH 07/13] mm: remove the page_shift member from struct hmm_range Christoph Hellwig
2019-07-30  5:51 ` [PATCH 08/13] mm: remove the mask variable in hmm_vma_walk_hugetlb_entry Christoph Hellwig
2019-07-30  5:51 ` [PATCH 09/13] mm: don't abuse pte_index() in hmm_vma_handle_pmd Christoph Hellwig
2019-07-30  5:52 ` [PATCH 10/13] mm: only define hmm_vma_walk_pud if needed Christoph Hellwig
2019-07-30  5:52 ` [PATCH 11/13] mm: cleanup the hmm_vma_handle_pmd stub Christoph Hellwig
2019-07-30  5:52 ` [PATCH 12/13] mm: cleanup the hmm_vma_walk_hugetlb_entry stub Christoph Hellwig
2019-07-30  5:52 ` [PATCH 13/13] mm: allow HMM_MIRROR on all architectures with MMU Christoph Hellwig

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=20190730055203.28467-2-hch@lst.de \
    --to=hch@lst.de \
    --cc=Felix.Kuehling@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=bskeggs@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jgg@mellanox.com \
    --cc=jglisse@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nouveau@lists.freedesktop.org \
    --cc=rcampbell@nvidia.com \
    --subject='Re: [PATCH 01/13] amdgpu: remove -EAGAIN handling for hmm_range_fault' \
    /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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.