]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915: Explicitly track active fw_domain timers
authorChris Wilson <chris@chris-wilson.co.uk>
Mon, 8 Jul 2019 15:49:14 +0000 (16:49 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Mon, 8 Jul 2019 16:33:10 +0000 (17:33 +0100)
Stop guessing over whether we have an extra wakeref held by the delayed
fw put, and track it explicitly for the sake of debug.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190708154914.26850-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/intel_uncore.c
drivers/gpu/drm/i915/intel_uncore.h

index 5f0367fd3200734b140f15bf4bb30e54dd7fc432..4015e964c6fc186bf6fc27b445eb47e3f56f2b79 100644 (file)
@@ -78,6 +78,8 @@ fw_domain_reset(const struct intel_uncore_forcewake_domain *d)
 static inline void
 fw_domain_arm_timer(struct intel_uncore_forcewake_domain *d)
 {
+       GEM_BUG_ON(d->uncore->fw_domains_timer & d->mask);
+       d->uncore->fw_domains_timer |= d->mask;
        d->wake_count++;
        hrtimer_start_range_ns(&d->timer,
                               NSEC_PER_MSEC,
@@ -353,9 +355,10 @@ intel_uncore_fw_release_timer(struct hrtimer *timer)
                return HRTIMER_RESTART;
 
        spin_lock_irqsave(&uncore->lock, irqflags);
-       if (WARN_ON(domain->wake_count == 0))
-               domain->wake_count++;
 
+       uncore->fw_domains_timer &= ~domain->mask;
+
+       GEM_BUG_ON(!domain->wake_count);
        if (--domain->wake_count == 0)
                uncore->funcs.force_wake_put(uncore, domain->mask);
 
@@ -673,8 +676,7 @@ static void __intel_uncore_forcewake_put(struct intel_uncore *uncore,
        fw_domains &= uncore->fw_domains;
 
        for_each_fw_domain_masked(domain, fw_domains, uncore, tmp) {
-               if (WARN_ON(domain->wake_count == 0))
-                       continue;
+               GEM_BUG_ON(!domain->wake_count);
 
                if (--domain->wake_count) {
                        domain->active = true;
@@ -764,7 +766,7 @@ void assert_forcewakes_active(struct intel_uncore *uncore,
                unsigned int actual = READ_ONCE(domain->wake_count);
                unsigned int expect = 1;
 
-               if (hrtimer_active(&domain->timer) && READ_ONCE(domain->active))
+               if (uncore->fw_domains_timer & domain->mask)
                        expect++; /* pending automatic release */
 
                if (WARN(actual < expect,
@@ -1160,8 +1162,7 @@ static noinline void ___force_wake_auto(struct intel_uncore *uncore,
 static inline void __force_wake_auto(struct intel_uncore *uncore,
                                     enum forcewake_domains fw_domains)
 {
-       if (WARN_ON(!fw_domains))
-               return;
+       GEM_BUG_ON(!fw_domains);
 
        /* Turn on all requested but inactive supported forcewake domains. */
        fw_domains &= uncore->fw_domains;
index 7108475d9b2416234852e8da7c89170f0b4c4472..2f6ffa3096695df01c6892d36d90d30e4f2ec83b 100644 (file)
@@ -123,6 +123,7 @@ struct intel_uncore {
 
        enum forcewake_domains fw_domains;
        enum forcewake_domains fw_domains_active;
+       enum forcewake_domains fw_domains_timer;
        enum forcewake_domains fw_domains_saved; /* user domains saved for S3 */
 
        struct intel_uncore_forcewake_domain {