All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdkfd: fix add queue process context clear without runtime enable
@ 2023-09-13  1:52 Jonathan Kim
  2023-09-13 14:26 ` Felix Kuehling
  2023-09-14 13:59 ` Eric Huang
  0 siblings, 2 replies; 3+ messages in thread
From: Jonathan Kim @ 2023-09-13  1:52 UTC (permalink / raw)
  To: amd-gfx
  Cc: JinHuiEric.Huang, Ruili.Ji, Felix.Kuehling, Jonathan Kim, Shikai Guo

There are cases where HSA runtime is not enabled through the
AMDKFD_IOC_RUNTIME_ENABLE call when adding queues and the MES ADD_QUEUE
API should clear the MES process context instead of SET_SHADER_DEBUGGER.
Such examples are legacy HSA runtime builds that do not support the
current exception handling and running KFD tests.

The only time ADD_QUEUE.skip_process_ctx_clear is required is for
debugger use cases where a debugged process is always runtime enabled
when adding a queue.

Tested-by: Shikai Guo <shikai.guo@amd.com>
Signed-off-by: Jonathan Kim <jonathan.kim@amd.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
index 6d07a5dd2648..77159b03a422 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
@@ -227,8 +227,10 @@ static int add_queue_mes(struct device_queue_manager *dqm, struct queue *q,
 	queue_input.tba_addr = qpd->tba_addr;
 	queue_input.tma_addr = qpd->tma_addr;
 	queue_input.trap_en = !kfd_dbg_has_cwsr_workaround(q->device);
-	queue_input.skip_process_ctx_clear = qpd->pqm->process->debug_trap_enabled ||
-					     kfd_dbg_has_ttmps_always_setup(q->device);
+	queue_input.skip_process_ctx_clear =
+		qpd->pqm->process->runtime_info.runtime_state == DEBUG_RUNTIME_STATE_ENABLED &&
+						(qpd->pqm->process->debug_trap_enabled ||
+						 kfd_dbg_has_ttmps_always_setup(q->device));
 
 	queue_type = convert_to_mes_queue_type(q->properties.type);
 	if (queue_type < 0) {
-- 
2.34.1


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

* Re: [PATCH] drm/amdkfd: fix add queue process context clear without runtime enable
  2023-09-13  1:52 [PATCH] drm/amdkfd: fix add queue process context clear without runtime enable Jonathan Kim
@ 2023-09-13 14:26 ` Felix Kuehling
  2023-09-14 13:59 ` Eric Huang
  1 sibling, 0 replies; 3+ messages in thread
From: Felix Kuehling @ 2023-09-13 14:26 UTC (permalink / raw)
  To: Jonathan Kim, amd-gfx; +Cc: JinHuiEric.Huang, Ruili.Ji, Shikai.Guo

On 2023-09-12 21:52, Jonathan Kim wrote:
> There are cases where HSA runtime is not enabled through the
> AMDKFD_IOC_RUNTIME_ENABLE call when adding queues and the MES ADD_QUEUE
> API should clear the MES process context instead of SET_SHADER_DEBUGGER.
> Such examples are legacy HSA runtime builds that do not support the
> current exception handling and running KFD tests.
>
> The only time ADD_QUEUE.skip_process_ctx_clear is required is for
> debugger use cases where a debugged process is always runtime enabled
> when adding a queue.
>
> Tested-by: Shikai Guo <shikai.guo@amd.com>
> Signed-off-by: Jonathan Kim <jonathan.kim@amd.com>

Acked-by: Felix Kuehling <Felix.Kuehling@amd.com>


> ---
>   drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> index 6d07a5dd2648..77159b03a422 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> @@ -227,8 +227,10 @@ static int add_queue_mes(struct device_queue_manager *dqm, struct queue *q,
>   	queue_input.tba_addr = qpd->tba_addr;
>   	queue_input.tma_addr = qpd->tma_addr;
>   	queue_input.trap_en = !kfd_dbg_has_cwsr_workaround(q->device);
> -	queue_input.skip_process_ctx_clear = qpd->pqm->process->debug_trap_enabled ||
> -					     kfd_dbg_has_ttmps_always_setup(q->device);
> +	queue_input.skip_process_ctx_clear =
> +		qpd->pqm->process->runtime_info.runtime_state == DEBUG_RUNTIME_STATE_ENABLED &&
> +						(qpd->pqm->process->debug_trap_enabled ||
> +						 kfd_dbg_has_ttmps_always_setup(q->device));
>   
>   	queue_type = convert_to_mes_queue_type(q->properties.type);
>   	if (queue_type < 0) {

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

* Re: [PATCH] drm/amdkfd: fix add queue process context clear without runtime enable
  2023-09-13  1:52 [PATCH] drm/amdkfd: fix add queue process context clear without runtime enable Jonathan Kim
  2023-09-13 14:26 ` Felix Kuehling
@ 2023-09-14 13:59 ` Eric Huang
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Huang @ 2023-09-14 13:59 UTC (permalink / raw)
  To: Jonathan Kim, amd-gfx; +Cc: Ruili.Ji, Felix.Kuehling, Shikai.Guo


On 2023-09-12 21:52, Jonathan Kim wrote:
> There are cases where HSA runtime is not enabled through the
> AMDKFD_IOC_RUNTIME_ENABLE call when adding queues and the MES ADD_QUEUE
> API should clear the MES process context instead of SET_SHADER_DEBUGGER.
> Such examples are legacy HSA runtime builds that do not support the
> current exception handling and running KFD tests.
>
> The only time ADD_QUEUE.skip_process_ctx_clear is required is for
> debugger use cases where a debugged process is always runtime enabled
> when adding a queue.
>
> Tested-by: Shikai Guo <shikai.guo@amd.com>
> Signed-off-by: Jonathan Kim <jonathan.kim@amd.com>
Reviewed-by: Eric Huang <jinhuieric.huang@amd.com>

> ---
>   drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> index 6d07a5dd2648..77159b03a422 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> @@ -227,8 +227,10 @@ static int add_queue_mes(struct device_queue_manager *dqm, struct queue *q,
>   	queue_input.tba_addr = qpd->tba_addr;
>   	queue_input.tma_addr = qpd->tma_addr;
>   	queue_input.trap_en = !kfd_dbg_has_cwsr_workaround(q->device);
> -	queue_input.skip_process_ctx_clear = qpd->pqm->process->debug_trap_enabled ||
> -					     kfd_dbg_has_ttmps_always_setup(q->device);
> +	queue_input.skip_process_ctx_clear =
> +		qpd->pqm->process->runtime_info.runtime_state == DEBUG_RUNTIME_STATE_ENABLED &&
> +						(qpd->pqm->process->debug_trap_enabled ||
> +						 kfd_dbg_has_ttmps_always_setup(q->device));
>   
>   	queue_type = convert_to_mes_queue_type(q->properties.type);
>   	if (queue_type < 0) {


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

end of thread, other threads:[~2023-09-14 13:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-13  1:52 [PATCH] drm/amdkfd: fix add queue process context clear without runtime enable Jonathan Kim
2023-09-13 14:26 ` Felix Kuehling
2023-09-14 13:59 ` Eric Huang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.