AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Deucher <alexander.deucher@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: Alex Deucher <alexander.deucher@amd.com>
Subject: [PATCH 13/16] drm/amdgpu/gfx11: rework kernel queue priority handling
Date: Wed, 18 Mar 2026 10:08:34 -0400	[thread overview]
Message-ID: <20260318140837.582776-13-alexander.deucher@amd.com> (raw)
In-Reply-To: <20260318140837.582776-1-alexander.deucher@amd.com>

Rather than setting a higher queue priority which could
starve a lower priority queue, enable longer quantums
for high priority kernel queues. This will avoid
starvation, but provide longer runtime for high priority
queues.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
index 121290f8b4930..6426270e9eb55 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
@@ -4130,6 +4130,12 @@ static int gfx_v11_0_gfx_mqd_init(struct amdgpu_device *adev, void *m,
 	/* set up time quantum */
 	tmp = regCP_GFX_HQD_QUANTUM_DEFAULT;
 	tmp = REG_SET_FIELD(tmp, CP_GFX_HQD_QUANTUM, QUANTUM_EN, 1);
+	/* increase the duration of a high priority kernel queue */
+	if (prop->kernel_queue &&
+	    (prop->hqd_pipe_priority == AMDGPU_GFX_PIPE_PRIO_HIGH))
+		tmp = REG_SET_FIELD(tmp, CP_GFX_HQD_QUANTUM, QUANTUM_DURATION, 20);
+	else
+		tmp = REG_SET_FIELD(tmp, CP_GFX_HQD_QUANTUM, QUANTUM_DURATION, 10);
 	mqd->cp_gfx_hqd_quantum = tmp;
 
 	/* set up gfx hqd base. this is similar as CP_RB_BASE */
@@ -4400,7 +4406,12 @@ static int gfx_v11_0_compute_mqd_init(struct amdgpu_device *adev, void *m,
 
 	tmp = REG_SET_FIELD(0, CP_HQD_QUANTUM, QUANTUM_EN, 1);
 	tmp = REG_SET_FIELD(tmp, CP_HQD_QUANTUM, QUANTUM_SCALE, 1);
-	tmp = REG_SET_FIELD(tmp, CP_HQD_QUANTUM, QUANTUM_DURATION, 1);
+	/* increase the duration of a high priority kernel queue */
+	if (prop->kernel_queue &&
+	    (prop->hqd_pipe_priority == AMDGPU_GFX_PIPE_PRIO_HIGH))
+		tmp = REG_SET_FIELD(tmp, CP_HQD_QUANTUM, QUANTUM_DURATION, 2);
+	else
+		tmp = REG_SET_FIELD(tmp, CP_HQD_QUANTUM, QUANTUM_DURATION, 1);
 	mqd->cp_hqd_quantum = tmp;
 
 	mqd->cp_hqd_active = prop->hqd_active;
-- 
2.53.0


  parent reply	other threads:[~2026-03-18 14:09 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-18 14:08 [PATCH 01/16] drm/amdgpu/gfx7: align mqd settings with KFD Alex Deucher
2026-03-18 14:08 ` [PATCH 02/16] drm/amdgpu/gfx8: " Alex Deucher
2026-03-18 14:08 ` [PATCH 03/16] drm/amdgpu/gfx9: " Alex Deucher
2026-03-18 14:08 ` [PATCH 04/16] drm/amdgpu/gfx9.4.3: " Alex Deucher
2026-04-03 14:03   ` Alex Deucher
2026-04-17 17:54     ` Alex Deucher
2026-04-17 18:51       ` Russell, Kent
2026-03-18 14:08 ` [PATCH 05/16] drm/amdgpu/gfx10: " Alex Deucher
2026-03-18 14:08 ` [PATCH 06/16] drm/amdgpu/gfx11: " Alex Deucher
2026-03-18 14:08 ` [PATCH 07/16] drm/amdgpu/gfx12: " Alex Deucher
2026-03-18 14:08 ` [PATCH 08/16] drm/amdgpu/gfx12.1: " Alex Deucher
2026-04-03 14:03   ` Alex Deucher
2026-04-17 17:54     ` Alex Deucher
2026-04-17 18:51       ` Russell, Kent
2026-04-17 21:59       ` Joshi, Mukul
2026-03-18 14:08 ` [PATCH 09/16] drm/amdgpu/gfx8: rework kernel queue priority handling Alex Deucher
2026-03-18 14:08 ` [PATCH 10/16] drm/amdgpu/gfx9: " Alex Deucher
2026-03-18 14:08 ` [PATCH 11/16] drm/amdgpu/gfx9.4.3: " Alex Deucher
2026-03-18 14:08 ` [PATCH 12/16] drm/amdgpu/gfx10: " Alex Deucher
2026-03-18 14:08 ` Alex Deucher [this message]
2026-03-18 14:08 ` [PATCH 14/16] drm/amdgpu/gfx12: " Alex Deucher
2026-03-18 14:08 ` [PATCH 15/16] drm/amdgpu/gfx12.1: " Alex Deucher
2026-03-18 14:08 ` [PATCH 16/16] drm/amdgpu: don't set queue priorities for kernel queues 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=20260318140837.582776-13-alexander.deucher@amd.com \
    --to=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox