drm/amdkfd: Adding delay after sending the Exception event to runtime
Subsystems (3)
PATCH 1/1 drm/amdkfd: Adding delay after sending the Exception event to runtime
The patch adds the sleep to yield for the runtime to act on the EXCEPTION event. This allows the runtime/app to execute actions on signal reception before driver gets a chance to move ahead with the sequence.
--- drivers/gpu/drm/amd/amdkfd/kfd_events.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_events.c +7 -0
@@ -1329,6 +1329,13 @@ void kfd_signal_reset_event(struct kfd_node *dev) }rcu_read_unlock (); + +/* +* Since the set_event is asynchronous, putting a delay +* to give runtime sometime to act on the EXCEPTION before +* driver moves ahead. +*/ +ssleep (2 ); }srcu_read_unlock (&kfd_processes_srcu, idx); }
Signature · 1 line
2.34.1
Felix Kuehling
maintainerQuoted 15 lines · Ahmad Rehman
The patch adds the sleep to yield for the runtime to act on the EXCEPTION event. This allows the runtime/app to execute actions on signal reception before driver gets a chance to move ahead with the sequence.
Signed-off-by Ahmad Rehman <[email protected]>--- drivers/gpu/drm/amd/amdkfd/kfd_events.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/gpu/drm/amd/amdkfd/kfd_events.c +0
-0
drivers/gpu/drm/amd/amdkfd/kfd_events.c void kfd_signal_reset_event(struct kfd_node *dev) · line 1338
Quoted 10 lines
drivers/gpu/drm/amd/amdkfd/kfd_events.c +7
-0@@ -1329,6 +1329,13 @@ void kfd_signal_reset_event(struct kfd_node *dev) }rcu_read_unlock (); + +/* +* Since the set_event is asynchronous, putting a delay +* to give runtime sometime to act on the EXCEPTION before +* driver moves ahead. +*/ +ssleep (2 );
This adds a 2s sleep inside a loop that iterates over all processes using KFD. If you have multiple KFD processes running, that could add up to a significant delay.
I also don't like waiting before the srcu_read_unlock, because that would block other threads synchronizing with the kfd_processes_srcu (mostly kfd_process_notifier_release).
What exactly is it that you want to prevent "moving on" to here?
Regards,
Felix
Quoted 3 lines
drivers/gpu/drm/amd/amdkfd/kfd_events.c +0
-0}srcu_read_unlock (&kfd_processes_srcu, idx); }