All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/i915: Warn if request allocation stalls
@ 2018-10-05  8:02 Chris Wilson
  2018-10-05  8:03 ` [PATCH 2/2] drm/i915: Remove the global cache shrink & rcu barrier on allocation failure Chris Wilson
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Chris Wilson @ 2018-10-05  8:02 UTC (permalink / raw)
  To: intel-gfx

Add a warning for an allocation stall to make it painfully more obvious
while debugging.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem.h     | 2 ++
 drivers/gpu/drm/i915/i915_request.c | 6 ++++++
 2 files changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_gem.h b/drivers/gpu/drm/i915/i915_gem.h
index 599c4f6eb1ea..e2db030fd75a 100644
--- a/drivers/gpu/drm/i915/i915_gem.h
+++ b/drivers/gpu/drm/i915/i915_gem.h
@@ -47,6 +47,7 @@ struct drm_i915_private;
 #define GEM_DEBUG_DECL(var) var
 #define GEM_DEBUG_EXEC(expr) expr
 #define GEM_DEBUG_BUG_ON(expr) GEM_BUG_ON(expr)
+#define GEM_DEBUG_WARN(expr...) WARN(expr)
 
 #else
 
@@ -58,6 +59,7 @@ struct drm_i915_private;
 #define GEM_DEBUG_DECL(var)
 #define GEM_DEBUG_EXEC(expr) do { } while (0)
 #define GEM_DEBUG_BUG_ON(expr)
+#define GEM_DEBUG_WARN(expr...) do { } while (0)
 #endif
 
 #if IS_ENABLED(CONFIG_DRM_I915_TRACE_GEM)
diff --git a/drivers/gpu/drm/i915/i915_request.c b/drivers/gpu/drm/i915/i915_request.c
index abd4dacbab8e..32bf2c9868bf 100644
--- a/drivers/gpu/drm/i915/i915_request.c
+++ b/drivers/gpu/drm/i915/i915_request.c
@@ -647,6 +647,8 @@ i915_request_alloc(struct intel_engine_cs *engine, struct i915_gem_context *ctx)
 	rq = kmem_cache_alloc(i915->requests,
 			      GFP_KERNEL | __GFP_RETRY_MAYFAIL | __GFP_NOWARN);
 	if (unlikely(!rq)) {
+		GEM_DEBUG_DECL(ktime_t start = ktime_get());
+
 		i915_retire_requests(i915);
 
 		/* Ratelimit ourselves to prevent oom from malicious clients */
@@ -671,6 +673,10 @@ i915_request_alloc(struct intel_engine_cs *engine, struct i915_gem_context *ctx)
 			ret = -ENOMEM;
 			goto err_unreserve;
 		}
+
+		GEM_DEBUG_WARN(ktime_ms_delta(ktime_get(), start) > 500,
+			       "request allocation delayed for %lldms\n",
+			       ktime_ms_delta(ktime_get(), start));
 	}
 
 	rq->rcustate = get_state_synchronize_rcu();
-- 
2.19.0

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

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

end of thread, other threads:[~2018-10-05 11:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-05  8:02 [PATCH 1/2] drm/i915: Warn if request allocation stalls Chris Wilson
2018-10-05  8:03 ` [PATCH 2/2] drm/i915: Remove the global cache shrink & rcu barrier on allocation failure Chris Wilson
2018-10-05  8:39   ` Tvrtko Ursulin
2018-10-05  9:16     ` Chris Wilson
2018-10-05  8:37 ` [PATCH 1/2] drm/i915: Warn if request allocation stalls Tvrtko Ursulin
2018-10-05  9:31   ` Chris Wilson
2018-10-05  8:50 ` ✓ Fi.CI.BAT: success for series starting with [1/2] " Patchwork
2018-10-05 11:17 ` ✓ Fi.CI.IGT: " 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.