aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2019-03-08 04:36:57 -0500
committerChris Wilson <chris@chris-wilson.co.uk>2019-03-08 05:57:12 -0500
commit7d6ce55887a44c15c6df29e883d0ea567c8ac55c (patch)
treef2ec48386d3287b48ac2c9b5846e1c3c6eaa7c23
parentc6eeb4797eb94ad14bb34adfccbc6addad2cfd48 (diff)
drm/i915: Remove has-kernel-context
We can no longer assume execution ordering, and in particular we cannot assume which context will execute last. One side-effect of this is that we cannot determine if the kernel-context is resident on the GPU, so remove the routines that claimed to do so. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190308093657.8640-4-chris@chris-wilson.co.uk
-rw-r--r--drivers/gpu/drm/i915/i915_active.h13
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c21
-rw-r--r--drivers/gpu/drm/i915/i915_gem_evict.c16
-rw-r--r--drivers/gpu/drm/i915/intel_engine_cs.c31
-rw-r--r--drivers/gpu/drm/i915/intel_ringbuffer.h1
5 files changed, 4 insertions, 78 deletions
diff --git a/drivers/gpu/drm/i915/i915_active.h b/drivers/gpu/drm/i915/i915_active.h
index 8142a334b37b..7d758719ce39 100644
--- a/drivers/gpu/drm/i915/i915_active.h
+++ b/drivers/gpu/drm/i915/i915_active.h
@@ -108,19 +108,6 @@ i915_active_request_set_retire_fn(struct i915_active_request *active,
108 active->retire = fn ?: i915_active_retire_noop; 108 active->retire = fn ?: i915_active_retire_noop;
109} 109}
110 110
111static inline struct i915_request *
112__i915_active_request_peek(const struct i915_active_request *active)
113{
114 /*
115 * Inside the error capture (running with the driver in an unknown
116 * state), we want to bend the rules slightly (a lot).
117 *
118 * Work is in progress to make it safer, in the meantime this keeps
119 * the known issue from spamming the logs.
120 */
121 return rcu_dereference_protected(active->request, 1);
122}
123
124/** 111/**
125 * i915_active_request_raw - return the active request 112 * i915_active_request_raw - return the active request
126 * @active - the active tracker 113 * @active - the active tracker
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 961237b90b40..1f1849f90606 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2828,23 +2828,6 @@ i915_gem_retire_work_handler(struct work_struct *work)
2828 round_jiffies_up_relative(HZ)); 2828 round_jiffies_up_relative(HZ));
2829} 2829}
2830 2830
2831static void assert_kernel_context_is_current(struct drm_i915_private *i915)
2832{
2833 struct intel_engine_cs *engine;
2834 enum intel_engine_id id;
2835
2836 if (i915_reset_failed(i915))
2837 return;
2838
2839 i915_retire_requests(i915);
2840
2841 for_each_engine(engine, i915, id) {
2842 GEM_BUG_ON(__i915_active_request_peek(&engine->timeline.last_request));
2843 GEM_BUG_ON(engine->last_retired_context !=
2844 to_intel_context(i915->kernel_context, engine));
2845 }
2846}
2847
2848static bool switch_to_kernel_context_sync(struct drm_i915_private *i915, 2831static bool switch_to_kernel_context_sync(struct drm_i915_private *i915,
2849 unsigned long mask) 2832 unsigned long mask)
2850{ 2833{
@@ -2864,9 +2847,7 @@ static bool switch_to_kernel_context_sync(struct drm_i915_private *i915,
2864 I915_GEM_IDLE_TIMEOUT)) 2847 I915_GEM_IDLE_TIMEOUT))
2865 result = false; 2848 result = false;
2866 2849
2867 if (result) { 2850 if (!result) {
2868 assert_kernel_context_is_current(i915);
2869 } else {
2870 /* Forcibly cancel outstanding work and leave the gpu quiet. */ 2851 /* Forcibly cancel outstanding work and leave the gpu quiet. */
2871 dev_err(i915->drm.dev, 2852 dev_err(i915->drm.dev,
2872 "Failed to idle engines, declaring wedged!\n"); 2853 "Failed to idle engines, declaring wedged!\n");
diff --git a/drivers/gpu/drm/i915/i915_gem_evict.c b/drivers/gpu/drm/i915/i915_gem_evict.c
index 7d8e90dfca84..060f5903544a 100644
--- a/drivers/gpu/drm/i915/i915_gem_evict.c
+++ b/drivers/gpu/drm/i915/i915_gem_evict.c
@@ -38,25 +38,15 @@ I915_SELFTEST_DECLARE(static struct igt_evict_ctl {
38 38
39static bool ggtt_is_idle(struct drm_i915_private *i915) 39static bool ggtt_is_idle(struct drm_i915_private *i915)
40{ 40{
41 struct intel_engine_cs *engine; 41 return !i915->gt.active_requests;
42 enum intel_engine_id id;
43
44 if (i915->gt.active_requests)
45 return false;
46
47 for_each_engine(engine, i915, id) {
48 if (!intel_engine_has_kernel_context(engine))
49 return false;
50 }
51
52 return true;
53} 42}
54 43
55static int ggtt_flush(struct drm_i915_private *i915) 44static int ggtt_flush(struct drm_i915_private *i915)
56{ 45{
57 int err; 46 int err;
58 47
59 /* Not everything in the GGTT is tracked via vma (otherwise we 48 /*
49 * Not everything in the GGTT is tracked via vma (otherwise we
60 * could evict as required with minimal stalling) so we are forced 50 * could evict as required with minimal stalling) so we are forced
61 * to idle the GPU and explicitly retire outstanding requests in 51 * to idle the GPU and explicitly retire outstanding requests in
62 * the hopes that we can then remove contexts and the like only 52 * the hopes that we can then remove contexts and the like only
diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c b/drivers/gpu/drm/i915/intel_engine_cs.c
index 18174f808fd8..8e326556499e 100644
--- a/drivers/gpu/drm/i915/intel_engine_cs.c
+++ b/drivers/gpu/drm/i915/intel_engine_cs.c
@@ -1090,37 +1090,6 @@ bool intel_engines_are_idle(struct drm_i915_private *i915)
1090 return true; 1090 return true;
1091} 1091}
1092 1092
1093/**
1094 * intel_engine_has_kernel_context:
1095 * @engine: the engine
1096 *
1097 * Returns true if the last context to be executed on this engine, or has been
1098 * executed if the engine is already idle, is the kernel context
1099 * (#i915.kernel_context).
1100 */
1101bool intel_engine_has_kernel_context(const struct intel_engine_cs *engine)
1102{
1103 const struct intel_context *kernel_context =
1104 to_intel_context(engine->i915->kernel_context, engine);
1105 struct i915_request *rq;
1106
1107 lockdep_assert_held(&engine->i915->drm.struct_mutex);
1108
1109 if (!engine->context_size)
1110 return true;
1111
1112 /*
1113 * Check the last context seen by the engine. If active, it will be
1114 * the last request that remains in the timeline. When idle, it is
1115 * the last executed context as tracked by retirement.
1116 */
1117 rq = __i915_active_request_peek(&engine->timeline.last_request);
1118 if (rq)
1119 return rq->hw_context == kernel_context;
1120 else
1121 return engine->last_retired_context == kernel_context;
1122}
1123
1124void intel_engines_reset_default_submission(struct drm_i915_private *i915) 1093void intel_engines_reset_default_submission(struct drm_i915_private *i915)
1125{ 1094{
1126 struct intel_engine_cs *engine; 1095 struct intel_engine_cs *engine;
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
index 84b7047e2df5..9ccbe63d46e3 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.h
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
@@ -935,7 +935,6 @@ void intel_engines_sanitize(struct drm_i915_private *i915, bool force);
935bool intel_engine_is_idle(struct intel_engine_cs *engine); 935bool intel_engine_is_idle(struct intel_engine_cs *engine);
936bool intel_engines_are_idle(struct drm_i915_private *dev_priv); 936bool intel_engines_are_idle(struct drm_i915_private *dev_priv);
937 937
938bool intel_engine_has_kernel_context(const struct intel_engine_cs *engine);
939void intel_engine_lost_context(struct intel_engine_cs *engine); 938void intel_engine_lost_context(struct intel_engine_cs *engine);
940 939
941void intel_engines_park(struct drm_i915_private *i915); 940void intel_engines_park(struct drm_i915_private *i915);