[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c2f277a9-476d-a14c-d619-860508aa4ca0@amd.com>
Date: Wed, 31 Jul 2019 13:13:41 +0000
From: "Kuehling, Felix" <Felix.Kuehling@....com>
To: Christoph Hellwig <hch@....de>,
Jérôme Glisse <jglisse@...hat.com>,
Jason Gunthorpe <jgg@...lanox.com>,
Ben Skeggs <bskeggs@...hat.com>
CC: Ralph Campbell <rcampbell@...dia.com>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"nouveau@...ts.freedesktop.org" <nouveau@...ts.freedesktop.org>,
"dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
"amd-gfx@...ts.freedesktop.org" <amd-gfx@...ts.freedesktop.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 01/13] amdgpu: remove -EAGAIN handling for hmm_range_fault
On 2019-07-30 1:51 a.m., Christoph Hellwig wrote:
> hmm_range_fault can only return -EAGAIN if called with the block
> argument set to false, so remove the special handling for it.
The block argument no longer exists. You replaced that with the
HMM_FAULT_ALLOW_RETRY with opposite logic. So this should read
"hmm_range_fault can only return -EAGAIN if called with the
HMM_FAULT_ALLOW_RETRY flag set, so remove the special handling for it.
With that fixed, this commit is Reviewed-by: Felix Kuehling
<Felix.Kuehling@....com>
>
> Signed-off-by: Christoph Hellwig <hch@....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);
Powered by blists - more mailing lists