All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH] drm/i915: Order assert forcewake test
Date: Thu,  4 Jul 2019 20:26:15 +0100	[thread overview]
Message-ID: <20190704192615.15855-1-chris@chris-wilson.co.uk> (raw)

Read the current value before computing the expected to ensure that if
the timer does complete early (against our will), it should not cause a
false positive.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_uncore.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c
index 2042c94c9cc9..c83bfaae377f 100644
--- a/drivers/gpu/drm/i915/intel_uncore.c
+++ b/drivers/gpu/drm/i915/intel_uncore.c
@@ -760,14 +760,15 @@ void assert_forcewakes_active(struct intel_uncore *uncore,
 	 */
 	local_irq_disable();
 	for_each_fw_domain_masked(domain, fw_domains, uncore, tmp) {
+		unsigned int actual = READ_ONCE(domain->wake_count);
 		unsigned int expect = 1;
 
 		if (hrtimer_active(&domain->timer) && READ_ONCE(domain->active))
 			expect++; /* pending automatic release */
 
-		if (WARN(domain->wake_count < expect,
+		if (WARN(actual < expect,
 			 "Expected domain %d to be held awake by caller, count=%d\n",
-			 domain->id, domain->wake_count))
+			 domain->id, actual))
 			break;
 	}
 	local_irq_enable();
-- 
2.20.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

             reply	other threads:[~2019-07-04 19:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-04 19:26 Chris Wilson [this message]
2019-07-04 20:07 ` ✗ Fi.CI.BAT: failure for drm/i915: Order assert forcewake test 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=20190704192615.15855-1-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.