Commit badf1f27 authored by Chris Wilson's avatar Chris Wilson

drm/i915: Order assert forcewake test

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.

v2: The local irq disable did not prevent the timer from running.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111074Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190705074604.16496-1-chris@chris-wilson.co.uk
parent eef037ea
...@@ -758,19 +758,18 @@ void assert_forcewakes_active(struct intel_uncore *uncore, ...@@ -758,19 +758,18 @@ void assert_forcewakes_active(struct intel_uncore *uncore,
* Check that the caller has an explicit wakeref and we don't mistake * Check that the caller has an explicit wakeref and we don't mistake
* it for the auto wakeref. * it for the auto wakeref.
*/ */
local_irq_disable();
for_each_fw_domain_masked(domain, fw_domains, uncore, tmp) { for_each_fw_domain_masked(domain, fw_domains, uncore, tmp) {
unsigned int actual = READ_ONCE(domain->wake_count);
unsigned int expect = 1; unsigned int expect = 1;
if (hrtimer_active(&domain->timer) && READ_ONCE(domain->active)) if (hrtimer_active(&domain->timer) && READ_ONCE(domain->active))
expect++; /* pending automatic release */ 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", "Expected domain %d to be held awake by caller, count=%d\n",
domain->id, domain->wake_count)) domain->id, actual))
break; break;
} }
local_irq_enable();
} }
/* We give fast paths for the really cool registers */ /* We give fast paths for the really cool registers */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment