Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cavitt <jonathan.cavitt@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: saurabhg.gupta@intel.com, alex.zuo@intel.com,
	jonathan.cavitt@intel.com, matthew.brost@intel.com,
	daniele.ceraolospurio@intel.com, rodrigo.vivi@intel.com,
	michal.wajdeczko@intel.com, stuart.summers@intel.com,
	dixit.ashutosh@intel.com
Subject: [PATCH v2 2/4] drm/xe/guc: WRITE_ONCE g2h_fence done in parse_g2h_response
Date: Thu, 18 Dec 2025 21:29:49 +0000	[thread overview]
Message-ID: <20251218212946.16577-8-jonathan.cavitt@intel.com> (raw)
In-Reply-To: <20251218212946.16577-6-jonathan.cavitt@intel.com>

Use WRITE_ONCE when operating on g2h_fence->done in parse_g2h_response
to prevent the compiler from ignoring this operation.

Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
Suggested-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 drivers/gpu/drm/xe/xe_guc_ct.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/xe_guc_ct.c b/drivers/gpu/drm/xe/xe_guc_ct.c
index d177df166d2a..38b58590c94b 100644
--- a/drivers/gpu/drm/xe/xe_guc_ct.c
+++ b/drivers/gpu/drm/xe/xe_guc_ct.c
@@ -1500,7 +1500,8 @@ static int parse_g2h_response(struct xe_guc_ct *ct, u32 *msg, u32 len)
 
 	g2h_release_space(ct, GUC_CTB_HXG_MSG_MAX_LEN);
 
-	g2h_fence->done = true;
+	/* WRITE_ONCE pairs with wait_event_timeout in guc_ct_send_recv */
+	WRITE_ONCE(g2h_fence->done, true);
 	smp_mb();
 
 	wake_up_all(&ct->g2h_fence_wq);
-- 
2.43.0


  parent reply	other threads:[~2025-12-18 21:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-18 21:29 [PATCH v2 0/4] drm/xe/guc: Prevent compiler read/write optimization breaks Jonathan Cavitt
2025-12-18 21:29 ` [PATCH v2 1/4] drm/xe/guc: WRITE_ONCE g2h_fence done in g2h_fence_cancel Jonathan Cavitt
2025-12-18 21:29 ` Jonathan Cavitt [this message]
2025-12-18 21:29 ` [PATCH v2 3/4] drm/xe/guc: READ/WRITE_ONCE ct state in ct_change_state and enabled Jonathan Cavitt
2025-12-18 21:29 ` [PATCH v2 4/4] drm/xe/guc: READ_ONCE ct state in xe_guc_ct_initialized Jonathan Cavitt
2025-12-18 21:31 ` [PATCH v2 0/4] drm/xe/guc: Prevent compiler read/write optimization breaks Cavitt, Jonathan
2025-12-18 22:17 ` ✓ CI.KUnit: success for " Patchwork
2025-12-18 23:02 ` ✓ Xe.CI.BAT: " Patchwork
2025-12-20  0:24 ` ✗ 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=20251218212946.16577-8-jonathan.cavitt@intel.com \
    --to=jonathan.cavitt@intel.com \
    --cc=alex.zuo@intel.com \
    --cc=daniele.ceraolospurio@intel.com \
    --cc=dixit.ashutosh@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@intel.com \
    --cc=michal.wajdeczko@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=saurabhg.gupta@intel.com \
    --cc=stuart.summers@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