Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: francois.dugast@intel.com, daniele.ceraolospurio@intel.com,
	michal.wajdeczko@intel.com
Subject: [PATCH v2 2/2] drm/xe: Remove H2G reads in CT send path in non-debug builds
Date: Fri, 13 Feb 2026 13:16:25 -0800	[thread overview]
Message-ID: <20260213211625.3117729-3-matthew.brost@intel.com> (raw)
In-Reply-To: <20260213211625.3117729-1-matthew.brost@intel.com>

A single VRAM read on BMG can take over 1µs. While small, this is a
non-trivial amount of time in a hot path. Remove the descriptor H2G read
(potentially a VRAM access) from non-debug builds, as this
error-checking code is not needed outside of debug configurations.

Signed-off-by: Matthew Brost <matthew.brost@intel.com>
---
 drivers/gpu/drm/xe/xe_guc_ct.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_guc_ct.c b/drivers/gpu/drm/xe/xe_guc_ct.c
index 6a96bea40720..f200d3ee9d22 100644
--- a/drivers/gpu/drm/xe/xe_guc_ct.c
+++ b/drivers/gpu/drm/xe/xe_guc_ct.c
@@ -939,22 +939,22 @@ static int h2g_write(struct xe_guc_ct *ct, const u32 *action, u32 len,
 	u32 full_len;
 	struct iosys_map map = IOSYS_MAP_INIT_OFFSET(&h2g->cmds,
 							 tail * sizeof(u32));
-	u32 desc_status;
 
 	full_len = len + GUC_CTB_HDR_LEN;
 
 	lockdep_assert_held(&ct->lock);
 	xe_gt_assert(gt, full_len <= GUC_CTB_MSG_MAX_LEN);
 
-	desc_status = desc_read(xe, h2g, status);
-	if (desc_status) {
-		xe_gt_err(gt, "CT write: non-zero status: %u\n", desc_status);
-		goto corrupted;
-	}
-
 	if (IS_ENABLED(CONFIG_DRM_XE_DEBUG)) {
 		u32 desc_tail = desc_read(xe, h2g, tail);
 		u32 desc_head = desc_read(xe, h2g, head);
+		u32 desc_status;
+
+		desc_status = desc_read(xe, h2g, status);
+		if (desc_status) {
+			xe_gt_err(gt, "CT write: non-zero status: %u\n", desc_status);
+			goto corrupted;
+		}
 
 		if (tail != desc_tail) {
 			desc_write(xe, h2g, status, desc_status | GUC_CTB_STATUS_MISMATCH);
-- 
2.34.1


  parent reply	other threads:[~2026-02-13 21:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-13 21:16 [PATCH v2 0/2] GuC CT memory optimizations Matthew Brost
2026-02-13 21:16 ` [PATCH v2 1/2] drm/xe: Split H2G and G2H into separate buffer objects Matthew Brost
2026-02-13 22:55   ` Michal Wajdeczko
2026-02-14  0:54     ` Matthew Brost
2026-02-17 16:44       ` Matthew Brost
2026-02-13 21:16 ` Matthew Brost [this message]
2026-02-16 12:51   ` [PATCH v2 2/2] drm/xe: Remove H2G reads in CT send path in non-debug builds Francois Dugast
2026-02-16 17:40     ` Matthew Brost
2026-02-17 11:19       ` Francois Dugast
2026-02-18  0:24         ` Summers, Stuart
2026-02-18  2:35           ` Matthew Brost
2026-02-13 21:59 ` ✓ CI.KUnit: success for GuC CT memory optimizations Patchwork
2026-02-13 22:39 ` ✓ Xe.CI.BAT: " Patchwork
2026-02-14 21:35 ` ✗ Xe.CI.FULL: failure " Patchwork

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=20260213211625.3117729-3-matthew.brost@intel.com \
    --to=matthew.brost@intel.com \
    --cc=daniele.ceraolospurio@intel.com \
    --cc=francois.dugast@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=michal.wajdeczko@intel.com \
    /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