On 12-Jun-26 11:22 AM, Srinivasan Shanmugam wrote:
Signal GPU_RESET EVENTFD subscriptions from the GPU recovery path.

The GPU recovery flow already determines when a device reset has
completed successfully. Use that point to wake up matching EVENTFD
subscribers.


It seems beneficial to send an event before and after the reset, rather than only on successful completion of a reset.

GPU_RESET is a device-scoped event, so no queue object is used.  All
processes that subscribed to GPU_RESET on the device are notified.

EVENTFD remains notification-only.

Cc: Alex Deucher <[email protected]>
Cc: Christian König <[email protected]>
Signed-off-by: Srinivasan Shanmugam <[email protected]>
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 30 +++++++++++++++++++++-
  1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index e46cdd6ecd42..8f28716912c7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -5694,6 +5694,32 @@ static int amdgpu_device_asic_reset(struct amdgpu_device 
*adev,
        return r;
  }
+/*
+ * Signal GPU_RESET EVENTFD subscriptions for all open DRM files.
+ *
+ * GPU reset is a device-wide event rather than being associated with a
+ * specific user queue. Notify every process that subscribed to the
+ * GPU_RESET event on this device.
+ */
+static void amdgpu_device_eventfd_signal_gpu_reset(struct amdgpu_device *adev)
+{
+       struct drm_device *ddev = adev_to_drm(adev);
+       struct drm_file *file;
+
+       mutex_lock(&ddev->filelist_mutex);
+
+       list_for_each_entry(file, &ddev->filelist, lhead) {
+               struct amdgpu_fpriv *fpriv = file->driver_priv;
+
+               if (fpriv)
+                       amdgpu_eventfd_signal(&fpriv->eventfd_mgr,
+                                             DRM_AMDGPU_EVENT_TYPE_GPU_RESET,
+                                             NULL);
+       }
+
+       mutex_unlock(&ddev->filelist_mutex);
+}
+
  static int amdgpu_device_sched_resume(struct list_head *device_list,
                              struct amdgpu_reset_context *reset_context,
                              bool   job_signaled)
@@ -5738,6 +5764,9 @@ static int amdgpu_device_sched_resume(struct list_head 
*device_list,
                } else {
                        dev_info(tmp_adev->dev, "GPU reset(%d) succeeded!\n",
                                 atomic_read(&tmp_adev->gpu_reset_counter));
+
+                       amdgpu_device_eventfd_signal_gpu_reset(tmp_adev);
+

This is actually a misleading place. This is also taken for reset-skip path where there is no real reset. The logic to not show reset related messages with skip flag passed in reset_context is a TODO.

Thanks,
Lijo

                        if (amdgpu_acpi_smart_shift_update(tmp_adev,
                                                           AMDGPU_SS_DEV_D0))
                                dev_warn(tmp_adev->dev,
@@ -5775,7 +5804,6 @@ static void amdgpu_device_gpu_resume(struct amdgpu_device 
*adev,
        }
  }
-
  /**
   * amdgpu_device_gpu_recover - reset the asic and recover scheduler
   *

Reply via email to