[PATCH i-g-t 3/3] lib/xe_spin: Fix ending the loop

Lucas De Marchi lucas.demarchi at intel.com
Wed Jul 31 03:35:04 UTC 2024


Less likely to be a problem with optimizations than the started
condition, but let's stay on the safe side. Comparing to igt_spin_end(),
that one uses a sync_write() to force a MI_BATCH_BUFFER_END in the
beginning of the loop that has a even stronger guarantee.

Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
---
 lib/xe/xe_spin.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/xe/xe_spin.c b/lib/xe/xe_spin.c
index 43a7a43c2..f8b225125 100644
--- a/lib/xe/xe_spin.c
+++ b/lib/xe/xe_spin.c
@@ -183,7 +183,7 @@ void xe_spin_wait_started(struct xe_spin *spin)
 
 void xe_spin_end(struct xe_spin *spin)
 {
-	spin->end = 0;
+	WRITE_ONCE(spin->end, 0);
 }
 
 /**
-- 
2.43.0



More information about the igt-dev mailing list