Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/xe: Use WRITE_ONCE for range->tile_invalidated update
@ 2025-06-04 23:47 Matthew Brost
  2025-06-05  4:05 ` ✓ CI.Patch_applied: success for " Patchwork
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Matthew Brost @ 2025-06-04 23:47 UTC (permalink / raw)
  To: intel-xe; +Cc: thomas.hellstrom, himal.prasad.ghimiray

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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2025-06-11 18:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-04 23:47 [PATCH] drm/xe: Use WRITE_ONCE for range->tile_invalidated update Matthew Brost
2025-06-05  4:05 ` ✓ CI.Patch_applied: success for " 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox