AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Felix Kuehling <felix.kuehling@amd.com>
To: Yunxiang Li <Yunxiang.Li@amd.com>, amd-gfx@lists.freedesktop.org
Cc: Alexander.Deucher@amd.com, christian.koenig@amd.com
Subject: Re: [PATCH v4 9/9] drm/amdgpu: add lock in kfd_process_dequeue_from_device
Date: Thu, 6 Jun 2024 15:01:47 -0400	[thread overview]
Message-ID: <795fc033-d254-4e19-9d43-c82b606bbb80@amd.com> (raw)
In-Reply-To: <20240605013318.11260-10-Yunxiang.Li@amd.com>


On 2024-06-04 21:33, Yunxiang Li wrote:
> We need to take the reset domain lock before talking to MES. While in
> this case we can take the lock inside the mes helper. We can't do so for
> most other mes helpers since they are used during reset. So for
> consistency sake we add the lock here.
>
> Signed-off-by: Yunxiang Li <Yunxiang.Li@amd.com>

Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>


> ---
>   drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 9 +++++++--
>   1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
> index 86ea610b16f3..21f5a1fb3bf8 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
> @@ -28,6 +28,7 @@
>   #include "kfd_priv.h"
>   #include "kfd_kernel_queue.h"
>   #include "amdgpu_amdkfd.h"
> +#include "amdgpu_reset.h"
>   
>   static inline struct process_queue_node *get_queue_by_qid(
>   			struct process_queue_manager *pqm, unsigned int qid)
> @@ -87,8 +88,12 @@ void kfd_process_dequeue_from_device(struct kfd_process_device *pdd)
>   		return;
>   
>   	dev->dqm->ops.process_termination(dev->dqm, &pdd->qpd);
> -	if (dev->kfd->shared_resources.enable_mes)
> -		amdgpu_mes_flush_shader_debugger(dev->adev, pdd->proc_ctx_gpu_addr);
> +	if (dev->kfd->shared_resources.enable_mes &&
> +	    down_read_trylock(&dev->adev->reset_domain->sem)) {
> +		amdgpu_mes_flush_shader_debugger(dev->adev,
> +						 pdd->proc_ctx_gpu_addr);
> +		up_read(&dev->adev->reset_domain->sem);
> +	}
>   	pdd->already_dequeued = true;
>   }
>   

      reply	other threads:[~2024-06-06 19:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-05  1:33 [PATCH v4 0/9] drm/amdgpu: prevent concurrent GPU access during reset Yunxiang Li
2024-06-05  1:33 ` [PATCH v4 1/9] drm/amdgpu: add skip_hw_access checks for sriov Yunxiang Li
2024-06-05  1:33 ` [PATCH v4 2/9] drm/amdgpu: fix sriov host flr handler Yunxiang Li
2024-06-05  1:33 ` [PATCH v4 3/9] drm/amdgpu/kfd: remove is_hws_hang and is_resetting Yunxiang Li
2024-06-05  1:33 ` [PATCH v4 4/9] drm/amdgpu: remove tlb flush in amdgpu_gtt_mgr_recover Yunxiang Li
2024-06-05  1:33 ` [PATCH v4 5/9] drm/amdgpu: use helper in amdgpu_gart_unbind Yunxiang Li
2024-06-05  1:33 ` [PATCH v4 6/9] drm/amdgpu: call flush_gpu_tlb directly in gfxhub enable Yunxiang Li
2024-06-05  8:00   ` Christian König
2024-06-05  1:33 ` [PATCH v4 7/9] drm/amdgpu: fix locking scope when flushing tlb Yunxiang Li
2024-06-05  1:33 ` [PATCH v4 8/9] drm/amdgpu: add lock in amdgpu_gart_invalidate_tlb Yunxiang Li
2024-06-05  1:33 ` [PATCH v4 9/9] drm/amdgpu: add lock in kfd_process_dequeue_from_device Yunxiang Li
2024-06-06 19:01   ` Felix Kuehling [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=795fc033-d254-4e19-9d43-c82b606bbb80@amd.com \
    --to=felix.kuehling@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Yunxiang.Li@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox