[PATCH] drm/amdgpu: schedule GPU reset event work function

Andrey Grodzovsky andrey.grodzovsky at amd.com
Thu Mar 10 15:22:44 UTC 2022


Reviewed-by: Andrey Grodzovsky <andrey.grodzovsky at amd.com>

Andrey

On 2022-03-10 04:07, Somalapuram Amaranath wrote:
> Schedule work function with valid PID, process name and
> vram lost status during a GPU reset/recovery.
>
> Signed-off-by: Somalapuram Amaranath <Amaranath.Somalapuram at amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 13 +++++++++++++
>   1 file changed, 13 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 02843479e1ef..7ca4f52e393f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -4805,6 +4805,19 @@ int amdgpu_do_asic_reset(struct list_head *device_list_handle,
>   					goto out;
>   
>   				vram_lost = amdgpu_device_check_vram_lost(tmp_adev);
> +				if (reset_context->job && reset_context->job->vm) {
> +					tmp_adev->reset_event_info.pid =
> +						reset_context->job->vm->task_info.pid;
> +					memset(tmp_adev->reset_event_info.pname, 0, TASK_COMM_LEN);
> +					strcpy(tmp_adev->reset_event_info.pname,
> +						reset_context->job->vm->task_info.process_name);
> +				} else {
> +					tmp_adev->reset_event_info.pid = 0;
> +					memset(tmp_adev->reset_event_info.pname, 0, TASK_COMM_LEN);
> +				}
> +
> +				tmp_adev->reset_event_info.flags = vram_lost;
> +				schedule_work(&tmp_adev->gpu_reset_event_work);
>   				if (vram_lost) {
>   					DRM_INFO("VRAM is lost due to GPU reset!\n");
>   					amdgpu_inc_vram_lost(tmp_adev);


More information about the amd-gfx mailing list