All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Assert that the context pin_counts do not overflow
@ 2017-03-16 16:03 Chris Wilson
  2017-03-16 16:27 ` Mika Kuoppala
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Chris Wilson @ 2017-03-16 16:03 UTC (permalink / raw)
  To: intel-gfx

This should be impossible, but let's assert that we do not pin a context
4 billion times before retiring!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_lrc.c        | 1 +
 drivers/gpu/drm/i915/intel_ringbuffer.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index 32ec06245281..77574dfc48ef 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -747,6 +747,7 @@ static int execlists_context_pin(struct intel_engine_cs *engine,
 
 	if (ce->pin_count++)
 		return 0;
+	GEM_BUG_ON(ce->pin_count); /* no overflow please! */
 
 	if (!ce->state) {
 		ret = execlists_context_deferred_alloc(ctx, engine);
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index e895c99f5dd9..758191e69403 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -1445,6 +1445,7 @@ static int intel_ring_context_pin(struct intel_engine_cs *engine,
 
 	if (ce->pin_count++)
 		return 0;
+	GEM_BUG_ON(ce->pin_count); /* no overflow please! */
 
 	if (ce->state) {
 		ret = context_pin(ctx);
-- 
2.11.0

_______________________________________________
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:[~2017-03-17  7:29 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-16 16:03 [PATCH] drm/i915: Assert that the context pin_counts do not overflow Chris Wilson
2017-03-16 16:27 ` Mika Kuoppala
2017-03-16 16:30   ` Chris Wilson
2017-03-16 16:45 ` ✗ Fi.CI.BAT: failure for " Patchwork
2017-03-16 17:16 ` [PATCH v2] " Chris Wilson
2017-03-16 17:23   ` Mika Kuoppala
2017-03-16 20:51     ` Chris Wilson
2017-03-17  7:29   ` Joonas Lahtinen
2017-03-16 17:59 ` ✓ Fi.CI.BAT: success for drm/i915: Assert that the context pin_counts do not overflow (rev2) Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.