All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] drm/amdkfd: Handle drain retry fault race with XNACK mode change
@ 2022-04-08  1:21 Philip Yang
  2022-04-08  2:51 ` Felix Kuehling
  0 siblings, 1 reply; 2+ messages in thread
From: Philip Yang @ 2022-04-08  1:21 UTC (permalink / raw)
  To: amd-gfx; +Cc: Philip Yang, Felix.Kuehling

Application could change XNACK enabled to disabled while KFD is draining
stall retry fault, the check for whether to drain retry faults must be
before the check for whether xnack_enabled, to avoid report incorrect vm
fault after application changes XNACK mode.

Signed-off-by: Philip Yang <Philip.Yang@amd.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
index d011d620dfe7..c76d29a22e9d 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
@@ -2700,11 +2700,6 @@ svm_range_restore_pages(struct amdgpu_device *adev, unsigned int pasid,
 		pr_debug("kfd process not founded pasid 0x%x\n", pasid);
 		return 0;
 	}
-	if (!p->xnack_enabled) {
-		pr_debug("XNACK not enabled for pasid 0x%x\n", pasid);
-		r = -EFAULT;
-		goto out;
-	}
 	svms = &p->svms;
 
 	pr_debug("restoring svms 0x%p fault address 0x%llx\n", svms, addr);
@@ -2715,6 +2710,12 @@ svm_range_restore_pages(struct amdgpu_device *adev, unsigned int pasid,
 		goto out;
 	}
 
+	if (!p->xnack_enabled) {
+		pr_debug("XNACK not enabled for pasid 0x%x\n", pasid);
+		r = -EFAULT;
+		goto out;
+	}
+
 	/* p->lead_thread is available as kfd_process_wq_release flush the work
 	 * before releasing task ref.
 	 */
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] drm/amdkfd: Handle drain retry fault race with XNACK mode change
  2022-04-08  1:21 [PATCH 1/1] drm/amdkfd: Handle drain retry fault race with XNACK mode change Philip Yang
@ 2022-04-08  2:51 ` Felix Kuehling
  0 siblings, 0 replies; 2+ messages in thread
From: Felix Kuehling @ 2022-04-08  2:51 UTC (permalink / raw)
  To: Philip Yang, amd-gfx

Am 2022-04-07 um 21:21 schrieb Philip Yang:
> Application could change XNACK enabled to disabled while KFD is draining
> stall retry fault, the check for whether to drain retry faults must be

typo: stall -> stale

I think there is also a word missing, linking the two sentences. Maybe 
"... stale retry faults, therefore the check ..."  With that fixed, the 
patch is

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


> before the check for whether xnack_enabled, to avoid report incorrect vm
> fault after application changes XNACK mode.
>
> Signed-off-by: Philip Yang <Philip.Yang@amd.com>
> ---
>   drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 11 ++++++-----
>   1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> index d011d620dfe7..c76d29a22e9d 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> @@ -2700,11 +2700,6 @@ svm_range_restore_pages(struct amdgpu_device *adev, unsigned int pasid,
>   		pr_debug("kfd process not founded pasid 0x%x\n", pasid);
>   		return 0;
>   	}
> -	if (!p->xnack_enabled) {
> -		pr_debug("XNACK not enabled for pasid 0x%x\n", pasid);
> -		r = -EFAULT;
> -		goto out;
> -	}
>   	svms = &p->svms;
>   
>   	pr_debug("restoring svms 0x%p fault address 0x%llx\n", svms, addr);
> @@ -2715,6 +2710,12 @@ svm_range_restore_pages(struct amdgpu_device *adev, unsigned int pasid,
>   		goto out;
>   	}
>   
> +	if (!p->xnack_enabled) {
> +		pr_debug("XNACK not enabled for pasid 0x%x\n", pasid);
> +		r = -EFAULT;
> +		goto out;
> +	}
> +
>   	/* p->lead_thread is available as kfd_process_wq_release flush the work
>   	 * before releasing task ref.
>   	 */

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-08  2:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-08  1:21 [PATCH 1/1] drm/amdkfd: Handle drain retry fault race with XNACK mode change Philip Yang
2022-04-08  2:51 ` Felix Kuehling

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.