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

mOn Fri, Feb 13, 2026 at 01:16:25PM -0800, Matthew Brost wrote:
> 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.

About the change itself: I understand the performance benefit and this would
make the code consistent with the 2 other reads.

But the existing block under "if (IS_ENABLED(CONFIG_DRM_XE_DEBUG))" seems wrong
because it is not just about optionally printing some debug statements, in case
of error the function actually returns a different value if CONFIG_DRM_XE_DEBUG
is enabled or not (goto), and this return value is used in __guc_ct_send_locked.

Francois

> 
> 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
> 

  reply	other threads:[~2026-02-16 12:52 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 ` [PATCH v2 2/2] drm/xe: Remove H2G reads in CT send path in non-debug builds Matthew Brost
2026-02-16 12:51   ` Francois Dugast [this message]
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=aZMS7Qg5AvFRE_Zb@fdugast-desk \
    --to=francois.dugast@intel.com \
    --cc=daniele.ceraolospurio@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@intel.com \
    --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