dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Felix Kuehling <felix.kuehling@amd.com>
To: Deming Wang <wangdeming@inspur.com>,
	airlied@gmail.com, daniel@ffwll.ch, alexander.deucher@amd.com,
	christian.koenig@amd.com, Xinhui.Pan@amd.com
Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/amdkfd: use vma_lookup() instead of find_vma()
Date: Thu, 20 Oct 2022 12:47:28 -0400	[thread overview]
Message-ID: <fcc77463-10e7-7fd4-b675-7adcb13219ed@amd.com> (raw)
In-Reply-To: <20221007022651.4816-1-wangdeming@inspur.com>

Am 2022-10-06 um 22:26 schrieb Deming Wang:
> Using vma_lookup() verifies the start address is contained in the found
> vma.  This results in easier to read the code.
>
> Signed-off-by: Deming Wang <wangdeming@inspur.com>
> ---
>   drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
> index 2797029bd500..3599cc931b0a 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
> @@ -529,8 +529,8 @@ svm_migrate_ram_to_vram(struct svm_range *prange, uint32_t best_loc,
>   	for (addr = start; addr < end;) {
>   		unsigned long next;
>   
> -		vma = find_vma(mm, addr);
> -		if (!vma || addr < vma->vm_start)
> +		vma = vma_lookup(mm, addr);
> +		if (!vma)
>   			break;
>   
>   		next = min(vma->vm_end, end);
> @@ -798,8 +798,8 @@ int svm_migrate_vram_to_ram(struct svm_range *prange, struct mm_struct *mm,
>   	for (addr = start; addr < end;) {
>   		unsigned long next;
>   
> -		vma = find_vma(mm, addr);
> -		if (!vma || addr < vma->vm_start) {
> +		vma = vma_lookup(mm, addr)

There is a semicolon missing here. I will fix this before I submit the 
patch.

Please do at least a minimum amount of due diligence before posting 
patches. That would include a test to make sure your code compiles.

Regards,
   Felix


> +		if (!vma) {
>   			pr_debug("failed to find vma for prange %p\n", prange);
>   			r = -EFAULT;
>   			break;

  reply	other threads:[~2022-10-20 16:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-07  2:26 [PATCH] drm/amdkfd: use vma_lookup() instead of find_vma() Deming Wang
2022-10-20 16:47 ` Felix Kuehling [this message]
2022-10-07  2:48 Deming Wang
2022-10-17 19:35 ` Felix Kuehling
2022-10-20  8:20 Deming Wang
2022-10-20 16:50 ` 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=fcc77463-10e7-7fd4-b675-7adcb13219ed@amd.com \
    --to=felix.kuehling@amd.com \
    --cc=Xinhui.Pan@amd.com \
    --cc=airlied@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wangdeming@inspur.com \
    /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;
as well as URLs for NNTP newsgroup(s).