From: "Lazar, Lijo" <lijo.lazar@amd.com>
To: Alex Deucher <alexander.deucher@amd.com>, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/amdgpu/gfx: adjust workload profile handling
Date: Fri, 14 Mar 2025 20:13:41 +0530 [thread overview]
Message-ID: <bc45f314-3720-49c3-a836-b409f8b89595@amd.com> (raw)
In-Reply-To: <20250314134707.3012124-1-alexander.deucher@amd.com>
On 3/14/2025 7:17 PM, Alex Deucher wrote:
> No need to make the workload profile setup dependent
> on the results of cancelling the delayed work thread.
> We have all of the necessary checking in place for the
> workload profile reference counting, so separate the
> two. As it is now, we can theoretically end up with
> the call from begin_use happening while the worker
> thread is executing which would result in the profile
> not getting set for that submission. It should not
> affect the reference counting.
>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 22 +++++++++++-----------
> 1 file changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> index 099329d15b9ff..20424f8c4925f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> @@ -2188,18 +2188,18 @@ void amdgpu_gfx_profile_ring_begin_use(struct amdgpu_ring *ring)
>
> atomic_inc(&adev->gfx.total_submission_cnt);
>
> - if (!cancel_delayed_work_sync(&adev->gfx.idle_work)) {
> - mutex_lock(&adev->gfx.workload_profile_mutex);
> - if (!adev->gfx.workload_profile_active) {
> - r = amdgpu_dpm_switch_power_profile(adev, profile, true);
> - if (r)
> - dev_warn(adev->dev, "(%d) failed to disable %s power profile mode\n", r,
> - profile == PP_SMC_POWER_PROFILE_FULLSCREEN3D ?
> - "fullscreen 3D" : "compute");
> - adev->gfx.workload_profile_active = true;
> - }
> - mutex_unlock(&adev->gfx.workload_profile_mutex);
> + cancel_delayed_work_sync(&adev->gfx.idle_work);
> +
To avoid locking/unlocking mutex for each begin_use, I think here we
could do like
if (adev->gfx.workload_profile_active)
return;
Thanks,
Lijo
> + mutex_lock(&adev->gfx.workload_profile_mutex);
> + if (!adev->gfx.workload_profile_active) {
> + r = amdgpu_dpm_switch_power_profile(adev, profile, true);
> + if (r)
> + dev_warn(adev->dev, "(%d) failed to disable %s power profile mode\n", r,
> + profile == PP_SMC_POWER_PROFILE_FULLSCREEN3D ?
> + "fullscreen 3D" : "compute");
> + adev->gfx.workload_profile_active = true;
> }
> + mutex_unlock(&adev->gfx.workload_profile_mutex);
> }
>
> void amdgpu_gfx_profile_ring_end_use(struct amdgpu_ring *ring)
next prev parent reply other threads:[~2025-03-14 14:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-14 13:47 [PATCH 1/2] drm/amdgpu/gfx: adjust workload profile handling Alex Deucher
2025-03-14 13:47 ` [PATCH 2/2] drm/amdgpu/vcn: " Alex Deucher
2025-03-14 14:43 ` Lazar, Lijo [this message]
2025-03-14 14:58 ` [PATCH 1/2] drm/amdgpu/gfx: " Alex Deucher
2025-03-14 15:03 ` Lazar, Lijo
-- strict thread matches above, loose matches on Subject: below --
2025-03-14 18:45 Alex Deucher
2025-03-17 8:16 ` Lazar, Lijo
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=bc45f314-3720-49c3-a836-b409f8b89595@amd.com \
--to=lijo.lazar@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.