All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Lazar, Lijo" <lijo.lazar@amd.com>
To: Alex Deucher <alexander.deucher@amd.com>, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/amdgpu/ctx: only reset stable pstate if the user changed it (v2)
Date: Wed, 11 May 2022 10:12:45 +0530	[thread overview]
Message-ID: <bc1e5968-587e-e128-413d-3b5b841c9975@amd.com> (raw)
In-Reply-To: <20220510143744.622588-1-alexander.deucher@amd.com>



On 5/10/2022 8:07 PM, Alex Deucher wrote:
> Check if the requested stable pstate matches the current one before
> changing it.  This avoids changing the stable pstate on context
> destroy if the user never changed it in the first place via the
> IOCTL.
> 
> v2: compare the current and requested rather than setting a flag (Lijo)
> 
> Fixes: 8cda7a4f96e435 ("drm/amdgpu/UAPI: add new CTX OP to get/set stable pstates")
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>

Thanks,
Lijo

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> index 5981c7d9bd48..94c3a52df131 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> @@ -295,6 +295,7 @@ static int amdgpu_ctx_set_stable_pstate(struct amdgpu_ctx *ctx,
>   {
>   	struct amdgpu_device *adev = ctx->adev;
>   	enum amd_dpm_forced_level level;
> +	u32 current_stable_pstate;
>   	int r;
>   
>   	mutex_lock(&adev->pm.stable_pstate_ctx_lock);
> @@ -303,6 +304,10 @@ static int amdgpu_ctx_set_stable_pstate(struct amdgpu_ctx *ctx,
>   		goto done;
>   	}
>   
> +	r = amdgpu_ctx_get_stable_pstate(ctx, &current_stable_pstate);
> +	if (r || (stable_pstate == current_stable_pstate))
> +		goto done;
> +
>   	switch (stable_pstate) {
>   	case AMDGPU_CTX_STABLE_PSTATE_NONE:
>   		level = AMD_DPM_FORCED_LEVEL_AUTO;
> 

      reply	other threads:[~2022-05-11  4:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-10 14:37 [PATCH] drm/amdgpu/ctx: only reset stable pstate if the user changed it (v2) Alex Deucher
2022-05-11  4:42 ` Lazar, Lijo [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=bc1e5968-587e-e128-413d-3b5b841c9975@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.