AMD General Reviewed-by: Tao Zhou <[email protected]>
> -----Original Message----- > From: Sun, Ce(Overlord) <[email protected]> > Sent: Friday, August 7, 2026 3:03 PM > To: [email protected] > Cc: Zhang, Hawking <[email protected]>; Chai, Thomas > <[email protected]>; Zhou1, Tao <[email protected]>; Yang, Stanley > <[email protected]>; Lazar, Lijo <[email protected]>; Sun, Ce(Overlord) > <[email protected]> > Subject: [PATCH] drm/amdgpu: Prevent RAS injection with lost bus caused by DPC > > When DPC events occur, the GPU bus becomes unavailable and all user-space > operations should be blocked. There is a timing race where rastool may still > send > RAS error injection commands to the driver after bus loss, which leads > unexpected > failures. > > Extend the readiness check in ras debugfs write handler by adding > amdgpu_device_bus_status_check() to detect bus lost state. Print warning and > reject > injection requests to notify user-space the function is inaccessible. > > Signed-off-by: Ce Sun <[email protected]> > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c > index 35eb87591740..4943be034c80 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c > @@ -564,7 +564,7 @@ static ssize_t amdgpu_ras_debugfs_ctrl_write(struct file > *f, > struct ras_debug_if data; > int ret = 0; > > - if (!amdgpu_ras_get_error_query_ready(adev)) { > + if (!amdgpu_ras_get_error_query_ready(adev) || > +amdgpu_device_bus_status_check(adev)) { > dev_warn(adev->dev, "RAS WARN: error injection " > "currently inaccessible\n"); > return size; > -- > 2.34.1
