drm/amdkfd: Fix signal reset event
Subsystems (3)
PATCH 1/1 drm/amdkfd: Fix signal reset event
When a mode reset happens, driver needs to notify the process on that GPU a reset event is happening. The existing code assumes the process is using the GPU that is getting mode reset, which is not always true. For example, on a 8G system, the process may be only using GPU 0~4 but a mode 2 reset is resetting the all 8 GPUs connected by XGMI. Trying to find a process on GPU 5~7 will fail, which is fine and should skip the event signal.
--- drivers/gpu/drm/amd/amdkfd/kfd_events.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_events.c +8 -9
@@ -1164,6 +1164,8 @@ void kfd_signal_reset_event(struct kfd_node *dev)struct kfd_event *ev;unsigned int temp;uint32_t id, idx; +int user_gpu_id; +struct kfd_process_device *pdd;int reset_cause =atomic_read (&dev->sram_ecc_flag) ?KFD_HW_EXCEPTION_ECC :KFD_HW_EXCEPTION_GPU_HANG ;
@@ -1179,17 +1181,14 @@ void kfd_signal_reset_event(struct kfd_node *dev) idx =srcu_read_lock (&kfd_processes_srcu);hash_for_each_rcu (kfd_processes_table, temp, p, kfd_processes) { -int user_gpu_id =kfd_process_get_user_gpu_id (p, dev->id); -struct kfd_process_device *pdd =kfd_get_process_device_data (dev, p); - -if (unlikely (user_gpu_id == -EINVAL )) { -WARN_ONCE (1 ,"Could not get user_gpu_id from dev->id:%x\n" , dev->id); + pdd =kfd_get_process_device_data (dev, p); +if (!pdd) +/* no process is using this device */ continue ; - } + user_gpu_id =kfd_process_get_user_gpu_id (p, dev->id); -if (unlikely (!pdd)) { -WARN_ONCE (1 ,"Could not get device data from process pid:%d\n" , - p->lead_thread->pid); +if (unlikely (user_gpu_id == -EINVAL )) { +WARN_ONCE (1 ,"Could not get user_gpu_id from dev->id:%d\n" , dev->id);continue ; }
Signature · 1 line
2.43.0
AMD General
Quoted 65 lines
-----Original Message-----
From: Lin, Amber <[email protected]>
Sent: Tuesday, July 28, 2026 2:26 PM
To: [email protected]; Yat Sin, David <[email protected]>; Huang, JinHuiEric <[email protected]>
Cc: Lin, Amber <[email protected]>
Subject: [PATCH] drm/amdkfd: Fix signal reset eventWhen a mode reset happens, driver needs to notify the process on that GPU a reset event is happening. The existing code assumes the process is using the GPU that is getting mode reset, which is not always true. For example, on a 8G system, the process may be only using GPU 0~4 but a mode 2 reset is resetting the all 8 GPUs connected by XGMI. Trying to find a process on GPU 5~7 will fail, which is fine and should skip the event signal.
Signed-off-by Amber Lin <[email protected]>--- drivers/gpu/drm/amd/amdkfd/kfd_events.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_events.c +8
-9@@ -1164,6 +1164,8 @@ void kfd_signal_reset_event(struct kfd_node *dev)struct kfd_event *ev;unsigned int temp;uint32_t id, idx; +int user_gpu_id; +struct kfd_process_device *pdd;int reset_cause =atomic_read (&dev->sram_ecc_flag) ?KFD_HW_EXCEPTION_ECC :KFD_HW_EXCEPTION_GPU_HANG ;@@ -1179,17 +1181,14 @@ void kfd_signal_reset_event(struct kfd_node *dev) idx =srcu_read_lock (&kfd_processes_srcu);hash_for_each_rcu (kfd_processes_table, temp, p, kfd_processes) { -int user_gpu_id =kfd_process_get_user_gpu_id (p, dev->id); -struct kfd_process_device *pdd =kfd_get_process_device_data (dev, p); - -if (unlikely (user_gpu_id == -EINVAL )) { - WARN_ONCE(1, "Could not get user_gpu_id from dev- >id:%x\n", dev->id); + pdd = kfd_get_process_device_data(dev, p); +if (!pdd) +/* no process is using this device */ continue ; - } + user_gpu_id =kfd_process_get_user_gpu_id (p, dev->id); - if (unlikely(!pdd)) { - WARN_ONCE(1, "Could not get device data from process pid:%d\n", - p->lead_thread->pid); + if (unlikely(user_gpu_id == -EINVAL)) { + WARN_ONCE(1, "Could not get user_gpu_id from dev-Quoted 1 line
id:%d\n",
+dev->id); continue; }--
2.43.0