aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/i915/i915_request.c14
-rw-r--r--drivers/gpu/drm/i915/i915_request.h8
2 files changed, 16 insertions, 6 deletions
diff --git a/drivers/gpu/drm/i915/i915_request.c b/drivers/gpu/drm/i915/i915_request.c
index 09ed48833b54..a492385b2089 100644
--- a/drivers/gpu/drm/i915/i915_request.c
+++ b/drivers/gpu/drm/i915/i915_request.c
@@ -732,13 +732,13 @@ i915_request_alloc(struct intel_engine_cs *engine, struct i915_gem_context *ctx)
732 rq = kmem_cache_alloc(i915->requests, 732 rq = kmem_cache_alloc(i915->requests,
733 GFP_KERNEL | __GFP_RETRY_MAYFAIL | __GFP_NOWARN); 733 GFP_KERNEL | __GFP_RETRY_MAYFAIL | __GFP_NOWARN);
734 if (unlikely(!rq)) { 734 if (unlikely(!rq)) {
735 i915_retire_requests(i915);
736
735 /* Ratelimit ourselves to prevent oom from malicious clients */ 737 /* Ratelimit ourselves to prevent oom from malicious clients */
736 ret = i915_gem_wait_for_idle(i915, 738 rq = i915_gem_active_raw(&ce->ring->timeline->last_request,
737 I915_WAIT_LOCKED | 739 &i915->drm.struct_mutex);
738 I915_WAIT_INTERRUPTIBLE, 740 if (rq)
739 MAX_SCHEDULE_TIMEOUT); 741 cond_synchronize_rcu(rq->rcustate);
740 if (ret)
741 goto err_unreserve;
742 742
743 /* 743 /*
744 * We've forced the client to stall and catch up with whatever 744 * We've forced the client to stall and catch up with whatever
@@ -758,6 +758,8 @@ i915_request_alloc(struct intel_engine_cs *engine, struct i915_gem_context *ctx)
758 } 758 }
759 } 759 }
760 760
761 rq->rcustate = get_state_synchronize_rcu();
762
761 INIT_LIST_HEAD(&rq->active_list); 763 INIT_LIST_HEAD(&rq->active_list);
762 rq->i915 = i915; 764 rq->i915 = i915;
763 rq->engine = engine; 765 rq->engine = engine;
diff --git a/drivers/gpu/drm/i915/i915_request.h b/drivers/gpu/drm/i915/i915_request.h
index 9898301ab7ef..7fa94b024968 100644
--- a/drivers/gpu/drm/i915/i915_request.h
+++ b/drivers/gpu/drm/i915/i915_request.h
@@ -101,6 +101,14 @@ struct i915_request {
101 struct intel_signal_node signaling; 101 struct intel_signal_node signaling;
102 102
103 /* 103 /*
104 * The rcu epoch of when this request was allocated. Used to judiciously
105 * apply backpressure on future allocations to ensure that under
106 * mempressure there is sufficient RCU ticks for us to reclaim our
107 * RCU protected slabs.
108 */
109 unsigned long rcustate;
110
111 /*
104 * Fences for the various phases in the request's lifetime. 112 * Fences for the various phases in the request's lifetime.
105 * 113 *
106 * The submit fence is used to await upon all of the request's 114 * The submit fence is used to await upon all of the request's