In kernel amdgpu driver, kfd_wait_on_events is used to support user space signal event wait function. For multiple threads waiting on same event scenery, race condition could occur since some threads after checking signal condition, before calling kfd_wait_on_events, the event interrupt could be fired and wake up other thread which are sleeping on this event. Then those threads could fall into sleep without waking up again. Adding event age tracking in both kernel and user mode, will help avoiding this race condition. The changes for The user space ROCT-Thunk-Interface/ROCR-Runtime are listed below for review togehter with kernel mode changes. ROCT-Thunk-Interface: https://github.com/RadeonOpenCompute/ROCT-Thunk-Interface/compare/master...zhums:ROCT-Thunk-Interface:new_event_wait_review https://github.com/RadeonOpenCompute/ROCT-Thunk-Interface/commit/efdbf6cfbc026bd68ac3c35d00dacf84370eb81e https://github.com/RadeonOpenCompute/ROCT-Thunk-Interface/commit/1820ae0a2db85b6f584611dc0cde1a00e7c22915 ROCR-Runtime: https://github.com/RadeonOpenCompute/ROCR-Runtime/compare/master...zhums:ROCR-Runtime:new_event_wait_review https://github.com/RadeonOpenCompute/ROCR-Runtime/commit/e1f5bdb88eb882ac798aeca2c00ea3fbb2dba459 https://github.com/RadeonOpenCompute/ROCR-Runtime/commit/7d26afd14107b5c2a754c1a3f415d89f3aabb503 James Zhu (3): drm/amdkfd: add event age tracking drm/amdkfd: add event_age tracking when receiving interrupt drm/amdkfd: don't sleep when event age unmatch drivers/gpu/drm/amd/amdkfd/kfd_events.c | 21 +++++++++++++++++++++ drivers/gpu/drm/amd/amdkfd/kfd_events.h | 1 + include/uapi/linux/kfd_ioctl.h | 13 +++++++++++-- 3 files changed, 33 insertions(+), 2 deletions(-) -- 2.34.1