Skip to contentSkip to conversation

drm/amd/amdgpu: fix the kfd pre_reset sequence in sriov

PATCH In review shaoyunl 2 participants 4 messages Nov 5, 2021

Subsystems (2)
lore
Share & tools
lore

shaoyunl

author
#0 lore raw

PATCH 1/1 drm/amd/amdgpu: fix the kfd pre_reset sequence in sriov

The KFD pre_reset should be called before reset been executed, it will hold the lock to prevent other rocm process to sent the packlage to hiq during host execute the real reset on the HW

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -4
index 95fec36e385e..d7c9dce17cad 100644
@@ -4278,8 +4278,6 @@ static int amdgpu_device_reset_sriov(struct amdgpu_device *adev,
 	if (r)
 		return r;
 
-	amdgpu_amdkfd_pre_reset(adev);
-
 	/* Resume IP prior to SMC */
 	r = amdgpu_device_ip_reinit_early_sriov(adev);
 	if (r)
@@ -5015,8 +5013,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
 
 		cancel_delayed_work_sync(&tmp_adev->delayed_init_work);
 
-		if (!amdgpu_sriov_vf(tmp_adev))
-			amdgpu_amdkfd_pre_reset(tmp_adev);
+		amdgpu_amdkfd_pre_reset(tmp_adev);
 
 		/*
 		 * Mark these ASICs to be reseted as untracked first
Signature · 1 line
2.17.1
#1 lore raw

There was a reason why pre_reset was done differently on SRIOV. However, the code has changed a lot since then. Is this concern still valid?

Quoted 6 lines

commit 7b184b006185215daf4e911f8de212964c99a514
Author: wentalou <[email protected]>
Date:   Fri Dec 7 13:53:18 2018 +0800

    drm/amdgpu: kfd_pre_reset outside req_full_gpu cause sriov hang

Quoted 7 lines

    XGMI hive put kfd_pre_reset into amdgpu_device_lock_adev, but outside req_full_gpu of sriov.
    It would make sriov hang during reset.

Regards,
  Felix

Quoted 32 lines · shaoyunl

The KFD pre_reset should be called before reset been executed, it will hold the lock to prevent other rocm process to sent the packlage to hiq during host execute the real reset on the HW

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +----
  1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -4
index 95fec36e385e..d7c9dce17cad 100644
@@ -4278,8 +4278,6 @@ static int amdgpu_device_reset_sriov(struct amdgpu_device *adev,
  	if (r)
  		return r;
 
-	amdgpu_amdkfd_pre_reset(adev);
-
  	/* Resume IP prior to SMC */
  	r = amdgpu_device_ip_reinit_early_sriov(adev);
  	if (r)
@@ -5015,8 +5013,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
 
  		cancel_delayed_work_sync(&tmp_adev->delayed_init_work);
 
-		if (!amdgpu_sriov_vf(tmp_adev))
-			amdgpu_amdkfd_pre_reset(tmp_adev);
+		amdgpu_amdkfd_pre_reset(tmp_adev);
 
  		/*
  		 * Mark these ASICs to be reseted as untracked first
#2 lore raw

[AMD Official Use Only]

Ye, a lot already been changed since then , now the pre_reset and post_reset not in the lock/unlock anymore. With my previous change , we make kfd_pre_reset avoid touch HW . Now it's pure SW handling , should be safe to be moved out of the full access . Anyway, thanks to bring this up, it will remind us to verify on the XGMI configuration on SRIOV.

Regards
shaoyun.liu

-----Original Message-----
From: Kuehling, Felix <[email protected]>
Sent: Friday, November 5, 2021 1:48 PM
To: Liu, Shaoyun <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amd/amdgpu: fix the kfd pre_reset sequence in sriov

There was a reason why pre_reset was done differently on SRIOV. However, the code has changed a lot since then. Is this concern still valid?

Quoted 6 lines

commit 7b184b006185215daf4e911f8de212964c99a514
Author: wentalou <[email protected]>
Date:   Fri Dec 7 13:53:18 2018 +0800

    drm/amdgpu: kfd_pre_reset outside req_full_gpu cause sriov hang

Quoted 7 lines

    XGMI hive put kfd_pre_reset into amdgpu_device_lock_adev, but outside req_full_gpu of sriov.
    It would make sriov hang during reset.

Regards,
  Felix

Quoted 34 lines · shaoyunl

The KFD pre_reset should be called before reset been executed, it will hold the lock to prevent other rocm process to sent the packlage to hiq during host execute the real reset on the HW

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +----
  1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -4
index 95fec36e385e..d7c9dce17cad 100644
@@ -4278,8 +4278,6 @@ static int amdgpu_device_reset_sriov(struct amdgpu_device *adev,
  	if (r)
  		return r;
 
-	amdgpu_amdkfd_pre_reset(adev);
-
  	/* Resume IP prior to SMC */
  	r = amdgpu_device_ip_reinit_early_sriov(adev);
  	if (r)
@@ -5015,8 +5013,7 @@ int amdgpu_device_gpu_recover(struct 
 amdgpu_device *adev,
 
  		cancel_delayed_work_sync(&tmp_adev->delayed_init_work);
 
-		if (!amdgpu_sriov_vf(tmp_adev))
-			amdgpu_amdkfd_pre_reset(tmp_adev);
+		amdgpu_amdkfd_pre_reset(tmp_adev);
 
  		/*

* Mark these ASICs to be reseted as untracked first

Reviewed-by
#3 lore raw
Quoted 4 lines · Shaoyun

[AMD Official Use Only]

Ye, a lot already been changed since then , now the pre_reset and post_reset not in the lock/unlock anymore. With my previous change , we make kfd_pre_reset avoid touch HW . Now it's pure SW handling , should be safe to be moved out of the full access . Anyway, thanks to bring this up, it will remind us to verify on the XGMI configuration on SRIOV.

OK. Assuming it doesn't break in your testing, consider the patch

Quoted 64 lines

Regards
shaoyun.liu

-----Original Message-----
From: Kuehling, Felix <[email protected]>
Sent: Friday, November 5, 2021 1:48 PM
To: Liu, Shaoyun <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amd/amdgpu: fix the kfd pre_reset sequence in sriov

There was a reason why pre_reset was done differently on SRIOV. However, the code has changed a lot since then. Is this concern still valid?

Quoted 6 lines

commit 7b184b006185215daf4e911f8de212964c99a514
Author: wentalou <[email protected]>
Date:   Fri Dec 7 13:53:18 2018 +0800

    drm/amdgpu: kfd_pre_reset outside req_full_gpu cause sriov hang

Quoted 7 lines

    XGMI hive put kfd_pre_reset into amdgpu_device_lock_adev, but outside req_full_gpu of sriov.
    It would make sriov hang during reset.

Regards,
  Felix

Quoted 34 lines · shaoyunl

The KFD pre_reset should be called before reset been executed, it will hold the lock to prevent other rocm process to sent the packlage to hiq during host execute the real reset on the HW

---
   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +----
   1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -4
index 95fec36e385e..d7c9dce17cad 100644
@@ -4278,8 +4278,6 @@ static int amdgpu_device_reset_sriov(struct amdgpu_device *adev,
   	if (r)
   		return r;
 
-	amdgpu_amdkfd_pre_reset(adev);
-
   	/* Resume IP prior to SMC */
   	r = amdgpu_device_ip_reinit_early_sriov(adev);
   	if (r)
@@ -5015,8 +5013,7 @@ int amdgpu_device_gpu_recover(struct
 amdgpu_device *adev,
 
   		cancel_delayed_work_sync(&tmp_adev->delayed_init_work);
 
-		if (!amdgpu_sriov_vf(tmp_adev))
-			amdgpu_amdkfd_pre_reset(tmp_adev);
+		amdgpu_amdkfd_pre_reset(tmp_adev);
 
   		/*

* Mark these ASICs to be reseted as untracked first