Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lucas De Marchi <lucas.demarchi@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>,
	Matthew Brost <matthew.brost@intel.com>,
	Lucas De Marchi <lucas.demarchi@intel.com>
Subject: [PATCH i-g-t 2/3] lib/xe_spin: Fix xe_spin_wait_started()
Date: Tue, 30 Jul 2024 20:35:03 -0700	[thread overview]
Message-ID: <20240731033504.1426640-3-lucas.demarchi@intel.com> (raw)
In-Reply-To: <20240731033504.1426640-1-lucas.demarchi@intel.com>

Use READ_ONCE() to guarantee we are actually reading the memory written
by the GPU and compiler can't optimize it away.

Signed-off-by: Lucas De Marchi <lucas.demarchi@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 3adacc3a8..43a7a43c2 100644
--- a/lib/xe/xe_spin.c
+++ b/lib/xe/xe_spin.c
@@ -166,7 +166,7 @@ void xe_spin_init(struct xe_spin *spin, struct xe_spin_opts *opts)
  */
 bool xe_spin_started(struct xe_spin *spin)
 {
-	return spin->start != 0;
+	return READ_ONCE(spin->start) != 0;
 }
 
 /**
-- 
2.43.0


  parent reply	other threads:[~2024-07-31  3:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-31  3:35 [PATCH i-g-t 0/3] fdinfo doc and xe_spin fix Lucas De Marchi
2024-07-31  3:35 ` [PATCH i-g-t 1/3] lib/igt_drm_fdinfo: Improve fdinfo parse documentation Lucas De Marchi
2024-07-31 21:19   ` Cavitt, Jonathan
2024-07-31  3:35 ` Lucas De Marchi [this message]
2024-07-31  6:06   ` [PATCH i-g-t 2/3] lib/xe_spin: Fix xe_spin_wait_started() Zbigniew Kempczyński
2024-08-01  5:42     ` Zbigniew Kempczyński
2024-08-08  6:00       ` Lucas De Marchi
2024-07-31 21:37   ` Cavitt, Jonathan
2024-07-31  3:35 ` [PATCH i-g-t 3/3] lib/xe_spin: Fix ending the loop Lucas De Marchi
2024-07-31  6:09   ` Zbigniew Kempczyński
2024-07-31 21:39   ` Cavitt, Jonathan
2024-07-31  4:38 ` ✓ CI.xeBAT: success for fdinfo doc and xe_spin fix Patchwork
2024-07-31  4:51 ` ✗ Fi.CI.BAT: failure " Patchwork
2024-07-31  5:44 ` ✗ CI.xeFULL: " 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=20240731033504.1426640-3-lucas.demarchi@intel.com \
    --to=lucas.demarchi@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=matthew.brost@intel.com \
    --cc=umesh.nerlige.ramappa@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