public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [RFC] drm/i915: check that rpm ref is held when writing to ringbuf in stolen mem
@ 2016-01-27  8:55 daniele.ceraolospurio
  2016-01-27  9:38 ` Chris Wilson
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: daniele.ceraolospurio @ 2016-01-27  8:55 UTC (permalink / raw)
  To: intel-gfx

From: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>

While running some tests on the scheduler patches with rpm enabled I
came across a corruption in the ringbuffer, which was root-caused to
the GPU being suspended while commands were being emitted to the
ringbuffer. The access to memory was failing because the GPU needs to
be awake when accessing stolen memory (where my ringbuffer was located).
Since we have this constraint it looks like a sensible idea to check that
we hold a refcount when we emit commands.

Cc: John Harrison <John.C.Harrison@Intel.com>
Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
---
 drivers/gpu/drm/i915/intel_lrc.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index 3761eaf..f9e8d74 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -1105,6 +1105,11 @@ int intel_logical_ring_begin(struct drm_i915_gem_request *req, int num_dwords)
 	if (ret)
 		return ret;
 
+	// If the ringbuffer is in stolen memory we need to be sure that the
+	// gpu is awake before writing to it
+	if (req->ringbuf->obj->stolen && num_dwords > 0)
+		assert_rpm_wakelock_held(dev_priv);
+
 	req->ringbuf->space -= num_dwords * sizeof(uint32_t);
 	return 0;
 }
-- 
1.9.1

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-01-28 15:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-27  8:55 [RFC] drm/i915: check that rpm ref is held when writing to ringbuf in stolen mem daniele.ceraolospurio
2016-01-27  9:38 ` Chris Wilson
2016-01-27 13:13   ` Daniele Ceraolo Spurio
2016-01-27 13:50     ` Chris Wilson
2016-01-27 16:06       ` Daniel Vetter
2016-01-28  9:00       ` Dave Gordon
2016-01-28  7:33 ` ✓ Fi.CI.BAT: success for " Patchwork
2016-01-28 15:33 ` Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox