All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Paneer Selvam, Arunpravin" <arunpravin.paneerselvam@amd.com>
To: Alex Deucher <alexander.deucher@amd.com>, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/amdgpu: store userq_managers in a list in adev
Date: Fri, 21 Mar 2025 22:57:03 +0530	[thread overview]
Message-ID: <d705924e-7ec1-4690-9745-a7646caa1c05@amd.com> (raw)
In-Reply-To: <20250320165249.1238463-1-alexander.deucher@amd.com>

Hi Alex,

I requested the tester to reproduce the suspend/resume hang issue with 
this patch series.
I will update as soon as I get the results.

Thanks,
Arun.

On 3/20/2025 10:22 PM, Alex Deucher wrote:
> So we can iterate across them when we need to manage
> all user queues.
>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu.h           |  3 +++
>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c    |  3 +++
>   drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c | 15 ++++++++++++++-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.h |  1 +
>   4 files changed, 21 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index 4f770a362048a..28cfa600b798f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -1228,6 +1228,9 @@ struct amdgpu_device {
>   	 * in KFD: VRAM or GTT.
>   	 */
>   	bool                            apu_prefer_gtt;
> +
> +	struct list_head		userq_mgr_list;
> +	struct mutex                    userq_mutex;
>   };
>   
>   static inline uint32_t amdgpu_ip_version(const struct amdgpu_device *adev,
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 0396ac30c2a4f..526c5aa32825a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -4299,6 +4299,7 @@ int amdgpu_device_init(struct amdgpu_device *adev,
>   	mutex_init(&adev->gfx.kfd_sch_mutex);
>   	mutex_init(&adev->gfx.workload_profile_mutex);
>   	mutex_init(&adev->vcn.workload_profile_mutex);
> +	mutex_init(&adev->userq_mutex);
>   
>   	amdgpu_device_init_apu_flags(adev);
>   
> @@ -4326,6 +4327,8 @@ int amdgpu_device_init(struct amdgpu_device *adev,
>   
>   	INIT_LIST_HEAD(&adev->pm.od_kobj_list);
>   
> +	INIT_LIST_HEAD(&adev->userq_mgr_list);
> +
>   	INIT_DELAYED_WORK(&adev->delayed_init_work,
>   			  amdgpu_device_delayed_init_work_handler);
>   	INIT_DELAYED_WORK(&adev->gfx.gfx_off_delay_work,
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c
> index a02614cbda36e..b89bfad52abd5 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c
> @@ -365,6 +365,9 @@ amdgpu_userqueue_create(struct drm_file *filp, union drm_amdgpu_userq *args)
>   		goto unlock;
>   	}
>   	args->out.queue_id = qid;
> +	mutex_lock(&adev->userq_mutex);
> +	list_add(&uq_mgr->list, &adev->userq_mgr_list);
> +	mutex_unlock(&adev->userq_mutex);
>   
>   unlock:
>   	mutex_unlock(&uq_mgr->userq_mutex);
> @@ -661,14 +664,24 @@ int amdgpu_userq_mgr_init(struct amdgpu_userq_mgr *userq_mgr, struct amdgpu_devi
>   
>   void amdgpu_userq_mgr_fini(struct amdgpu_userq_mgr *userq_mgr)
>   {
> -	uint32_t queue_id;
> +	struct amdgpu_device *adev = userq_mgr->adev;
>   	struct amdgpu_usermode_queue *queue;
> +	struct amdgpu_userq_mgr *uqm, *tmp;
> +	uint32_t queue_id;
>   
>   	cancel_delayed_work(&userq_mgr->resume_work);
>   
>   	mutex_lock(&userq_mgr->userq_mutex);
>   	idr_for_each_entry(&userq_mgr->userq_idr, queue, queue_id)
>   		amdgpu_userqueue_cleanup(userq_mgr, queue, queue_id);
> +	mutex_lock(&adev->userq_mutex);
> +	list_for_each_entry_safe(uqm, tmp, &adev->userq_mgr_list, list) {
> +		if (uqm == userq_mgr) {
> +			list_del(&uqm->list);
> +			break;
> +		}
> +	}
> +	mutex_unlock(&adev->userq_mutex);
>   	idr_destroy(&userq_mgr->userq_idr);
>   	mutex_unlock(&userq_mgr->userq_mutex);
>   	mutex_destroy(&userq_mgr->userq_mutex);
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.h
> index 0f358f77f2d9b..ec1a4ca6f6321 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.h
> @@ -76,6 +76,7 @@ struct amdgpu_userq_mgr {
>   	struct mutex			userq_mutex;
>   	struct amdgpu_device		*adev;
>   	struct delayed_work		resume_work;
> +	struct list_head		list;
>   };
>   
>   struct amdgpu_db_info {


  parent reply	other threads:[~2025-03-21 17:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-20 16:52 [PATCH 1/2] drm/amdgpu: store userq_managers in a list in adev Alex Deucher
2025-03-20 16:52 ` [PATCH 2/2] drm/amdgpu/userq: prevent runtime pm when userqs are active Alex Deucher
2025-04-04 10:50   ` Paneer Selvam, Arunpravin
2025-03-21 17:27 ` Paneer Selvam, Arunpravin [this message]
2025-03-25  8:13 ` [PATCH 1/2] drm/amdgpu: store userq_managers in a list in adev Liang, Prike
2025-03-25 15:34   ` Alex Deucher

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=d705924e-7ec1-4690-9745-a7646caa1c05@amd.com \
    --to=arunpravin.paneerselvam@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    /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 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.