mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	drm/amdgpu: Make use of drm_wedge_task_info
To notify userspace about which task (if any) made the device get in a wedge state, make use of drm_wedge_task_info parameter, filling it with the task PID and name. Reviewed-by: Christian König <christian.koenig@amd.com> Link: https://lore.kernel.org/r/20250617124949.2151549-7-andrealmeid@igalia.com Signed-off-by: André Almeida <andrealmeid@igalia.com>
This commit is contained in:
		
							parent
							
								
									35dc4ce200
								
							
						
					
					
						commit
						a72002cb18
					
				
					 2 changed files with 16 additions and 4 deletions
				
			
		| 
						 | 
					@ -6363,8 +6363,17 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	atomic_set(&adev->reset_domain->reset_res, r);
 | 
						atomic_set(&adev->reset_domain->reset_res, r);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!r)
 | 
						if (!r) {
 | 
				
			||||||
		drm_dev_wedged_event(adev_to_drm(adev), DRM_WEDGE_RECOVERY_NONE, NULL);
 | 
							struct amdgpu_task_info *ti = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (job)
 | 
				
			||||||
 | 
								ti = amdgpu_vm_get_task_info_pasid(adev, job->pasid);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							drm_dev_wedged_event(adev_to_drm(adev), DRM_WEDGE_RECOVERY_NONE,
 | 
				
			||||||
 | 
									     ti ? &ti->task : NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							amdgpu_vm_put_task_info(ti);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return r;
 | 
						return r;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -89,6 +89,7 @@ static enum drm_gpu_sched_stat amdgpu_job_timedout(struct drm_sched_job *s_job)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct amdgpu_ring *ring = to_amdgpu_ring(s_job->sched);
 | 
						struct amdgpu_ring *ring = to_amdgpu_ring(s_job->sched);
 | 
				
			||||||
	struct amdgpu_job *job = to_amdgpu_job(s_job);
 | 
						struct amdgpu_job *job = to_amdgpu_job(s_job);
 | 
				
			||||||
 | 
						struct drm_wedge_task_info *info = NULL;
 | 
				
			||||||
	struct amdgpu_task_info *ti;
 | 
						struct amdgpu_task_info *ti;
 | 
				
			||||||
	struct amdgpu_device *adev = ring->adev;
 | 
						struct amdgpu_device *adev = ring->adev;
 | 
				
			||||||
	int idx;
 | 
						int idx;
 | 
				
			||||||
| 
						 | 
					@ -125,7 +126,7 @@ static enum drm_gpu_sched_stat amdgpu_job_timedout(struct drm_sched_job *s_job)
 | 
				
			||||||
	ti = amdgpu_vm_get_task_info_pasid(ring->adev, job->pasid);
 | 
						ti = amdgpu_vm_get_task_info_pasid(ring->adev, job->pasid);
 | 
				
			||||||
	if (ti) {
 | 
						if (ti) {
 | 
				
			||||||
		amdgpu_vm_print_task_info(adev, ti);
 | 
							amdgpu_vm_print_task_info(adev, ti);
 | 
				
			||||||
		amdgpu_vm_put_task_info(ti);
 | 
							info = &ti->task;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* attempt a per ring reset */
 | 
						/* attempt a per ring reset */
 | 
				
			||||||
| 
						 | 
					@ -164,13 +165,15 @@ static enum drm_gpu_sched_stat amdgpu_job_timedout(struct drm_sched_job *s_job)
 | 
				
			||||||
			if (amdgpu_ring_sched_ready(ring))
 | 
								if (amdgpu_ring_sched_ready(ring))
 | 
				
			||||||
				drm_sched_start(&ring->sched, 0);
 | 
									drm_sched_start(&ring->sched, 0);
 | 
				
			||||||
			dev_err(adev->dev, "Ring %s reset succeeded\n", ring->sched.name);
 | 
								dev_err(adev->dev, "Ring %s reset succeeded\n", ring->sched.name);
 | 
				
			||||||
			drm_dev_wedged_event(adev_to_drm(adev), DRM_WEDGE_RECOVERY_NONE, NULL);
 | 
								drm_dev_wedged_event(adev_to_drm(adev), DRM_WEDGE_RECOVERY_NONE, info);
 | 
				
			||||||
			goto exit;
 | 
								goto exit;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		dev_err(adev->dev, "Ring %s reset failure\n", ring->sched.name);
 | 
							dev_err(adev->dev, "Ring %s reset failure\n", ring->sched.name);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	dma_fence_set_error(&s_job->s_fence->finished, -ETIME);
 | 
						dma_fence_set_error(&s_job->s_fence->finished, -ETIME);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						amdgpu_vm_put_task_info(ti);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (amdgpu_device_should_recover_gpu(ring->adev)) {
 | 
						if (amdgpu_device_should_recover_gpu(ring->adev)) {
 | 
				
			||||||
		struct amdgpu_reset_context reset_context;
 | 
							struct amdgpu_reset_context reset_context;
 | 
				
			||||||
		memset(&reset_context, 0, sizeof(reset_context));
 | 
							memset(&reset_context, 0, sizeof(reset_context));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue