* [PATCH resend-for-CI 1/3] drm/i915: Use consistent forcewake auto-release timeout across kernel configs
@ 2016-04-07 16:04 Tvrtko Ursulin
2016-04-07 16:04 ` [PATCH resend-for-CI 2/3] drm/i915: Simplify for_each_fw_domain iterators Tvrtko Ursulin
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Tvrtko Ursulin @ 2016-04-07 16:04 UTC (permalink / raw)
To: Intel-gfx
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Because it is based on jiffies, current implementation releases the
forcewake at any time between straight away and between 1ms and 10ms,
depending on the kernel configuration (CONFIG_HZ).
This is probably not what has been desired, since the dynamics of keeping
parts of the GPU awake should not be correlated with this kernel
configuration parameter.
Change the auto-release mechanism to use hrtimers and set the timeout to
1ms with a 1ms of slack. This should make the GPU power consistent
across kernel configs, and timer slack should enable some timer coalescing
where multiple force-wake domains exist, or with unrelated timers.
For GlBench/T-Rex this decreases the number of forcewake releases from
~480 to ~300 per second, and for a heavy combined OGL/OCL test from
~670 to ~360 (HZ=1000 kernel).
Even though this reduction can be attributed to the average release period
extending from 0-1ms to 1-2ms, as discussed above, it will make the
forcewake timeout consistent for different CONFIG_HZ values.
Real life measurements with the above workload has shown that, with this
patch, both manage to auto-release the forcewake between 2-4 times per
10ms, even though the number of forcewake gets is dramatically different.
T-Rex requests between 5-10 explicit gets and 5-10 implict gets in each
10ms period, while the OGL/OCL test requests 250 and 380 times in the same
period.
The two data points together suggest that the nature of the forwake
accesses is bursty and that further changes and potential timeout
extensions, or moving the start of timeout from the first to the last
automatic forcewake grab, should be carefully measured for power and
performance effects.
v2:
* Commit spelling. (Dave Gordon)
* More discussion on numbers in the commit. (Chris Wilson)
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Dave Gordon <david.s.gordon@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
---
drivers/gpu/drm/i915/i915_drv.h | 2 +-
drivers/gpu/drm/i915/intel_uncore.c | 25 ++++++++++++++++---------
2 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 4ebd3ff02803..a1dae0d6ba23 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -666,7 +666,7 @@ struct intel_uncore {
struct drm_i915_private *i915;
enum forcewake_domain_id id;
unsigned wake_count;
- struct timer_list timer;
+ struct hrtimer timer;
i915_reg_t reg_set;
u32 val_set;
u32 val_clear;
diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c
index ac2ac07b505b..24bedac64518 100644
--- a/drivers/gpu/drm/i915/intel_uncore.c
+++ b/drivers/gpu/drm/i915/intel_uncore.c
@@ -60,7 +60,11 @@ fw_domain_reset(const struct intel_uncore_forcewake_domain *d)
static inline void
fw_domain_arm_timer(struct intel_uncore_forcewake_domain *d)
{
- mod_timer_pinned(&d->timer, jiffies + 1);
+ d->wake_count++;
+ hrtimer_start_range_ns(&d->timer,
+ ktime_set(0, NSEC_PER_MSEC),
+ NSEC_PER_MSEC,
+ HRTIMER_MODE_REL);
}
static inline void
@@ -224,9 +228,11 @@ static int __gen6_gt_wait_for_fifo(struct drm_i915_private *dev_priv)
return ret;
}
-static void intel_uncore_fw_release_timer(unsigned long arg)
+static enum hrtimer_restart
+intel_uncore_fw_release_timer(struct hrtimer *timer)
{
- struct intel_uncore_forcewake_domain *domain = (void *)arg;
+ struct intel_uncore_forcewake_domain *domain =
+ container_of(timer, struct intel_uncore_forcewake_domain, timer);
unsigned long irqflags;
assert_rpm_device_not_suspended(domain->i915);
@@ -240,6 +246,8 @@ static void intel_uncore_fw_release_timer(unsigned long arg)
1 << domain->id);
spin_unlock_irqrestore(&domain->i915->uncore.lock, irqflags);
+
+ return HRTIMER_NORESTART;
}
void intel_uncore_forcewake_reset(struct drm_device *dev, bool restore)
@@ -259,16 +267,16 @@ void intel_uncore_forcewake_reset(struct drm_device *dev, bool restore)
active_domains = 0;
for_each_fw_domain(domain, dev_priv, id) {
- if (del_timer_sync(&domain->timer) == 0)
+ if (hrtimer_cancel(&domain->timer) == 0)
continue;
- intel_uncore_fw_release_timer((unsigned long)domain);
+ intel_uncore_fw_release_timer(&domain->timer);
}
spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
for_each_fw_domain(domain, dev_priv, id) {
- if (timer_pending(&domain->timer))
+ if (hrtimer_active(&domain->timer))
active_domains |= (1 << id);
}
@@ -491,7 +499,6 @@ static void __intel_uncore_forcewake_put(struct drm_i915_private *dev_priv,
if (--domain->wake_count)
continue;
- domain->wake_count++;
fw_domain_arm_timer(domain);
}
}
@@ -732,7 +739,6 @@ static inline void __force_wake_auto(struct drm_i915_private *dev_priv,
continue;
}
- domain->wake_count++;
fw_domain_arm_timer(domain);
}
@@ -1150,7 +1156,8 @@ static void fw_domain_init(struct drm_i915_private *dev_priv,
d->i915 = dev_priv;
d->id = domain_id;
- setup_timer(&d->timer, intel_uncore_fw_release_timer, (unsigned long)d);
+ hrtimer_init(&d->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
+ d->timer.function = intel_uncore_fw_release_timer;
dev_priv->uncore.fw_domains |= (1 << domain_id);
--
1.9.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH resend-for-CI 2/3] drm/i915: Simplify for_each_fw_domain iterators 2016-04-07 16:04 [PATCH resend-for-CI 1/3] drm/i915: Use consistent forcewake auto-release timeout across kernel configs Tvrtko Ursulin @ 2016-04-07 16:04 ` Tvrtko Ursulin 2016-04-07 16:04 ` [PATCH resend-for-CI 3/3] drm/i915: Do not serialize forcewake acquire across domains Tvrtko Ursulin 2016-04-08 7:02 ` ✗ Fi.CI.BAT: failure for series starting with [resend-for-CI,1/3] drm/i915: Use consistent forcewake auto-release timeout across kernel configs Patchwork 2 siblings, 0 replies; 9+ messages in thread From: Tvrtko Ursulin @ 2016-04-07 16:04 UTC (permalink / raw) To: Intel-gfx From: Tvrtko Ursulin <tvrtko.ursulin@intel.com> As the vast majority of users do not use the domain id variable, we can eliminate it from the iterator and also change the latter using the same principle as was recently done for for_each_engine. For a couple of callers which do need the domain mask, store it in the domain array (which already has the domain id), then both can be retrieved thence. Result is clearer code and smaller generated binary, especially in the tight fw get/put loops. Also, relationship between domain id and mask is no longer assumed in the macro. v2: Improve grammar in the commit message and rename the iterator to for_each_fw_domain_masked for consistency. (Dave Gordon) Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Dave Gordon <david.s.gordon@intel.com> --- drivers/gpu/drm/i915/i915_debugfs.c | 5 ++--- drivers/gpu/drm/i915/i915_drv.h | 17 +++++++------- drivers/gpu/drm/i915/intel_uncore.c | 45 +++++++++++++++++-------------------- 3 files changed, 32 insertions(+), 35 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index be4bcdcbb129..18396b23bc56 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -1464,12 +1464,11 @@ static int i915_forcewake_domains(struct seq_file *m, void *data) struct drm_device *dev = node->minor->dev; struct drm_i915_private *dev_priv = dev->dev_private; struct intel_uncore_forcewake_domain *fw_domain; - int i; spin_lock_irq(&dev_priv->uncore.lock); - for_each_fw_domain(fw_domain, dev_priv, i) { + for_each_fw_domain(fw_domain, dev_priv) { seq_printf(m, "%s.wake_count = %u\n", - intel_uncore_forcewake_domain_to_str(i), + intel_uncore_forcewake_domain_to_str(fw_domain->id), fw_domain->wake_count); } spin_unlock_irq(&dev_priv->uncore.lock); diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index a1dae0d6ba23..779b934d51b0 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -665,6 +665,7 @@ struct intel_uncore { struct intel_uncore_forcewake_domain { struct drm_i915_private *i915; enum forcewake_domain_id id; + enum forcewake_domains mask; unsigned wake_count; struct hrtimer timer; i915_reg_t reg_set; @@ -679,14 +680,14 @@ struct intel_uncore { }; /* Iterate over initialised fw domains */ -#define for_each_fw_domain_mask(domain__, mask__, dev_priv__, i__) \ - for ((i__) = 0, (domain__) = &(dev_priv__)->uncore.fw_domain[0]; \ - (i__) < FW_DOMAIN_ID_COUNT; \ - (i__)++, (domain__) = &(dev_priv__)->uncore.fw_domain[i__]) \ - for_each_if (((mask__) & (dev_priv__)->uncore.fw_domains) & (1 << (i__))) - -#define for_each_fw_domain(domain__, dev_priv__, i__) \ - for_each_fw_domain_mask(domain__, FORCEWAKE_ALL, dev_priv__, i__) +#define for_each_fw_domain_masked(domain__, mask__, dev_priv__) \ + for ((domain__) = &(dev_priv__)->uncore.fw_domain[0]; \ + (domain__) < &(dev_priv__)->uncore.fw_domain[FW_DOMAIN_ID_COUNT]; \ + (domain__)++) \ + for_each_if ((mask__) & (domain__)->mask) + +#define for_each_fw_domain(domain__, dev_priv__) \ + for_each_fw_domain_masked(domain__, FORCEWAKE_ALL, dev_priv__) #define CSR_VERSION(major, minor) ((major) << 16 | (minor)) #define CSR_VERSION_MAJOR(version) ((version) >> 16) diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c index 24bedac64518..963a3875d436 100644 --- a/drivers/gpu/drm/i915/intel_uncore.c +++ b/drivers/gpu/drm/i915/intel_uncore.c @@ -111,9 +111,8 @@ static void fw_domains_get(struct drm_i915_private *dev_priv, enum forcewake_domains fw_domains) { struct intel_uncore_forcewake_domain *d; - enum forcewake_domain_id id; - for_each_fw_domain_mask(d, fw_domains, dev_priv, id) { + for_each_fw_domain_masked(d, fw_domains, dev_priv) { fw_domain_wait_ack_clear(d); fw_domain_get(d); fw_domain_wait_ack(d); @@ -124,9 +123,8 @@ static void fw_domains_put(struct drm_i915_private *dev_priv, enum forcewake_domains fw_domains) { struct intel_uncore_forcewake_domain *d; - enum forcewake_domain_id id; - for_each_fw_domain_mask(d, fw_domains, dev_priv, id) { + for_each_fw_domain_masked(d, fw_domains, dev_priv) { fw_domain_put(d); fw_domain_posting_read(d); } @@ -136,10 +134,9 @@ static void fw_domains_posting_read(struct drm_i915_private *dev_priv) { struct intel_uncore_forcewake_domain *d; - enum forcewake_domain_id id; /* No need to do for all, just do for first found */ - for_each_fw_domain(d, dev_priv, id) { + for_each_fw_domain(d, dev_priv) { fw_domain_posting_read(d); break; } @@ -149,12 +146,11 @@ static void fw_domains_reset(struct drm_i915_private *dev_priv, enum forcewake_domains fw_domains) { struct intel_uncore_forcewake_domain *d; - enum forcewake_domain_id id; if (dev_priv->uncore.fw_domains == 0) return; - for_each_fw_domain_mask(d, fw_domains, dev_priv, id) + for_each_fw_domain_masked(d, fw_domains, dev_priv) fw_domain_reset(d); fw_domains_posting_read(dev_priv); @@ -256,7 +252,6 @@ void intel_uncore_forcewake_reset(struct drm_device *dev, bool restore) unsigned long irqflags; struct intel_uncore_forcewake_domain *domain; int retry_count = 100; - enum forcewake_domain_id id; enum forcewake_domains fw = 0, active_domains; /* Hold uncore.lock across reset to prevent any register access @@ -266,7 +261,7 @@ void intel_uncore_forcewake_reset(struct drm_device *dev, bool restore) while (1) { active_domains = 0; - for_each_fw_domain(domain, dev_priv, id) { + for_each_fw_domain(domain, dev_priv) { if (hrtimer_cancel(&domain->timer) == 0) continue; @@ -275,9 +270,9 @@ void intel_uncore_forcewake_reset(struct drm_device *dev, bool restore) spin_lock_irqsave(&dev_priv->uncore.lock, irqflags); - for_each_fw_domain(domain, dev_priv, id) { + for_each_fw_domain(domain, dev_priv) { if (hrtimer_active(&domain->timer)) - active_domains |= (1 << id); + active_domains |= domain->mask; } if (active_domains == 0) @@ -294,9 +289,9 @@ void intel_uncore_forcewake_reset(struct drm_device *dev, bool restore) WARN_ON(active_domains); - for_each_fw_domain(domain, dev_priv, id) + for_each_fw_domain(domain, dev_priv) if (domain->wake_count) - fw |= 1 << id; + fw |= domain->mask; if (fw) dev_priv->uncore.funcs.force_wake_put(dev_priv, fw); @@ -418,16 +413,15 @@ static void __intel_uncore_forcewake_get(struct drm_i915_private *dev_priv, enum forcewake_domains fw_domains) { struct intel_uncore_forcewake_domain *domain; - enum forcewake_domain_id id; if (!dev_priv->uncore.funcs.force_wake_get) return; fw_domains &= dev_priv->uncore.fw_domains; - for_each_fw_domain_mask(domain, fw_domains, dev_priv, id) { + for_each_fw_domain_masked(domain, fw_domains, dev_priv) { if (domain->wake_count++) - fw_domains &= ~(1 << id); + fw_domains &= ~domain->mask; } if (fw_domains) @@ -485,14 +479,13 @@ static void __intel_uncore_forcewake_put(struct drm_i915_private *dev_priv, enum forcewake_domains fw_domains) { struct intel_uncore_forcewake_domain *domain; - enum forcewake_domain_id id; if (!dev_priv->uncore.funcs.force_wake_put) return; fw_domains &= dev_priv->uncore.fw_domains; - for_each_fw_domain_mask(domain, fw_domains, dev_priv, id) { + for_each_fw_domain_masked(domain, fw_domains, dev_priv) { if (WARN_ON(domain->wake_count == 0)) continue; @@ -546,12 +539,11 @@ void intel_uncore_forcewake_put__locked(struct drm_i915_private *dev_priv, void assert_forcewakes_inactive(struct drm_i915_private *dev_priv) { struct intel_uncore_forcewake_domain *domain; - enum forcewake_domain_id id; if (!dev_priv->uncore.funcs.force_wake_get) return; - for_each_fw_domain(domain, dev_priv, id) + for_each_fw_domain(domain, dev_priv) WARN_ON(domain->wake_count); } @@ -727,15 +719,14 @@ static inline void __force_wake_auto(struct drm_i915_private *dev_priv, enum forcewake_domains fw_domains) { struct intel_uncore_forcewake_domain *domain; - enum forcewake_domain_id id; if (WARN_ON(!fw_domains)) return; /* Ideally GCC would be constant-fold and eliminate this loop */ - for_each_fw_domain_mask(domain, fw_domains, dev_priv, id) { + for_each_fw_domain_masked(domain, fw_domains, dev_priv) { if (domain->wake_count) { - fw_domains &= ~(1 << id); + fw_domains &= ~domain->mask; continue; } @@ -1156,6 +1147,12 @@ static void fw_domain_init(struct drm_i915_private *dev_priv, d->i915 = dev_priv; d->id = domain_id; + BUILD_BUG_ON(FORCEWAKE_RENDER != (1 << FW_DOMAIN_ID_RENDER)); + BUILD_BUG_ON(FORCEWAKE_BLITTER != (1 << FW_DOMAIN_ID_BLITTER)); + BUILD_BUG_ON(FORCEWAKE_MEDIA != (1 << FW_DOMAIN_ID_MEDIA)); + + d->mask = 1 << domain_id; + hrtimer_init(&d->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); d->timer.function = intel_uncore_fw_release_timer; -- 1.9.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH resend-for-CI 3/3] drm/i915: Do not serialize forcewake acquire across domains 2016-04-07 16:04 [PATCH resend-for-CI 1/3] drm/i915: Use consistent forcewake auto-release timeout across kernel configs Tvrtko Ursulin 2016-04-07 16:04 ` [PATCH resend-for-CI 2/3] drm/i915: Simplify for_each_fw_domain iterators Tvrtko Ursulin @ 2016-04-07 16:04 ` Tvrtko Ursulin 2016-04-08 7:02 ` ✗ Fi.CI.BAT: failure for series starting with [resend-for-CI,1/3] drm/i915: Use consistent forcewake auto-release timeout across kernel configs Patchwork 2 siblings, 0 replies; 9+ messages in thread From: Tvrtko Ursulin @ 2016-04-07 16:04 UTC (permalink / raw) To: Intel-gfx From: Tvrtko Ursulin <tvrtko.ursulin@intel.com> On platforms with multiple forcewake domains it seems more efficient to request all desired ones and then to wait for acks to avoid needlessly serializing on each domain. v2: Rebase. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> --- drivers/gpu/drm/i915/intel_uncore.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c index 963a3875d436..dcf38bb5a097 100644 --- a/drivers/gpu/drm/i915/intel_uncore.c +++ b/drivers/gpu/drm/i915/intel_uncore.c @@ -115,8 +115,10 @@ fw_domains_get(struct drm_i915_private *dev_priv, enum forcewake_domains fw_doma for_each_fw_domain_masked(d, fw_domains, dev_priv) { fw_domain_wait_ack_clear(d); fw_domain_get(d); - fw_domain_wait_ack(d); } + + for_each_fw_domain_masked(d, fw_domains, dev_priv) + fw_domain_wait_ack(d); } static void -- 1.9.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 9+ messages in thread
* ✗ Fi.CI.BAT: failure for series starting with [resend-for-CI,1/3] drm/i915: Use consistent forcewake auto-release timeout across kernel configs 2016-04-07 16:04 [PATCH resend-for-CI 1/3] drm/i915: Use consistent forcewake auto-release timeout across kernel configs Tvrtko Ursulin 2016-04-07 16:04 ` [PATCH resend-for-CI 2/3] drm/i915: Simplify for_each_fw_domain iterators Tvrtko Ursulin 2016-04-07 16:04 ` [PATCH resend-for-CI 3/3] drm/i915: Do not serialize forcewake acquire across domains Tvrtko Ursulin @ 2016-04-08 7:02 ` Patchwork 2016-04-08 8:38 ` Chris Wilson 2016-04-12 13:33 ` Tvrtko Ursulin 2 siblings, 2 replies; 9+ messages in thread From: Patchwork @ 2016-04-08 7:02 UTC (permalink / raw) To: Tvrtko Ursulin; +Cc: intel-gfx == Series Details == Series: series starting with [resend-for-CI,1/3] drm/i915: Use consistent forcewake auto-release timeout across kernel configs URL : https://patchwork.freedesktop.org/series/5424/ State : failure == Summary == Series 5424v1 Series without cover letter http://patchwork.freedesktop.org/api/1.0/series/5424/revisions/1/mbox/ Test drv_getparams_basic: Subgroup basic-subslice-total: dmesg-warn -> PASS (bsw-nuc-2) Test drv_module_reload_basic: incomplete -> PASS (bsw-nuc-2) Test gem_basic: Subgroup bad-close: dmesg-warn -> PASS (bsw-nuc-2) Subgroup create-close: dmesg-warn -> PASS (bsw-nuc-2) Subgroup create-fd-close: dmesg-warn -> PASS (bsw-nuc-2) Test gem_ctx_param_basic: Subgroup basic: dmesg-warn -> PASS (bsw-nuc-2) Subgroup invalid-ctx-set: dmesg-warn -> PASS (bsw-nuc-2) Subgroup invalid-param-get: dmesg-warn -> PASS (bsw-nuc-2) Subgroup invalid-param-set: dmesg-warn -> PASS (bsw-nuc-2) Subgroup root-set: dmesg-warn -> PASS (bsw-nuc-2) Test gem_ctx_switch: Subgroup basic-default: skip -> PASS (bsw-nuc-2) Test gem_exec_basic: Subgroup basic-blt: skip -> PASS (bsw-nuc-2) Subgroup gtt-bsd: skip -> PASS (bsw-nuc-2) Subgroup readonly-bsd: skip -> PASS (bsw-nuc-2) Subgroup readonly-render: skip -> PASS (bsw-nuc-2) Subgroup readonly-vebox: skip -> PASS (bsw-nuc-2) Test gem_exec_store: Subgroup basic-bsd: skip -> PASS (bsw-nuc-2) Subgroup basic-default: skip -> PASS (bsw-nuc-2) Subgroup basic-vebox: skip -> PASS (bsw-nuc-2) Test gem_exec_whisper: Subgroup basic: skip -> PASS (bsw-nuc-2) Test gem_mmap: Subgroup basic-small-bo: dmesg-warn -> PASS (bsw-nuc-2) Test gem_mmap_gtt: Subgroup basic-write: dmesg-warn -> PASS (bsw-nuc-2) Subgroup basic-write-gtt: dmesg-warn -> PASS (bsw-nuc-2) Test gem_ringfill: Subgroup basic-default-hang: skip -> PASS (bsw-nuc-2) Test gem_sync: Subgroup basic-blt: skip -> PASS (bsw-nuc-2) Subgroup basic-vebox: skip -> PASS (bsw-nuc-2) Test gem_tiled_pread_basic: dmesg-warn -> PASS (bsw-nuc-2) Test kms_addfb_basic: Subgroup addfb25-modifier-no-flag: dmesg-warn -> PASS (bsw-nuc-2) Subgroup addfb25-y-tiled: dmesg-warn -> PASS (bsw-nuc-2) Subgroup bad-pitch-65536: dmesg-warn -> PASS (bsw-nuc-2) Subgroup basic-x-tiled: dmesg-warn -> PASS (bsw-nuc-2) Subgroup framebuffer-vs-set-tiling: dmesg-warn -> PASS (bsw-nuc-2) Subgroup too-wide: dmesg-warn -> PASS (bsw-nuc-2) Test kms_flip: Subgroup basic-flip-vs-dpms: pass -> DMESG-WARN (ilk-hp8440p) UNSTABLE Subgroup basic-flip-vs-wf_vblank: dmesg-fail -> PASS (bsw-nuc-2) Test kms_pipe_crc_basic: Subgroup read-crc-pipe-c-frame-sequence: dmesg-fail -> PASS (bsw-nuc-2) Subgroup suspend-read-crc-pipe-c: dmesg-warn -> PASS (bsw-nuc-2) Test prime_self_import: Subgroup basic-with_fd_dup: dmesg-warn -> PASS (bsw-nuc-2) Subgroup basic-with_one_bo_two_files: dmesg-warn -> PASS (bsw-nuc-2) bdw-ultra total:196 pass:175 dwarn:0 dfail:0 fail:0 skip:21 bsw-nuc-2 total:196 pass:158 dwarn:1 dfail:0 fail:0 skip:37 byt-nuc total:196 pass:161 dwarn:0 dfail:0 fail:0 skip:35 hsw-brixbox total:196 pass:174 dwarn:0 dfail:0 fail:0 skip:22 hsw-gt2 total:196 pass:179 dwarn:0 dfail:0 fail:0 skip:17 ilk-hp8440p total:196 pass:131 dwarn:1 dfail:0 fail:0 skip:64 skl-i7k-2 total:196 pass:173 dwarn:0 dfail:0 fail:0 skip:23 snb-dellxps total:196 pass:162 dwarn:0 dfail:0 fail:0 skip:34 BOOT FAILED for bdw-nuci7 Results at /archive/results/CI_IGT_test/Patchwork_1835/ 851708c7e97537ed618fadbe5d342eaf8fa5146d drm-intel-nightly: 2016y-04m-07d-13h-56m-00s UTC integration manifest 92e5b39bf422197014aa097e20e66bdaa93af717 drm/i915: Do not serialize forcewake acquire across domains e55b59fd4e7f7999f9d4d6def7bcb009285237bc drm/i915: Simplify for_each_fw_domain iterators a2f0e7b42549d8061709fdd3a715614e8677e178 drm/i915: Use consistent forcewake auto-release timeout across kernel configs _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: ✗ Fi.CI.BAT: failure for series starting with [resend-for-CI,1/3] drm/i915: Use consistent forcewake auto-release timeout across kernel configs 2016-04-08 7:02 ` ✗ Fi.CI.BAT: failure for series starting with [resend-for-CI,1/3] drm/i915: Use consistent forcewake auto-release timeout across kernel configs Patchwork @ 2016-04-08 8:38 ` Chris Wilson 2016-04-12 13:33 ` Tvrtko Ursulin 1 sibling, 0 replies; 9+ messages in thread From: Chris Wilson @ 2016-04-08 8:38 UTC (permalink / raw) To: intel-gfx On Fri, Apr 08, 2016 at 07:02:35AM -0000, Patchwork wrote: > == Series Details == > > Series: series starting with [resend-for-CI,1/3] drm/i915: Use consistent forcewake auto-release timeout across kernel configs > URL : https://patchwork.freedesktop.org/series/5424/ > State : failure > > == Summary == > > Series 5424v1 Series without cover letter > http://patchwork.freedesktop.org/api/1.0/series/5424/revisions/1/mbox/ > > Test drv_getparams_basic: > Subgroup basic-subslice-total: > dmesg-warn -> PASS (bsw-nuc-2) Even though bsw is (currently) unstable, this is a good result as it means that the change is not fundamentally broken on Braswell! -Chris -- Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: ✗ Fi.CI.BAT: failure for series starting with [resend-for-CI,1/3] drm/i915: Use consistent forcewake auto-release timeout across kernel configs 2016-04-08 7:02 ` ✗ Fi.CI.BAT: failure for series starting with [resend-for-CI,1/3] drm/i915: Use consistent forcewake auto-release timeout across kernel configs Patchwork 2016-04-08 8:38 ` Chris Wilson @ 2016-04-12 13:33 ` Tvrtko Ursulin 2016-04-12 13:43 ` Ville Syrjälä 1 sibling, 1 reply; 9+ messages in thread From: Tvrtko Ursulin @ 2016-04-12 13:33 UTC (permalink / raw) To: intel-gfx On 08/04/16 08:02, Patchwork wrote: > == Series Details == > > Series: series starting with [resend-for-CI,1/3] drm/i915: Use consistent forcewake auto-release timeout across kernel configs > URL : https://patchwork.freedesktop.org/series/5424/ > State : failure > > == Summary == > > Series 5424v1 Series without cover letter > http://patchwork.freedesktop.org/api/1.0/series/5424/revisions/1/mbox/ > > Test drv_getparams_basic: > Subgroup basic-subslice-total: > dmesg-warn -> PASS (bsw-nuc-2) > Test drv_module_reload_basic: > incomplete -> PASS (bsw-nuc-2) > Test gem_basic: > Subgroup bad-close: > dmesg-warn -> PASS (bsw-nuc-2) > Subgroup create-close: > dmesg-warn -> PASS (bsw-nuc-2) > Subgroup create-fd-close: > dmesg-warn -> PASS (bsw-nuc-2) > Test gem_ctx_param_basic: > Subgroup basic: > dmesg-warn -> PASS (bsw-nuc-2) > Subgroup invalid-ctx-set: > dmesg-warn -> PASS (bsw-nuc-2) > Subgroup invalid-param-get: > dmesg-warn -> PASS (bsw-nuc-2) > Subgroup invalid-param-set: > dmesg-warn -> PASS (bsw-nuc-2) > Subgroup root-set: > dmesg-warn -> PASS (bsw-nuc-2) > Test gem_ctx_switch: > Subgroup basic-default: > skip -> PASS (bsw-nuc-2) > Test gem_exec_basic: > Subgroup basic-blt: > skip -> PASS (bsw-nuc-2) > Subgroup gtt-bsd: > skip -> PASS (bsw-nuc-2) > Subgroup readonly-bsd: > skip -> PASS (bsw-nuc-2) > Subgroup readonly-render: > skip -> PASS (bsw-nuc-2) > Subgroup readonly-vebox: > skip -> PASS (bsw-nuc-2) > Test gem_exec_store: > Subgroup basic-bsd: > skip -> PASS (bsw-nuc-2) > Subgroup basic-default: > skip -> PASS (bsw-nuc-2) > Subgroup basic-vebox: > skip -> PASS (bsw-nuc-2) > Test gem_exec_whisper: > Subgroup basic: > skip -> PASS (bsw-nuc-2) > Test gem_mmap: > Subgroup basic-small-bo: > dmesg-warn -> PASS (bsw-nuc-2) > Test gem_mmap_gtt: > Subgroup basic-write: > dmesg-warn -> PASS (bsw-nuc-2) > Subgroup basic-write-gtt: > dmesg-warn -> PASS (bsw-nuc-2) > Test gem_ringfill: > Subgroup basic-default-hang: > skip -> PASS (bsw-nuc-2) > Test gem_sync: > Subgroup basic-blt: > skip -> PASS (bsw-nuc-2) > Subgroup basic-vebox: > skip -> PASS (bsw-nuc-2) > Test gem_tiled_pread_basic: > dmesg-warn -> PASS (bsw-nuc-2) > Test kms_addfb_basic: > Subgroup addfb25-modifier-no-flag: > dmesg-warn -> PASS (bsw-nuc-2) > Subgroup addfb25-y-tiled: > dmesg-warn -> PASS (bsw-nuc-2) > Subgroup bad-pitch-65536: > dmesg-warn -> PASS (bsw-nuc-2) > Subgroup basic-x-tiled: > dmesg-warn -> PASS (bsw-nuc-2) > Subgroup framebuffer-vs-set-tiling: > dmesg-warn -> PASS (bsw-nuc-2) > Subgroup too-wide: > dmesg-warn -> PASS (bsw-nuc-2) > Test kms_flip: > Subgroup basic-flip-vs-dpms: > pass -> DMESG-WARN (ilk-hp8440p) UNSTABLE Old friend unclaimed access prior to suspending: https://bugs.freedesktop.org/show_bug.cgi?id=94164 > Subgroup basic-flip-vs-wf_vblank: > dmesg-fail -> PASS (bsw-nuc-2) > Test kms_pipe_crc_basic: > Subgroup read-crc-pipe-c-frame-sequence: > dmesg-fail -> PASS (bsw-nuc-2) > Subgroup suspend-read-crc-pipe-c: > dmesg-warn -> PASS (bsw-nuc-2) > Test prime_self_import: > Subgroup basic-with_fd_dup: > dmesg-warn -> PASS (bsw-nuc-2) > Subgroup basic-with_one_bo_two_files: > dmesg-warn -> PASS (bsw-nuc-2) > > bdw-ultra total:196 pass:175 dwarn:0 dfail:0 fail:0 skip:21 > bsw-nuc-2 total:196 pass:158 dwarn:1 dfail:0 fail:0 skip:37 > byt-nuc total:196 pass:161 dwarn:0 dfail:0 fail:0 skip:35 > hsw-brixbox total:196 pass:174 dwarn:0 dfail:0 fail:0 skip:22 > hsw-gt2 total:196 pass:179 dwarn:0 dfail:0 fail:0 skip:17 > ilk-hp8440p total:196 pass:131 dwarn:1 dfail:0 fail:0 skip:64 > skl-i7k-2 total:196 pass:173 dwarn:0 dfail:0 fail:0 skip:23 > snb-dellxps total:196 pass:162 dwarn:0 dfail:0 fail:0 skip:34 > BOOT FAILED for bdw-nuci7 > > Results at /archive/results/CI_IGT_test/Patchwork_1835/ > > 851708c7e97537ed618fadbe5d342eaf8fa5146d drm-intel-nightly: 2016y-04m-07d-13h-56m-00s UTC integration manifest > 92e5b39bf422197014aa097e20e66bdaa93af717 drm/i915: Do not serialize forcewake acquire across domains > e55b59fd4e7f7999f9d4d6def7bcb009285237bc drm/i915: Simplify for_each_fw_domain iterators > a2f0e7b42549d8061709fdd3a715614e8677e178 drm/i915: Use consistent forcewake auto-release timeout across kernel configs Series merged (on the basis it does not break even BSW) - thanks for the review! Regards, Tvrtko _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: ✗ Fi.CI.BAT: failure for series starting with [resend-for-CI,1/3] drm/i915: Use consistent forcewake auto-release timeout across kernel configs 2016-04-12 13:33 ` Tvrtko Ursulin @ 2016-04-12 13:43 ` Ville Syrjälä 2016-04-12 13:51 ` Tvrtko Ursulin 0 siblings, 1 reply; 9+ messages in thread From: Ville Syrjälä @ 2016-04-12 13:43 UTC (permalink / raw) To: Tvrtko Ursulin; +Cc: intel-gfx On Tue, Apr 12, 2016 at 02:33:45PM +0100, Tvrtko Ursulin wrote: > > On 08/04/16 08:02, Patchwork wrote: > > Test kms_flip: > > Subgroup basic-flip-vs-dpms: > > pass -> DMESG-WARN (ilk-hp8440p) UNSTABLE > > Old friend unclaimed access prior to suspending: > https://bugs.freedesktop.org/show_bug.cgi?id=94164 o_O ILK doesn't even have a way to detect such things. -- Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: ✗ Fi.CI.BAT: failure for series starting with [resend-for-CI,1/3] drm/i915: Use consistent forcewake auto-release timeout across kernel configs 2016-04-12 13:43 ` Ville Syrjälä @ 2016-04-12 13:51 ` Tvrtko Ursulin 0 siblings, 0 replies; 9+ messages in thread From: Tvrtko Ursulin @ 2016-04-12 13:51 UTC (permalink / raw) To: Ville Syrjälä; +Cc: intel-gfx On 12/04/16 14:43, Ville Syrjälä wrote: > On Tue, Apr 12, 2016 at 02:33:45PM +0100, Tvrtko Ursulin wrote: >> >> On 08/04/16 08:02, Patchwork wrote: >>> Test kms_flip: >>> Subgroup basic-flip-vs-dpms: >>> pass -> DMESG-WARN (ilk-hp8440p) UNSTABLE >> >> Old friend unclaimed access prior to suspending: >> https://bugs.freedesktop.org/show_bug.cgi?id=94164 > > o_O > > ILK doesn't even have a way to detect such things. :D No idea, must be copy and paste error, wrong tab, stack overflow on (mental) context switching.. Real one is sporadic fifo underrun: https://bugs.freedesktop.org/show_bug.cgi?id=93787 Regards, Tvrtko _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH resend-for-CI 1/3] drm/i915: Use consistent forcewake auto-release timeout across kernel configs @ 2016-04-06 9:33 Tvrtko Ursulin 2016-04-06 9:33 ` [PATCH resend-for-CI 2/3] drm/i915: Simplify for_each_fw_domain iterators Tvrtko Ursulin 0 siblings, 1 reply; 9+ messages in thread From: Tvrtko Ursulin @ 2016-04-06 9:33 UTC (permalink / raw) To: Intel-gfx From: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Because it is based on jiffies, current implementation releases the forcewake at any time between straight away and between 1ms and 10ms, depending on the kernel configuration (CONFIG_HZ). This is probably not what has been desired, since the dynamics of keeping parts of the GPU awake should not be correlated with this kernel configuration parameter. Change the auto-release mechanism to use hrtimers and set the timeout to 1ms with a 1ms of slack. This should make the GPU power consistent across kernel configs, and timer slack should enable some timer coalescing where multiple force-wake domains exist, or with unrelated timers. For GlBench/T-Rex this decreases the number of forcewake releases from ~480 to ~300 per second, and for a heavy combined OGL/OCL test from ~670 to ~360 (HZ=1000 kernel). Even though this reduction can be attributed to the average release period extending from 0-1ms to 1-2ms, as discussed above, it will make the forcewake timeout consistent for different CONFIG_HZ values. Real life measurements with the above workload has shown that, with this patch, both manage to auto-release the forcewake between 2-4 times per 10ms, even though the number of forcewake gets is dramatically different. T-Rex requests between 5-10 explicit gets and 5-10 implict gets in each 10ms period, while the OGL/OCL test requests 250 and 380 times in the same period. The two data points together suggest that the nature of the forwake accesses is bursty and that further changes and potential timeout extensions, or moving the start of timeout from the first to the last automatic forcewake grab, should be carefully measured for power and performance effects. v2: * Commit spelling. (Dave Gordon) * More discussion on numbers in the commit. (Chris Wilson) Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Dave Gordon <david.s.gordon@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> --- drivers/gpu/drm/i915/i915_drv.h | 2 +- drivers/gpu/drm/i915/intel_uncore.c | 25 ++++++++++++++++--------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 313bc3576d87..8ee5f78d45bc 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -666,7 +666,7 @@ struct intel_uncore { struct drm_i915_private *i915; enum forcewake_domain_id id; unsigned wake_count; - struct timer_list timer; + struct hrtimer timer; i915_reg_t reg_set; u32 val_set; u32 val_clear; diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c index fbc1d215ca67..2e3e92469947 100644 --- a/drivers/gpu/drm/i915/intel_uncore.c +++ b/drivers/gpu/drm/i915/intel_uncore.c @@ -60,7 +60,11 @@ fw_domain_reset(const struct intel_uncore_forcewake_domain *d) static inline void fw_domain_arm_timer(struct intel_uncore_forcewake_domain *d) { - mod_timer_pinned(&d->timer, jiffies + 1); + d->wake_count++; + hrtimer_start_range_ns(&d->timer, + ktime_set(0, NSEC_PER_MSEC), + NSEC_PER_MSEC, + HRTIMER_MODE_REL); } static inline void @@ -224,9 +228,11 @@ static int __gen6_gt_wait_for_fifo(struct drm_i915_private *dev_priv) return ret; } -static void intel_uncore_fw_release_timer(unsigned long arg) +static enum hrtimer_restart +intel_uncore_fw_release_timer(struct hrtimer *timer) { - struct intel_uncore_forcewake_domain *domain = (void *)arg; + struct intel_uncore_forcewake_domain *domain = + container_of(timer, struct intel_uncore_forcewake_domain, timer); unsigned long irqflags; assert_rpm_device_not_suspended(domain->i915); @@ -240,6 +246,8 @@ static void intel_uncore_fw_release_timer(unsigned long arg) 1 << domain->id); spin_unlock_irqrestore(&domain->i915->uncore.lock, irqflags); + + return HRTIMER_NORESTART; } void intel_uncore_forcewake_reset(struct drm_device *dev, bool restore) @@ -259,16 +267,16 @@ void intel_uncore_forcewake_reset(struct drm_device *dev, bool restore) active_domains = 0; for_each_fw_domain(domain, dev_priv, id) { - if (del_timer_sync(&domain->timer) == 0) + if (hrtimer_cancel(&domain->timer) == 0) continue; - intel_uncore_fw_release_timer((unsigned long)domain); + intel_uncore_fw_release_timer(&domain->timer); } spin_lock_irqsave(&dev_priv->uncore.lock, irqflags); for_each_fw_domain(domain, dev_priv, id) { - if (timer_pending(&domain->timer)) + if (hrtimer_active(&domain->timer)) active_domains |= (1 << id); } @@ -491,7 +499,6 @@ static void __intel_uncore_forcewake_put(struct drm_i915_private *dev_priv, if (--domain->wake_count) continue; - domain->wake_count++; fw_domain_arm_timer(domain); } } @@ -732,7 +739,6 @@ static inline void __force_wake_auto(struct drm_i915_private *dev_priv, continue; } - domain->wake_count++; fw_domain_arm_timer(domain); } @@ -1150,7 +1156,8 @@ static void fw_domain_init(struct drm_i915_private *dev_priv, d->i915 = dev_priv; d->id = domain_id; - setup_timer(&d->timer, intel_uncore_fw_release_timer, (unsigned long)d); + hrtimer_init(&d->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); + d->timer.function = intel_uncore_fw_release_timer; dev_priv->uncore.fw_domains |= (1 << domain_id); -- 1.9.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH resend-for-CI 2/3] drm/i915: Simplify for_each_fw_domain iterators 2016-04-06 9:33 [PATCH resend-for-CI 1/3] " Tvrtko Ursulin @ 2016-04-06 9:33 ` Tvrtko Ursulin 0 siblings, 0 replies; 9+ messages in thread From: Tvrtko Ursulin @ 2016-04-06 9:33 UTC (permalink / raw) To: Intel-gfx From: Tvrtko Ursulin <tvrtko.ursulin@intel.com> As the vast majority of users do not use the domain id variable, we can eliminate it from the iterator and also change the latter using the same principle as was recently done for for_each_engine. For a couple of callers which do need the domain mask, store it in the domain array (which already has the domain id), then both can be retrieved thence. Result is clearer code and smaller generated binary, especially in the tight fw get/put loops. Also, relationship between domain id and mask is no longer assumed in the macro. v2: Improve grammar in the commit message and rename the iterator to for_each_fw_domain_masked for consistency. (Dave Gordon) Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Dave Gordon <david.s.gordon@intel.com> --- drivers/gpu/drm/i915/i915_debugfs.c | 5 ++--- drivers/gpu/drm/i915/i915_drv.h | 17 +++++++------- drivers/gpu/drm/i915/intel_uncore.c | 45 +++++++++++++++++-------------------- 3 files changed, 32 insertions(+), 35 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index a2e3af02c292..06fce014d0b4 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -1464,12 +1464,11 @@ static int i915_forcewake_domains(struct seq_file *m, void *data) struct drm_device *dev = node->minor->dev; struct drm_i915_private *dev_priv = dev->dev_private; struct intel_uncore_forcewake_domain *fw_domain; - int i; spin_lock_irq(&dev_priv->uncore.lock); - for_each_fw_domain(fw_domain, dev_priv, i) { + for_each_fw_domain(fw_domain, dev_priv) { seq_printf(m, "%s.wake_count = %u\n", - intel_uncore_forcewake_domain_to_str(i), + intel_uncore_forcewake_domain_to_str(fw_domain->id), fw_domain->wake_count); } spin_unlock_irq(&dev_priv->uncore.lock); diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 8ee5f78d45bc..6decc9b058dc 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -665,6 +665,7 @@ struct intel_uncore { struct intel_uncore_forcewake_domain { struct drm_i915_private *i915; enum forcewake_domain_id id; + enum forcewake_domains mask; unsigned wake_count; struct hrtimer timer; i915_reg_t reg_set; @@ -679,14 +680,14 @@ struct intel_uncore { }; /* Iterate over initialised fw domains */ -#define for_each_fw_domain_mask(domain__, mask__, dev_priv__, i__) \ - for ((i__) = 0, (domain__) = &(dev_priv__)->uncore.fw_domain[0]; \ - (i__) < FW_DOMAIN_ID_COUNT; \ - (i__)++, (domain__) = &(dev_priv__)->uncore.fw_domain[i__]) \ - for_each_if (((mask__) & (dev_priv__)->uncore.fw_domains) & (1 << (i__))) - -#define for_each_fw_domain(domain__, dev_priv__, i__) \ - for_each_fw_domain_mask(domain__, FORCEWAKE_ALL, dev_priv__, i__) +#define for_each_fw_domain_masked(domain__, mask__, dev_priv__) \ + for ((domain__) = &(dev_priv__)->uncore.fw_domain[0]; \ + (domain__) < &(dev_priv__)->uncore.fw_domain[FW_DOMAIN_ID_COUNT]; \ + (domain__)++) \ + for_each_if ((mask__) & (domain__)->mask) + +#define for_each_fw_domain(domain__, dev_priv__) \ + for_each_fw_domain_masked(domain__, FORCEWAKE_ALL, dev_priv__) #define CSR_VERSION(major, minor) ((major) << 16 | (minor)) #define CSR_VERSION_MAJOR(version) ((version) >> 16) diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c index 2e3e92469947..575c81e08ea6 100644 --- a/drivers/gpu/drm/i915/intel_uncore.c +++ b/drivers/gpu/drm/i915/intel_uncore.c @@ -111,9 +111,8 @@ static void fw_domains_get(struct drm_i915_private *dev_priv, enum forcewake_domains fw_domains) { struct intel_uncore_forcewake_domain *d; - enum forcewake_domain_id id; - for_each_fw_domain_mask(d, fw_domains, dev_priv, id) { + for_each_fw_domain_masked(d, fw_domains, dev_priv) { fw_domain_wait_ack_clear(d); fw_domain_get(d); fw_domain_wait_ack(d); @@ -124,9 +123,8 @@ static void fw_domains_put(struct drm_i915_private *dev_priv, enum forcewake_domains fw_domains) { struct intel_uncore_forcewake_domain *d; - enum forcewake_domain_id id; - for_each_fw_domain_mask(d, fw_domains, dev_priv, id) { + for_each_fw_domain_masked(d, fw_domains, dev_priv) { fw_domain_put(d); fw_domain_posting_read(d); } @@ -136,10 +134,9 @@ static void fw_domains_posting_read(struct drm_i915_private *dev_priv) { struct intel_uncore_forcewake_domain *d; - enum forcewake_domain_id id; /* No need to do for all, just do for first found */ - for_each_fw_domain(d, dev_priv, id) { + for_each_fw_domain(d, dev_priv) { fw_domain_posting_read(d); break; } @@ -149,12 +146,11 @@ static void fw_domains_reset(struct drm_i915_private *dev_priv, enum forcewake_domains fw_domains) { struct intel_uncore_forcewake_domain *d; - enum forcewake_domain_id id; if (dev_priv->uncore.fw_domains == 0) return; - for_each_fw_domain_mask(d, fw_domains, dev_priv, id) + for_each_fw_domain_masked(d, fw_domains, dev_priv) fw_domain_reset(d); fw_domains_posting_read(dev_priv); @@ -256,7 +252,6 @@ void intel_uncore_forcewake_reset(struct drm_device *dev, bool restore) unsigned long irqflags; struct intel_uncore_forcewake_domain *domain; int retry_count = 100; - enum forcewake_domain_id id; enum forcewake_domains fw = 0, active_domains; /* Hold uncore.lock across reset to prevent any register access @@ -266,7 +261,7 @@ void intel_uncore_forcewake_reset(struct drm_device *dev, bool restore) while (1) { active_domains = 0; - for_each_fw_domain(domain, dev_priv, id) { + for_each_fw_domain(domain, dev_priv) { if (hrtimer_cancel(&domain->timer) == 0) continue; @@ -275,9 +270,9 @@ void intel_uncore_forcewake_reset(struct drm_device *dev, bool restore) spin_lock_irqsave(&dev_priv->uncore.lock, irqflags); - for_each_fw_domain(domain, dev_priv, id) { + for_each_fw_domain(domain, dev_priv) { if (hrtimer_active(&domain->timer)) - active_domains |= (1 << id); + active_domains |= domain->mask; } if (active_domains == 0) @@ -294,9 +289,9 @@ void intel_uncore_forcewake_reset(struct drm_device *dev, bool restore) WARN_ON(active_domains); - for_each_fw_domain(domain, dev_priv, id) + for_each_fw_domain(domain, dev_priv) if (domain->wake_count) - fw |= 1 << id; + fw |= domain->mask; if (fw) dev_priv->uncore.funcs.force_wake_put(dev_priv, fw); @@ -418,16 +413,15 @@ static void __intel_uncore_forcewake_get(struct drm_i915_private *dev_priv, enum forcewake_domains fw_domains) { struct intel_uncore_forcewake_domain *domain; - enum forcewake_domain_id id; if (!dev_priv->uncore.funcs.force_wake_get) return; fw_domains &= dev_priv->uncore.fw_domains; - for_each_fw_domain_mask(domain, fw_domains, dev_priv, id) { + for_each_fw_domain_masked(domain, fw_domains, dev_priv) { if (domain->wake_count++) - fw_domains &= ~(1 << id); + fw_domains &= ~domain->mask; } if (fw_domains) @@ -485,14 +479,13 @@ static void __intel_uncore_forcewake_put(struct drm_i915_private *dev_priv, enum forcewake_domains fw_domains) { struct intel_uncore_forcewake_domain *domain; - enum forcewake_domain_id id; if (!dev_priv->uncore.funcs.force_wake_put) return; fw_domains &= dev_priv->uncore.fw_domains; - for_each_fw_domain_mask(domain, fw_domains, dev_priv, id) { + for_each_fw_domain_masked(domain, fw_domains, dev_priv) { if (WARN_ON(domain->wake_count == 0)) continue; @@ -546,12 +539,11 @@ void intel_uncore_forcewake_put__locked(struct drm_i915_private *dev_priv, void assert_forcewakes_inactive(struct drm_i915_private *dev_priv) { struct intel_uncore_forcewake_domain *domain; - enum forcewake_domain_id id; if (!dev_priv->uncore.funcs.force_wake_get) return; - for_each_fw_domain(domain, dev_priv, id) + for_each_fw_domain(domain, dev_priv) WARN_ON(domain->wake_count); } @@ -727,15 +719,14 @@ static inline void __force_wake_auto(struct drm_i915_private *dev_priv, enum forcewake_domains fw_domains) { struct intel_uncore_forcewake_domain *domain; - enum forcewake_domain_id id; if (WARN_ON(!fw_domains)) return; /* Ideally GCC would be constant-fold and eliminate this loop */ - for_each_fw_domain_mask(domain, fw_domains, dev_priv, id) { + for_each_fw_domain_masked(domain, fw_domains, dev_priv) { if (domain->wake_count) { - fw_domains &= ~(1 << id); + fw_domains &= ~domain->mask; continue; } @@ -1156,6 +1147,12 @@ static void fw_domain_init(struct drm_i915_private *dev_priv, d->i915 = dev_priv; d->id = domain_id; + BUILD_BUG_ON(FORCEWAKE_RENDER != (1 << FW_DOMAIN_ID_RENDER)); + BUILD_BUG_ON(FORCEWAKE_BLITTER != (1 << FW_DOMAIN_ID_BLITTER)); + BUILD_BUG_ON(FORCEWAKE_MEDIA != (1 << FW_DOMAIN_ID_MEDIA)); + + d->mask = 1 << domain_id; + hrtimer_init(&d->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); d->timer.function = intel_uncore_fw_release_timer; -- 1.9.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2016-04-12 13:51 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-04-07 16:04 [PATCH resend-for-CI 1/3] drm/i915: Use consistent forcewake auto-release timeout across kernel configs Tvrtko Ursulin 2016-04-07 16:04 ` [PATCH resend-for-CI 2/3] drm/i915: Simplify for_each_fw_domain iterators Tvrtko Ursulin 2016-04-07 16:04 ` [PATCH resend-for-CI 3/3] drm/i915: Do not serialize forcewake acquire across domains Tvrtko Ursulin 2016-04-08 7:02 ` ✗ Fi.CI.BAT: failure for series starting with [resend-for-CI,1/3] drm/i915: Use consistent forcewake auto-release timeout across kernel configs Patchwork 2016-04-08 8:38 ` Chris Wilson 2016-04-12 13:33 ` Tvrtko Ursulin 2016-04-12 13:43 ` Ville Syrjälä 2016-04-12 13:51 ` Tvrtko Ursulin -- strict thread matches above, loose matches on Subject: below -- 2016-04-06 9:33 [PATCH resend-for-CI 1/3] " Tvrtko Ursulin 2016-04-06 9:33 ` [PATCH resend-for-CI 2/3] drm/i915: Simplify for_each_fw_domain iterators Tvrtko Ursulin
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox