diff options
| author | Chris Wilson <chris@chris-wilson.co.uk> | 2018-05-17 17:26:30 -0400 |
|---|---|---|
| committer | Chris Wilson <chris@chris-wilson.co.uk> | 2018-05-18 04:35:17 -0400 |
| commit | 4e0d64dba816adf18c17488d38ede67a3d0e9b40 (patch) | |
| tree | 76243fca2f9e23ab2f127f6d5aa1fc636c83f0b5 | |
| parent | c8af5274c3cbacb0905a26bcdef85901216e1134 (diff) | |
drm/i915: Move request->ctx aside
In the next patch, we want to store the intel_context pointer inside
i915_request, as it is frequently access via a convoluted dance when
submitting the request to hw. Having two context pointers inside
i915_request leads to confusion so first rename the existing
i915_gem_context pointer to i915_request.gem_context.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180517212633.24934-1-chris@chris-wilson.co.uk
| -rw-r--r-- | drivers/gpu/drm/i915/gvt/scheduler.c | 4 | ||||
| -rw-r--r-- | drivers/gpu/drm/i915/i915_debugfs.c | 4 | ||||
| -rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 10 | ||||
| -rw-r--r-- | drivers/gpu/drm/i915/i915_gpu_error.c | 18 | ||||
| -rw-r--r-- | drivers/gpu/drm/i915/i915_request.c | 12 | ||||
| -rw-r--r-- | drivers/gpu/drm/i915/i915_request.h | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/i915/i915_trace.h | 10 | ||||
| -rw-r--r-- | drivers/gpu/drm/i915/intel_engine_cs.c | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/i915/intel_guc_submission.c | 7 | ||||
| -rw-r--r-- | drivers/gpu/drm/i915/intel_lrc.c | 31 | ||||
| -rw-r--r-- | drivers/gpu/drm/i915/intel_ringbuffer.c | 12 | ||||
| -rw-r--r-- | drivers/gpu/drm/i915/selftests/intel_hangcheck.c | 5 | ||||
| -rw-r--r-- | drivers/gpu/drm/i915/selftests/intel_lrc.c | 2 |
13 files changed, 64 insertions, 55 deletions
diff --git a/drivers/gpu/drm/i915/gvt/scheduler.c b/drivers/gpu/drm/i915/gvt/scheduler.c index c2d183b91500..17f9f8d7e148 100644 --- a/drivers/gpu/drm/i915/gvt/scheduler.c +++ b/drivers/gpu/drm/i915/gvt/scheduler.c | |||
| @@ -205,7 +205,7 @@ static int populate_shadow_context(struct intel_vgpu_workload *workload) | |||
| 205 | 205 | ||
| 206 | static inline bool is_gvt_request(struct i915_request *req) | 206 | static inline bool is_gvt_request(struct i915_request *req) |
| 207 | { | 207 | { |
| 208 | return i915_gem_context_force_single_submission(req->ctx); | 208 | return i915_gem_context_force_single_submission(req->gem_context); |
| 209 | } | 209 | } |
| 210 | 210 | ||
| 211 | static void save_ring_hw_state(struct intel_vgpu *vgpu, int ring_id) | 211 | static void save_ring_hw_state(struct intel_vgpu *vgpu, int ring_id) |
| @@ -305,7 +305,7 @@ static int copy_workload_to_ring_buffer(struct intel_vgpu_workload *workload) | |||
| 305 | struct i915_request *req = workload->req; | 305 | struct i915_request *req = workload->req; |
| 306 | 306 | ||
| 307 | if (IS_KABYLAKE(req->i915) && | 307 | if (IS_KABYLAKE(req->i915) && |
| 308 | is_inhibit_context(req->ctx, req->engine->id)) | 308 | is_inhibit_context(req->gem_context, req->engine->id)) |
| 309 | intel_vgpu_restore_inhibit_context(vgpu, req); | 309 | intel_vgpu_restore_inhibit_context(vgpu, req); |
| 310 | 310 | ||
| 311 | /* allocate shadow ring buffer */ | 311 | /* allocate shadow ring buffer */ |
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index d78beaabc051..52515445ac40 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c | |||
| @@ -542,8 +542,8 @@ static int i915_gem_object_info(struct seq_file *m, void *data) | |||
| 542 | struct i915_request, | 542 | struct i915_request, |
| 543 | client_link); | 543 | client_link); |
| 544 | rcu_read_lock(); | 544 | rcu_read_lock(); |
| 545 | task = pid_task(request && request->ctx->pid ? | 545 | task = pid_task(request && request->gem_context->pid ? |
| 546 | request->ctx->pid : file->pid, | 546 | request->gem_context->pid : file->pid, |
| 547 | PIDTYPE_PID); | 547 | PIDTYPE_PID); |
| 548 | print_file_stats(m, task ? task->comm : "<unknown>", stats); | 548 | print_file_stats(m, task ? task->comm : "<unknown>", stats); |
| 549 | rcu_read_unlock(); | 549 | rcu_read_unlock(); |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index b0fe452ce17c..a20f8db5729d 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
| @@ -3067,7 +3067,7 @@ static void skip_request(struct i915_request *request) | |||
| 3067 | static void engine_skip_context(struct i915_request *request) | 3067 | static void engine_skip_context(struct i915_request *request) |
| 3068 | { | 3068 | { |
| 3069 | struct intel_engine_cs *engine = request->engine; | 3069 | struct intel_engine_cs *engine = request->engine; |
| 3070 | struct i915_gem_context *hung_ctx = request->ctx; | 3070 | struct i915_gem_context *hung_ctx = request->gem_context; |
| 3071 | struct i915_timeline *timeline = request->timeline; | 3071 | struct i915_timeline *timeline = request->timeline; |
| 3072 | unsigned long flags; | 3072 | unsigned long flags; |
| 3073 | 3073 | ||
| @@ -3077,7 +3077,7 @@ static void engine_skip_context(struct i915_request *request) | |||
| 3077 | spin_lock_nested(&timeline->lock, SINGLE_DEPTH_NESTING); | 3077 | spin_lock_nested(&timeline->lock, SINGLE_DEPTH_NESTING); |
| 3078 | 3078 | ||
| 3079 | list_for_each_entry_continue(request, &engine->timeline.requests, link) | 3079 | list_for_each_entry_continue(request, &engine->timeline.requests, link) |
| 3080 | if (request->ctx == hung_ctx) | 3080 | if (request->gem_context == hung_ctx) |
| 3081 | skip_request(request); | 3081 | skip_request(request); |
| 3082 | 3082 | ||
| 3083 | list_for_each_entry(request, &timeline->requests, link) | 3083 | list_for_each_entry(request, &timeline->requests, link) |
| @@ -3123,11 +3123,11 @@ i915_gem_reset_request(struct intel_engine_cs *engine, | |||
| 3123 | } | 3123 | } |
| 3124 | 3124 | ||
| 3125 | if (stalled) { | 3125 | if (stalled) { |
| 3126 | i915_gem_context_mark_guilty(request->ctx); | 3126 | i915_gem_context_mark_guilty(request->gem_context); |
| 3127 | skip_request(request); | 3127 | skip_request(request); |
| 3128 | 3128 | ||
| 3129 | /* If this context is now banned, skip all pending requests. */ | 3129 | /* If this context is now banned, skip all pending requests. */ |
| 3130 | if (i915_gem_context_is_banned(request->ctx)) | 3130 | if (i915_gem_context_is_banned(request->gem_context)) |
| 3131 | engine_skip_context(request); | 3131 | engine_skip_context(request); |
| 3132 | } else { | 3132 | } else { |
| 3133 | /* | 3133 | /* |
| @@ -3137,7 +3137,7 @@ i915_gem_reset_request(struct intel_engine_cs *engine, | |||
| 3137 | */ | 3137 | */ |
| 3138 | request = i915_gem_find_active_request(engine); | 3138 | request = i915_gem_find_active_request(engine); |
| 3139 | if (request) { | 3139 | if (request) { |
| 3140 | i915_gem_context_mark_innocent(request->ctx); | 3140 | i915_gem_context_mark_innocent(request->gem_context); |
| 3141 | dma_fence_set_error(&request->fence, -EAGAIN); | 3141 | dma_fence_set_error(&request->fence, -EAGAIN); |
| 3142 | 3142 | ||
| 3143 | /* Rewind the engine to replay the incomplete rq */ | 3143 | /* Rewind the engine to replay the incomplete rq */ |
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c index efb808272460..37c9a42654ba 100644 --- a/drivers/gpu/drm/i915/i915_gpu_error.c +++ b/drivers/gpu/drm/i915/i915_gpu_error.c | |||
| @@ -1287,9 +1287,11 @@ static void error_record_engine_registers(struct i915_gpu_state *error, | |||
| 1287 | static void record_request(struct i915_request *request, | 1287 | static void record_request(struct i915_request *request, |
| 1288 | struct drm_i915_error_request *erq) | 1288 | struct drm_i915_error_request *erq) |
| 1289 | { | 1289 | { |
| 1290 | erq->context = request->ctx->hw_id; | 1290 | struct i915_gem_context *ctx = request->gem_context; |
| 1291 | |||
| 1292 | erq->context = ctx->hw_id; | ||
| 1291 | erq->sched_attr = request->sched.attr; | 1293 | erq->sched_attr = request->sched.attr; |
| 1292 | erq->ban_score = atomic_read(&request->ctx->ban_score); | 1294 | erq->ban_score = atomic_read(&ctx->ban_score); |
| 1293 | erq->seqno = request->global_seqno; | 1295 | erq->seqno = request->global_seqno; |
| 1294 | erq->jiffies = request->emitted_jiffies; | 1296 | erq->jiffies = request->emitted_jiffies; |
| 1295 | erq->start = i915_ggtt_offset(request->ring->vma); | 1297 | erq->start = i915_ggtt_offset(request->ring->vma); |
| @@ -1297,7 +1299,7 @@ static void record_request(struct i915_request *request, | |||
| 1297 | erq->tail = request->tail; | 1299 | erq->tail = request->tail; |
| 1298 | 1300 | ||
| 1299 | rcu_read_lock(); | 1301 | rcu_read_lock(); |
| 1300 | erq->pid = request->ctx->pid ? pid_nr(request->ctx->pid) : 0; | 1302 | erq->pid = ctx->pid ? pid_nr(ctx->pid) : 0; |
| 1301 | rcu_read_unlock(); | 1303 | rcu_read_unlock(); |
| 1302 | } | 1304 | } |
| 1303 | 1305 | ||
| @@ -1461,12 +1463,12 @@ static void gem_record_rings(struct i915_gpu_state *error) | |||
| 1461 | 1463 | ||
| 1462 | request = i915_gem_find_active_request(engine); | 1464 | request = i915_gem_find_active_request(engine); |
| 1463 | if (request) { | 1465 | if (request) { |
| 1466 | struct i915_gem_context *ctx = request->gem_context; | ||
| 1464 | struct intel_ring *ring; | 1467 | struct intel_ring *ring; |
| 1465 | 1468 | ||
| 1466 | ee->vm = request->ctx->ppgtt ? | 1469 | ee->vm = ctx->ppgtt ? &ctx->ppgtt->base : &ggtt->base; |
| 1467 | &request->ctx->ppgtt->base : &ggtt->base; | ||
| 1468 | 1470 | ||
| 1469 | record_context(&ee->context, request->ctx); | 1471 | record_context(&ee->context, ctx); |
| 1470 | 1472 | ||
| 1471 | /* We need to copy these to an anonymous buffer | 1473 | /* We need to copy these to an anonymous buffer |
| 1472 | * as the simplest method to avoid being overwritten | 1474 | * as the simplest method to avoid being overwritten |
| @@ -1483,11 +1485,11 @@ static void gem_record_rings(struct i915_gpu_state *error) | |||
| 1483 | 1485 | ||
| 1484 | ee->ctx = | 1486 | ee->ctx = |
| 1485 | i915_error_object_create(i915, | 1487 | i915_error_object_create(i915, |
| 1486 | to_intel_context(request->ctx, | 1488 | to_intel_context(ctx, |
| 1487 | engine)->state); | 1489 | engine)->state); |
| 1488 | 1490 | ||
| 1489 | error->simulated |= | 1491 | error->simulated |= |
| 1490 | i915_gem_context_no_error_capture(request->ctx); | 1492 | i915_gem_context_no_error_capture(ctx); |
| 1491 | 1493 | ||
| 1492 | ee->rq_head = request->head; | 1494 | ee->rq_head = request->head; |
| 1493 | ee->rq_post = request->postfix; | 1495 | ee->rq_post = request->postfix; |
diff --git a/drivers/gpu/drm/i915/i915_request.c b/drivers/gpu/drm/i915/i915_request.c index 8928894dd9c7..fe8810a6a339 100644 --- a/drivers/gpu/drm/i915/i915_request.c +++ b/drivers/gpu/drm/i915/i915_request.c | |||
| @@ -384,7 +384,7 @@ static void __retire_engine_request(struct intel_engine_cs *engine, | |||
| 384 | */ | 384 | */ |
| 385 | if (engine->last_retired_context) | 385 | if (engine->last_retired_context) |
| 386 | intel_context_unpin(engine->last_retired_context, engine); | 386 | intel_context_unpin(engine->last_retired_context, engine); |
| 387 | engine->last_retired_context = rq-& | ||
