AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Felix Kuehling <felix.kuehling@amd.com>
To: Philip Yang <Philip.Yang@amd.com>, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 2/2] drm/amdkfd: heavy-weight flush TLB after unmap
Date: Thu, 13 May 2021 13:18:25 -0400	[thread overview]
Message-ID: <73fbb397-e325-e912-f363-4ed82ae99c15@amd.com> (raw)
In-Reply-To: <20210513165855.16395-2-Philip.Yang@amd.com>

Am 2021-05-13 um 12:58 p.m. schrieb Philip Yang:
> Need do a heavy-weight TLB flush to make sure we have no more dirty data
> in the cache for the unmapped pages.
>
> Add flush_type parameter to amdgpu_amdkfd_flush_gpu_tlb_pasid.
>
> Signed-off-by: Philip Yang <Philip.Yang@amd.com>

The series is

Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>


> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 4 ++--
>  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 3 ++-
>  drivers/gpu/drm/amd/amdkfd/kfd_process.c   | 2 +-
>  drivers/gpu/drm/amd/amdkfd/kfd_svm.c       | 4 ++--
>  4 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
> index 5f6696a3c778..0be9a6695b2e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
> @@ -670,10 +670,10 @@ int amdgpu_amdkfd_flush_gpu_tlb_vmid(struct kgd_dev *kgd, uint16_t vmid)
>  	return 0;
>  }
>  
> -int amdgpu_amdkfd_flush_gpu_tlb_pasid(struct kgd_dev *kgd, uint16_t pasid)
> +int amdgpu_amdkfd_flush_gpu_tlb_pasid(struct kgd_dev *kgd, uint16_t pasid,
> +				      uint32_t flush_type)
>  {
>  	struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
> -	const uint32_t flush_type = 0;
>  	bool all_hub = false;
>  
>  	if (adev->family == AMDGPU_FAMILY_AI)
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
> index 313ee49b9f17..e8ce851c6f29 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
> @@ -135,7 +135,8 @@ int amdgpu_amdkfd_submit_ib(struct kgd_dev *kgd, enum kgd_engine_type engine,
>  void amdgpu_amdkfd_set_compute_idle(struct kgd_dev *kgd, bool idle);
>  bool amdgpu_amdkfd_have_atomics_support(struct kgd_dev *kgd);
>  int amdgpu_amdkfd_flush_gpu_tlb_vmid(struct kgd_dev *kgd, uint16_t vmid);
> -int amdgpu_amdkfd_flush_gpu_tlb_pasid(struct kgd_dev *kgd, uint16_t pasid);
> +int amdgpu_amdkfd_flush_gpu_tlb_pasid(struct kgd_dev *kgd, uint16_t pasid,
> +				      uint32_t flush_type);
>  
>  bool amdgpu_amdkfd_is_kfd_vmid(struct amdgpu_device *adev, u32 vmid);
>  
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> index 9d4f527bda7c..1d8a593edd3f 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> @@ -1853,7 +1853,7 @@ void kfd_flush_tlb(struct kfd_process_device *pdd)
>  							pdd->qpd.vmid);
>  	} else {
>  		amdgpu_amdkfd_flush_gpu_tlb_pasid(dev->kgd,
> -						pdd->process->pasid);
> +						pdd->process->pasid, 0);
>  	}
>  }
>  
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> index 50da0d1fb9c1..e57a8e405efd 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> @@ -1125,7 +1125,7 @@ svm_range_unmap_from_gpus(struct svm_range *prange, unsigned long start,
>  				break;
>  		}
>  		amdgpu_amdkfd_flush_gpu_tlb_pasid((struct kgd_dev *)adev,
> -						  p->pasid);
> +						  p->pasid, 2);
>  	}
>  
>  	return r;
> @@ -1182,7 +1182,7 @@ svm_range_map_to_gpu(struct amdgpu_device *adev, struct amdgpu_vm *vm,
>  
>  		p = container_of(prange->svms, struct kfd_process, svms);
>  		amdgpu_amdkfd_flush_gpu_tlb_pasid((struct kgd_dev *)adev,
> -						  p->pasid);
> +						  p->pasid, 0);
>  	}
>  out:
>  	prange->mapping.bo_va = NULL;
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  reply	other threads:[~2021-05-13 17:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-13 16:58 [PATCH 1/2] Revert "drm/amdkfd: flush TLB after updating GPU page table" Philip Yang
2021-05-13 16:58 ` [PATCH 2/2] drm/amdkfd: heavy-weight flush TLB after unmap Philip Yang
2021-05-13 17:18   ` Felix Kuehling [this message]
2021-05-14  7:24   ` Christian König
2021-05-14 14:42   ` [PATCH v2 " Philip Yang
2021-05-14 15:14     ` Christian König
2021-05-14 16:12       ` 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=73fbb397-e325-e912-f363-4ed82ae99c15@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