AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdkfd: Adding delay after sending the Exception event to runtime
@ 2025-10-17 18:33 Ahmad Rehman
  2025-10-17 21:58 ` Felix Kuehling
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Rehman @ 2025-10-17 18:33 UTC (permalink / raw)
  To: amd-gfx; +Cc: Lijo.Lazar, philip.yang, 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 <Ahmad.Rehman@amd.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_events.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_events.c b/drivers/gpu/drm/amd/amdkfd/kfd_events.c
index 82905f3e54dd..8dfb796fd506 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_events.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_events.c
@@ -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);
 }
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/amdkfd: Adding delay after sending the Exception event to runtime
  2025-10-17 18:33 [PATCH] drm/amdkfd: Adding delay after sending the Exception event to runtime Ahmad Rehman
@ 2025-10-17 21:58 ` Felix Kuehling
  0 siblings, 0 replies; 2+ messages in thread
From: Felix Kuehling @ 2025-10-17 21:58 UTC (permalink / raw)
  To: Ahmad Rehman, amd-gfx; +Cc: Lijo.Lazar, philip.yang

On 2025-10-17 14:33, Ahmad Rehman wrote:
> 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 <Ahmad.Rehman@amd.com>
> ---
>   drivers/gpu/drm/amd/amdkfd/kfd_events.c | 7 +++++++
>   1 file changed, 7 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_events.c b/drivers/gpu/drm/amd/amdkfd/kfd_events.c
> index 82905f3e54dd..8dfb796fd506 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_events.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_events.c
> @@ -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


>   	}
>   	srcu_read_unlock(&kfd_processes_srcu, idx);
>   }

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-10-17 21:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-17 18:33 [PATCH] drm/amdkfd: Adding delay after sending the Exception event to runtime Ahmad Rehman
2025-10-17 21:58 ` Felix Kuehling

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox