Skip to content

Commit 77adbd8

Browse files
committed
drm/i915: Explicitly track active fw_domain timers
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 <[email protected]> Cc: Tvrtko Ursulin <[email protected]> Reviewed-by: Mika Kuoppala <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 15e7fac commit 77adbd8

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

drivers/gpu/drm/i915/intel_uncore.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ fw_domain_reset(const struct intel_uncore_forcewake_domain *d)
7878
static inline void
7979
fw_domain_arm_timer(struct intel_uncore_forcewake_domain *d)
8080
{
81+
GEM_BUG_ON(d->uncore->fw_domains_timer & d->mask);
82+
d->uncore->fw_domains_timer |= d->mask;
8183
d->wake_count++;
8284
hrtimer_start_range_ns(&d->timer,
8385
NSEC_PER_MSEC,
@@ -353,9 +355,10 @@ intel_uncore_fw_release_timer(struct hrtimer *timer)
353355
return HRTIMER_RESTART;
354356

355357
spin_lock_irqsave(&uncore->lock, irqflags);
356-
if (WARN_ON(domain->wake_count == 0))
357-
domain->wake_count++;
358358

359+
uncore->fw_domains_timer &= ~domain->mask;
360+
361+
GEM_BUG_ON(!domain->wake_count);
359362
if (--domain->wake_count == 0)
360363
uncore->funcs.force_wake_put(uncore, domain->mask);
361364

@@ -673,8 +676,7 @@ static void __intel_uncore_forcewake_put(struct intel_uncore *uncore,
673676
fw_domains &= uncore->fw_domains;
674677

675678
for_each_fw_domain_masked(domain, fw_domains, uncore, tmp) {
676-
if (WARN_ON(domain->wake_count == 0))
677-
continue;
679+
GEM_BUG_ON(!domain->wake_count);
678680

679681
if (--domain->wake_count) {
680682
domain->active = true;
@@ -764,7 +766,7 @@ void assert_forcewakes_active(struct intel_uncore *uncore,
764766
unsigned int actual = READ_ONCE(domain->wake_count);
765767
unsigned int expect = 1;
766768

767-
if (hrtimer_active(&domain->timer) && READ_ONCE(domain->active))
769+
if (uncore->fw_domains_timer & domain->mask)
768770
expect++; /* pending automatic release */
769771

770772
if (WARN(actual < expect,
@@ -1160,8 +1162,7 @@ static noinline void ___force_wake_auto(struct intel_uncore *uncore,
11601162
static inline void __force_wake_auto(struct intel_uncore *uncore,
11611163
enum forcewake_domains fw_domains)
11621164
{
1163-
if (WARN_ON(!fw_domains))
1164-
return;
1165+
GEM_BUG_ON(!fw_domains);
11651166

11661167
/* Turn on all requested but inactive supported forcewake domains. */
11671168
fw_domains &= uncore->fw_domains;

drivers/gpu/drm/i915/intel_uncore.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ struct intel_uncore {
123123

124124
enum forcewake_domains fw_domains;
125125
enum forcewake_domains fw_domains_active;
126+
enum forcewake_domains fw_domains_timer;
126127
enum forcewake_domains fw_domains_saved; /* user domains saved for S3 */
127128

128129
struct intel_uncore_forcewake_domain {

0 commit comments

Comments
 (0)