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: thomas.hellstrom@linux.intel.com, himal.prasad.ghimiray@intel.com
Subject: [PATCH] drm/xe: Use WRITE_ONCE for range->tile_invalidated update
Date: Wed,  4 Jun 2025 16:47:12 -0700	[thread overview]
Message-ID: <20250604234712.2441130-1-matthew.brost@intel.com> (raw)

Updating range->tile_invalidated should be done with WRITE_ONCE to pair
with READ_ONCE in opportunistic checks.

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

diff --git a/drivers/gpu/drm/xe/xe_svm.c b/drivers/gpu/drm/xe/xe_svm.c
index 83c63fd7b481..7df0bcea65fc 100644
--- a/drivers/gpu/drm/xe/xe_svm.c
+++ b/drivers/gpu/drm/xe/xe_svm.c
@@ -141,7 +141,9 @@ xe_svm_range_notifier_event_begin(struct xe_vm *vm, struct drm_gpusvm_range *r,
 	for_each_tile(tile, xe, id)
 		if (xe_pt_zap_ptes_range(tile, vm, range)) {
 			tile_mask |= BIT(id);
-			range->tile_invalidated |= BIT(id);
+			/* Pairs with READ_ONCE in xe_svm_range_is_valid */
+			WRITE_ONCE(range->tile_invalidated,
+				   range->tile_invalidated | BIT(id));
 		}
 
 	return tile_mask;
@@ -644,7 +646,8 @@ static bool xe_svm_range_is_valid(struct xe_svm_range *range,
 {
 	/*
 	 * Advisory only check whether the range currently has a valid mapping,
-	 * READ_ONCE pairs with WRITE_ONCE in xe_pt.c
+	 * READ_ONCE pairs with WRITE_ONCE in xe_pt.c,
+	 * xe_svm_range_notifier_event_begin
 	 */
 	return ((READ_ONCE(range->tile_present) &
 		 ~READ_ONCE(range->tile_invalidated)) & BIT(tile->id)) &&
-- 
2.34.1


             reply	other threads:[~2025-06-04 23:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-04 23:47 Matthew Brost [this message]
2025-06-05  4:05 ` ✓ CI.Patch_applied: success for drm/xe: Use WRITE_ONCE for range->tile_invalidated update Patchwork
2025-06-05  4:05 ` ✓ CI.checkpatch: " Patchwork
2025-06-05  4:07 ` ✓ CI.KUnit: " Patchwork
2025-06-05  4:17 ` ✓ CI.Build: " Patchwork
2025-06-05  4:20 ` ✓ CI.Hooks: " Patchwork
2025-06-05  4:21 ` ✓ CI.checksparse: " Patchwork
2025-06-05  5:10 ` ✓ Xe.CI.BAT: " Patchwork
2025-06-06 12:54 ` ✗ Xe.CI.Full: failure " Patchwork
2025-06-11 18:33 ` [PATCH] " Maarten Lankhorst

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=20250604234712.2441130-1-matthew.brost@intel.com \
    --to=matthew.brost@intel.com \
    --cc=himal.prasad.ghimiray@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=thomas.hellstrom@linux.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