mirror of https://lore.kernel.org/lkml/
 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: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/amdkfd: use vma_lookup() instead of find_vma()
Date: Mon, 17 Oct 2022 15:35:25 -0400	[thread overview]
Message-ID: <a1d36d76-396a-0bf0-26b7-c009fbae5dd0@amd.com> (raw)
In-Reply-To: <20221007024818.4921-1-wangdeming@inspur.com>


On 2022-10-06 22:48, Deming Wang wrote:
> Using vma_lookup() verifies the start address is contained in the found
> vma.  This results in easier to read the code.

Thank you for the patches. This and your other patch look good to me. 
However, you missed one use of find_vma in svm_range_is_valid. Is that 
an oversight or is there a reason why we need to use find_vma there?

If you're going to respin it, you may also squash the two patches into one.

Thanks,
   Felix


>
> Signed-off-by: Deming Wang <wangdeming@inspur.com>
> ---
>   drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> index 64fdf63093a0..cabcc2ca3c23 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> @@ -1586,8 +1586,8 @@ static int svm_range_validate_and_map(struct mm_struct *mm,
>   		unsigned long npages;
>   		bool readonly;
>   
> -		vma = find_vma(mm, addr);
> -		if (!vma || addr < vma->vm_start) {
> +		vma = vma_lookup(mm, addr);
> +		if (!vma) {
>   			r = -EFAULT;
>   			goto unreserve_out;
>   		}
> @@ -2542,8 +2542,8 @@ svm_range_get_range_boundaries(struct kfd_process *p, int64_t addr,
>   	struct interval_tree_node *node;
>   	unsigned long start_limit, end_limit;
>   
> -	vma = find_vma(p->mm, addr << PAGE_SHIFT);
> -	if (!vma || (addr << PAGE_SHIFT) < vma->vm_start) {
> +	vma = vma_lookup(p->mm, addr << PAGE_SHIFT);
> +	if (!vma) {
>   		pr_debug("VMA does not exist in address [0x%llx]\n", addr);
>   		return -EFAULT;
>   	}
> @@ -2871,8 +2871,8 @@ svm_range_restore_pages(struct amdgpu_device *adev, unsigned int pasid,
>   	/* __do_munmap removed VMA, return success as we are handling stale
>   	 * retry fault.
>   	 */
> -	vma = find_vma(mm, addr << PAGE_SHIFT);
> -	if (!vma || (addr << PAGE_SHIFT) < vma->vm_start) {
> +	vma = vma_lookup(mm, addr << PAGE_SHIFT);
> +	if (!vma) {
>   		pr_debug("address 0x%llx VMA is removed\n", addr);
>   		r = 0;
>   		goto out_unlock_range;

  reply	other threads:[~2022-10-17 19:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-07  2:48 Deming Wang
2022-10-17 19:35 ` Felix Kuehling [this message]
2022-10-18  0:47   ` 答复: " tomorrow Wang (王德明)
2022-10-19 14:21     ` Felix Kuehling
  -- strict thread matches above, loose matches on Subject: below --
2022-10-20  8:20 Deming Wang
2022-10-20 16:50 ` Felix Kuehling
2022-10-07  2:26 Deming Wang
2022-10-20 16:47 ` 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=a1d36d76-396a-0bf0-26b7-c009fbae5dd0@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

all inboxes | Powered by JetHome®