Skip to content

Commit de84484

Browse files
PhilipYangAalexdeucher
authored andcommitted
drm/amdkfd: Improve signal event slow path
If event slot is not signaled, kfd_signal_event_interrupt goes to slow path to scan all event slots to find the signaled event, this is needed for old ASICs that don't have the event ID or the event IDs are incorrect in the IH payload. There is case that GPU signal the same event twice, then driver process the first event interrupt, set_event and event slot is auto-reset, then for the second event interrupt, KFD goes to slow path as event is not signaled, just drop the second event interrupt because the application only need wakeup once. Signed-off-by: Philip Yang <[email protected]> Reviewed-by: Felix Kuehling <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 34db5a3 commit de84484

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

drivers/gpu/drm/amd/amdkfd/kfd_events.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,16 @@ void kfd_signal_event_interrupt(u32 pasid, uint32_t partial_id,
748748
uint64_t *slots = page_slots(p->signal_page);
749749
uint32_t id;
750750

751+
/*
752+
* If id is valid but slot is not signaled, GPU may signal the same event twice
753+
* before driver have chance to process the first interrupt, then signal slot is
754+
* auto-reset after set_event wakeup the user space, just drop the second event as
755+
* the application only need wakeup once.
756+
*/
757+
if ((valid_id_bits > 31 || (1U << valid_id_bits) >= KFD_SIGNAL_EVENT_LIMIT) &&
758+
partial_id < KFD_SIGNAL_EVENT_LIMIT && slots[partial_id] == UNSIGNALED_EVENT_SLOT)
759+
goto out_unlock;
760+
751761
if (valid_id_bits)
752762
pr_debug_ratelimited("Partial ID invalid: %u (%u valid bits)\n",
753763
partial_id, valid_id_bits);
@@ -776,6 +786,7 @@ void kfd_signal_event_interrupt(u32 pasid, uint32_t partial_id,
776786
}
777787
}
778788

789+
out_unlock:
779790
rcu_read_unlock();
780791
kfd_unref_process(p);
781792
}

0 commit comments

Comments
 (0)