All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] drm/amdgpu: fix pstate setting issue
       [not found] <20221018101222.32477-1-Jack.Gui@amd.com>
@ 2022-10-18 13:34 ` Deucher, Alexander
  0 siblings, 0 replies; only message in thread
From: Deucher, Alexander @ 2022-10-18 13:34 UTC (permalink / raw)
  To: Gui, Jack, amd-gfx, Zhang, Hawking; +Cc: Nie, Tobyn

[-- Attachment #1: Type: text/plain, Size: 1960 bytes --]

[AMD Official Use Only - General]

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
________________________________
From: Chengming Gui <Jack.Gui@amd.com>
Sent: Tuesday, October 18, 2022 6:12 AM
To: amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>; Deucher, Alexander <Alexander.Deucher@amd.com>; Zhang, Hawking <Hawking.Zhang@amd.com>
Cc: Nie, Tobyn <Tobyn.Nie@amd.com>; Gui, Jack <Jack.Gui@amd.com>
Subject: [PATCH] drm/amdgpu: fix pstate setting issue

[WHY]
0, original pstate X
1, ctx_A_create -> ctx_A->stable_pstate = X
2, ctx_A_set_pstate (Y) -> current pstate is Y (PEAK or STANDARD)
3, ctx_B_create -> ctx_B->stable_pstate =  Y
4, ctx_A_destroy -> restore pstate to X
5, ctx_B_destroy -> restore pstate to Y
Above sequence will cause final pstate is wrong (Y), should be original X.

[HOW]
When ctx_B create,
if  ctx_A touched pstate setting
(not auto, stable_pstate_ctx != NULL),
set ctx_B->stable_pstate the same value as ctx_A saved,
if stable_pstate_ctx == NULL,
fetch current pstate to fill
ctx_B->stable_pstate.

Signed-off-by: Chengming Gui <Jack.Gui@amd.com>
Change-Id: I61cb68b2a5fe2544cd91233fc069b5919fadcb76
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
index 5fc3da020a55..331aa191910c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
@@ -326,7 +326,10 @@ static int amdgpu_ctx_init(struct amdgpu_ctx_mgr *mgr, int32_t priority,
         if (r)
                 return r;

-       ctx->stable_pstate = current_stable_pstate;
+       if (mgr->adev->pm.stable_pstate_ctx)
+               ctx->stable_pstate = mgr->adev->pm.stable_pstate_ctx->stable_pstate;
+       else
+               ctx->stable_pstate = current_stable_pstate;

         return 0;
 }
--
2.37.0


[-- Attachment #2: Type: text/html, Size: 3507 bytes --]

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-10-18 13:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20221018101222.32477-1-Jack.Gui@amd.com>
2022-10-18 13:34 ` [PATCH] drm/amdgpu: fix pstate setting issue Deucher, Alexander

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.