amd/amdkfd: sync all devices to wait all processes being evicted
Subsystems (3)
PATCH 1/2 amd/amdkfd: sync all devices to wait all processes being evicted
If there are more than one device doing reset in parallel, the first device will call kfd_suspend_all_processes() to evict all processes on all devices, this call takes time to finish. other device will start reset and recover without waiting. if the process has not been evicted before doing recover, it will be restored, then caused page fault.
Signed-off-by Zhigang Luo <[email protected]>
--- drivers/gpu/drm/amd/amdkfd/kfd_device.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device.c +5 -10
@@ -960,7 +960,6 @@ void kgd2kfd_suspend(struct kfd_dev *kfd, bool run_pm) {struct kfd_node *node;int i; -int count;if (!kfd->init_complete)return ;
@@ -968,12 +967,10 @@ void kgd2kfd_suspend(struct kfd_dev *kfd, bool run_pm)/* for runtime suspend, skip locking kfd */ if (!run_pm) {mutex_lock (&kfd_processes_mutex); - count = ++kfd_locked; -mutex_unlock (&kfd_processes_mutex); -/* For first KFD device suspend all the KFD processes */ -if (count ==1 ) +if (++kfd_locked ==1 )kfd_suspend_all_processes (); +mutex_unlock (&kfd_processes_mutex); }for (i =0 ; i < kfd->num_nodes; i++) {
@@ -984,7 +981,7 @@ void kgd2kfd_suspend(struct kfd_dev *kfd, bool run_pm)int kgd2kfd_resume (struct kfd_dev *kfd,bool run_pm) { -int ret, count, i; +int ret, i;if (!kfd->init_complete)return 0 ;
@@ -998,12 +995,10 @@ int kgd2kfd_resume(struct kfd_dev *kfd, bool run_pm)/* for runtime resume, skip unlocking kfd */ if (!run_pm) {mutex_lock (&kfd_processes_mutex); - count = --kfd_locked; -mutex_unlock (&kfd_processes_mutex); -WARN_ONCE (count <0 ,"KFD suspend / resume ref. error" ); -if (count ==0 ) +if (--kfd_locked ==0 ) ret =kfd_resume_all_processes (); +mutex_unlock (&kfd_processes_mutex); }return ret;
Signature · 1 line
2.25.1
PATCH 2/2 amd/amdgpu: improve VF recover time
1. change AMDGPU_VF2PF_UPDATE_MAX_RETRY_LIMIT from 30 to 5.
2. set fatel error detected flag.
Signed-off-by Zhigang Luo <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
@@ -4982,6 +4982,7 @@ static int amdgpu_device_reset_sriov(struct amdgpu_device *adev, r =amdgpu_virt_reset_gpu (adev);if (r)return r; +amdgpu_ras_set_fed (adev, false);amdgpu_irq_gpu_reset_resume_helper (adev);/* some sw clean up VF needs to do before recover */
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +1 -0
@@ -593,6 +593,7 @@ static void amdgpu_virt_update_vf2pf_work_item(struct work_struct *work) adev->virt.vf2pf_update_retry_cnt++;if ((adev->virt.vf2pf_update_retry_cnt >=AMDGPU_VF2PF_UPDATE_MAX_RETRY_LIMIT ) &&amdgpu_sriov_runtime (adev) && !amdgpu_in_reset (adev)) { +amdgpu_ras_set_fed (adev, true);if (amdgpu_reset_domain_schedule (adev->reset_domain, &adev->virt.flr_work))return ;
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +1 -1
@@ -52,7 +52,7 @@/* tonga/fiji use this offset */ #define mmBIF_IOV_FUNC_IDENTIFIER 0x1503 -#define AMDGPU_VF2PF_UPDATE_MAX_RETRY_LIMIT 30 +#define AMDGPU_VF2PF_UPDATE_MAX_RETRY_LIMIT 5enum amdgpu_sriov_vf_mode {SRIOV_VF_MODE_BARE_METAL =0 ,
Signature · 1 line
2.25.1