AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Felix Kuehling <felix.kuehling@amd.com>
To: amd-gfx@lists.freedesktop.org, Philip Yang <Philip.Yang@amd.com>
Subject: Re: [PATCH] drm/amdkfd: SVM map to gpus check vma boundary
Date: Thu, 16 Sep 2021 16:40:29 -0400	[thread overview]
Message-ID: <061f931c-197f-2230-aa3d-bbf8acf8999d@amd.com> (raw)
In-Reply-To: <20210913201100.27146-1-Philip.Yang@amd.com>

On 2021-09-13 4:11 p.m., Philip Yang wrote:
> SVM range may includes multiple VMAs with different vm_flags, if prange
> page index is the last page of the VMA offset + npages, update GPU
> mapping to create GPU page table with same VMA access permission.
>
> Signed-off-by: Philip Yang <Philip.Yang@amd.com>
> ---
>   drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> index 110c46cd7fac..2e3ee9c46a10 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> @@ -1178,7 +1178,9 @@ svm_range_map_to_gpu(struct amdgpu_device *adev, struct amdgpu_vm *vm,
>   	for (i = offset; i < offset + npages; i++) {
>   		last_domain = dma_addr[i] & SVM_RANGE_VRAM_DOMAIN;
>   		dma_addr[i] &= ~SVM_RANGE_VRAM_DOMAIN;
> +
>   		if ((prange->start + i) < prange->last &&
> +		    i + 1 < offset + npages &&

I think this would be more intuitive: "i < offset + npages - 1" (meaning 
i is before the last page in the range)

Do we still need the the "(prange->start + i) < prange->last" condition 
at all now? I think it could just be replaced with "i < offset + npages 
- 1".

Regards,
   Felix


>   		    last_domain == (dma_addr[i + 1] & SVM_RANGE_VRAM_DOMAIN))
>   			continue;
>   

  reply	other threads:[~2021-09-16 20:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-13 20:11 [PATCH] drm/amdkfd: SVM map to gpus check vma boundary Philip Yang
2021-09-16 20:40 ` Felix Kuehling [this message]
2021-09-16 21:11 ` [PATCH v2] " Philip Yang
2021-09-16 21:37   ` Felix Kuehling

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=061f931c-197f-2230-aa3d-bbf8acf8999d@amd.com \
    --to=felix.kuehling@amd.com \
    --cc=Philip.Yang@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox