Skip to content

Commit

Permalink
drm/i915: Stop passing I915_WAIT_LOCKED to i915_request_wait()
Browse files Browse the repository at this point in the history
Since commit eb8d0f5 ("drm/i915: Remove GPU reset dependence on
struct_mutex"), the I915_WAIT_LOCKED flags passed to i915_request_wait()
has been defunct. Now go ahead and remove it from all callers.

References: eb8d0f5 ("drm/i915: Remove GPU reset dependence on struct_mutex")
Signed-off-by: Chris Wilson <[email protected]>
Reviewed-by: Mika Kuoppala <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
  • Loading branch information
ickle committed Jun 19, 2019
1 parent 7359134 commit 2f53094
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 66 deletions.
14 changes: 4 additions & 10 deletions drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ static int live_nop_switch(void *arg)
}
i915_request_add(rq);
}
if (i915_request_wait(rq,
I915_WAIT_LOCKED,
HZ / 5) < 0) {
if (i915_request_wait(rq, 0, HZ / 5) < 0) {
pr_err("Failed to populated %d contexts\n", nctx);
i915_gem_set_wedged(i915);
err = -EIO;
Expand Down Expand Up @@ -128,9 +126,7 @@ static int live_nop_switch(void *arg)

i915_request_add(rq);
}
if (i915_request_wait(rq,
I915_WAIT_LOCKED,
HZ / 5) < 0) {
if (i915_request_wait(rq, 0, HZ / 5) < 0) {
pr_err("Switching between %ld contexts timed out\n",
prime);
i915_gem_set_wedged(i915);
Expand Down Expand Up @@ -893,7 +889,7 @@ __read_slice_count(struct drm_i915_private *i915,
if (spin)
igt_spinner_end(spin);

ret = i915_request_wait(rq, I915_WAIT_LOCKED, MAX_SCHEDULE_TIMEOUT);
ret = i915_request_wait(rq, 0, MAX_SCHEDULE_TIMEOUT);
i915_request_put(rq);
if (ret < 0)
return ret;
Expand Down Expand Up @@ -980,9 +976,7 @@ __sseu_finish(struct drm_i915_private *i915,
igt_spinner_end(spin);

if ((flags & TEST_IDLE) && ret == 0) {
ret = i915_gem_wait_for_idle(i915,
I915_WAIT_LOCKED,
MAX_SCHEDULE_TIMEOUT);
ret = i915_gem_wait_for_idle(i915, 0, MAX_SCHEDULE_TIMEOUT);
if (ret)
return ret;

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/i915/gt/intel_ringbuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1815,7 +1815,7 @@ static noinline int wait_for_space(struct intel_ring *ring, unsigned int bytes)
return -ENOSPC;

timeout = i915_request_wait(target,
I915_WAIT_INTERRUPTIBLE | I915_WAIT_LOCKED,
I915_WAIT_INTERRUPTIBLE,
MAX_SCHEDULE_TIMEOUT);
if (timeout < 0)
return timeout;
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/i915/gt/intel_workarounds.c
Original file line number Diff line number Diff line change
Expand Up @@ -1435,7 +1435,7 @@ static int engine_wa_list_verify(struct intel_context *ce,
goto err_vma;

i915_request_add(rq);
if (i915_request_wait(rq, I915_WAIT_LOCKED, HZ / 5) < 0) {
if (i915_request_wait(rq, 0, HZ / 5) < 0) {
err = -ETIME;
goto err_vma;
}
Expand Down
9 changes: 3 additions & 6 deletions drivers/gpu/drm/i915/gt/selftest_hangcheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,7 @@ static int igt_hang_sanitycheck(void *arg)

timeout = 0;
igt_wedge_on_timeout(&w, i915, HZ / 10 /* 100ms timeout*/)
timeout = i915_request_wait(rq,
I915_WAIT_LOCKED,
timeout = i915_request_wait(rq, 0,
MAX_SCHEDULE_TIMEOUT);
if (i915_reset_failed(i915))
timeout = -EIO;
Expand Down Expand Up @@ -1098,7 +1097,7 @@ static int igt_reset_wait(void *arg)

reset_count = fake_hangcheck(i915, ALL_ENGINES);

timeout = i915_request_wait(rq, I915_WAIT_LOCKED, 10);
timeout = i915_request_wait(rq, 0, 10);
if (timeout < 0) {
pr_err("i915_request_wait failed on a stuck request: err=%ld\n",
timeout);
Expand Down Expand Up @@ -1666,9 +1665,7 @@ static int igt_atomic_reset_engine(struct intel_engine_cs *engine,
struct igt_wedge_me w;

igt_wedge_on_timeout(&w, i915, HZ / 20 /* 50ms timeout*/)
i915_request_wait(rq,
I915_WAIT_LOCKED,
MAX_SCHEDULE_TIMEOUT);
i915_request_wait(rq, 0, MAX_SCHEDULE_TIMEOUT);
if (i915_reset_failed(i915))
err = -EIO;
}
Expand Down
24 changes: 9 additions & 15 deletions drivers/gpu/drm/i915/gt/selftest_lrc.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ static int live_busywait_preempt(void *arg)
}

/* Low priority request should be busywaiting now */
if (i915_request_wait(lo, I915_WAIT_LOCKED, 1) != -ETIME) {
if (i915_request_wait(lo, 0, 1) != -ETIME) {
pr_err("%s: Busywaiting request did not!\n",
engine->name);
err = -EIO;
Expand Down Expand Up @@ -220,7 +220,7 @@ static int live_busywait_preempt(void *arg)
intel_ring_advance(hi, cs);
i915_request_add(hi);

if (i915_request_wait(lo, I915_WAIT_LOCKED, HZ / 5) < 0) {
if (i915_request_wait(lo, 0, HZ / 5) < 0) {
struct drm_printer p = drm_info_printer(i915->drm.dev);

pr_err("%s: Failed to preempt semaphore busywait!\n",
Expand Down Expand Up @@ -739,7 +739,6 @@ static int live_suppress_wait_preempt(void *arg)
GEM_BUG_ON(!i915_request_started(rq[0]));

if (i915_request_wait(rq[depth],
I915_WAIT_LOCKED |
I915_WAIT_PRIORITY,
1) != -ETIME) {
pr_err("%s: Waiter depth:%d completed!\n",
Expand Down Expand Up @@ -841,7 +840,7 @@ static int live_chain_preempt(void *arg)
__func__, engine->name, ring_size);

igt_spinner_end(&lo.spin);
if (i915_request_wait(rq, I915_WAIT_LOCKED, HZ / 2) < 0) {
if (i915_request_wait(rq, 0, HZ / 2) < 0) {
pr_err("Timed out waiting to flush %s\n", engine->name);
goto err_wedged;
}
Expand Down Expand Up @@ -882,7 +881,7 @@ static int live_chain_preempt(void *arg)
engine->schedule(rq, &attr);

igt_spinner_end(&hi.spin);
if (i915_request_wait(rq, I915_WAIT_LOCKED, HZ / 5) < 0) {
if (i915_request_wait(rq, 0, HZ / 5) < 0) {
struct drm_printer p =
drm_info_printer(i915->drm.dev);

Expand All @@ -898,7 +897,7 @@ static int live_chain_preempt(void *arg)
if (IS_ERR(rq))
goto err_wedged;
i915_request_add(rq);
if (i915_request_wait(rq, I915_WAIT_LOCKED, HZ / 5) < 0) {
if (i915_request_wait(rq, 0, HZ / 5) < 0) {
struct drm_printer p =
drm_info_printer(i915->drm.dev);

Expand Down Expand Up @@ -1396,9 +1395,7 @@ static int nop_virtual_engine(struct drm_i915_private *i915,
}

for (nc = 0; nc < nctx; nc++) {
if (i915_request_wait(request[nc],
I915_WAIT_LOCKED,
HZ / 10) < 0) {
if (i915_request_wait(request[nc], 0, HZ / 10) < 0) {
pr_err("%s(%s): wait for %llx:%lld timed out\n",
__func__, ve[0]->engine->name,
request[nc]->fence.context,
Expand Down Expand Up @@ -1545,7 +1542,7 @@ static int mask_virtual_engine(struct drm_i915_private *i915,
}

for (n = 0; n < nsibling; n++) {
if (i915_request_wait(request[n], I915_WAIT_LOCKED, HZ / 10) < 0) {
if (i915_request_wait(request[n], 0, HZ / 10) < 0) {
pr_err("%s(%s): wait for %llx:%lld timed out\n",
__func__, ve->engine->name,
request[n]->fence.context,
Expand Down Expand Up @@ -1720,18 +1717,15 @@ static int bond_virtual_engine(struct drm_i915_private *i915,
}
onstack_fence_fini(&fence);

if (i915_request_wait(rq[0],
I915_WAIT_LOCKED,
HZ / 10) < 0) {
if (i915_request_wait(rq[0], 0, HZ / 10) < 0) {
pr_err("Master request did not execute (on %s)!\n",
rq[0]->engine->name);
err = -EIO;
goto out;
}

for (n = 0; n < nsibling; n++) {
if (i915_request_wait(rq[n + 1],
I915_WAIT_LOCKED,
if (i915_request_wait(rq[n + 1], 0,
MAX_SCHEDULE_TIMEOUT) < 0) {
err = -EIO;
goto out;
Expand Down
6 changes: 3 additions & 3 deletions drivers/gpu/drm/i915/gt/selftest_workarounds.c
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ static int check_dirty_whitelist(struct i915_gem_context *ctx,
if (err)
goto out_batch;

if (i915_request_wait(rq, I915_WAIT_LOCKED, HZ / 5) < 0) {
if (i915_request_wait(rq, 0, HZ / 5) < 0) {
pr_err("%s: Futzing %x timedout; cancelling test\n",
engine->name, reg);
i915_gem_set_wedged(ctx->i915);
Expand Down Expand Up @@ -769,7 +769,7 @@ static int read_whitelisted_registers(struct i915_gem_context *ctx,
err_req:
i915_request_add(rq);

if (i915_request_wait(rq, I915_WAIT_LOCKED, HZ / 5) < 0)
if (i915_request_wait(rq, 0, HZ / 5) < 0)
err = -EIO;

return err;
Expand Down Expand Up @@ -825,7 +825,7 @@ static int scrub_whitelisted_registers(struct i915_gem_context *ctx,

err_request:
i915_request_add(rq);
if (i915_request_wait(rq, I915_WAIT_LOCKED, HZ / 5) < 0)
if (i915_request_wait(rq, 0, HZ / 5) < 0)
err = -EIO;

err_unpin:
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/i915/i915_active.h
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ i915_active_request_retire(struct i915_active_request *active,
return 0;

ret = i915_request_wait(request,
I915_WAIT_INTERRUPTIBLE | I915_WAIT_LOCKED,
I915_WAIT_INTERRUPTIBLE,
MAX_SCHEDULE_TIMEOUT);
if (ret < 0)
return ret;
Expand Down
4 changes: 0 additions & 4 deletions drivers/gpu/drm/i915/i915_request.c
Original file line number Diff line number Diff line change
Expand Up @@ -1360,10 +1360,6 @@ static void request_wait_wake(struct dma_fence *fence, struct dma_fence_cb *cb)
* maximum of @timeout jiffies (with MAX_SCHEDULE_TIMEOUT implying an
* unbounded wait).
*
* If the caller holds the struct_mutex, the caller must pass I915_WAIT_LOCKED
* in via the flags, and vice versa if the struct_mutex is not held, the caller
* must not specify that the wait is locked.
*
* Returns the remaining time (in jiffies) if the request completed, which may
* be zero or -ETIME if the request is unfinished after the timeout expires.
* May return -EINTR is called with I915_WAIT_INTERRUPTIBLE and a signal is
Expand Down
3 changes: 1 addition & 2 deletions drivers/gpu/drm/i915/i915_trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -863,10 +863,9 @@ TRACE_EVENT(i915_request_wait_begin,
__entry->flags = flags;
),

TP_printk("dev=%u, engine=%u:%u, hw_id=%u, ctx=%llu, seqno=%u, blocking=%u, flags=0x%x",
TP_printk("dev=%u, engine=%u:%u, hw_id=%u, ctx=%llu, seqno=%u, flags=0x%x",
__entry->dev, __entry->class, __entry->instance,
__entry->hw_id, __entry->ctx, __entry->seqno,
!!(__entry->flags & I915_WAIT_LOCKED),
__entry->flags)
);

Expand Down
30 changes: 11 additions & 19 deletions drivers/gpu/drm/i915/selftests/i915_request.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ static int igt_wait_request(void *arg)
goto out_unlock;
}

if (i915_request_wait(request, I915_WAIT_LOCKED, 0) != -ETIME) {
if (i915_request_wait(request, 0, 0) != -ETIME) {
pr_err("request wait (busy query) succeeded (expected timeout before submit!)\n");
goto out_unlock;
}

if (i915_request_wait(request, I915_WAIT_LOCKED, T) != -ETIME) {
if (i915_request_wait(request, 0, T) != -ETIME) {
pr_err("request wait succeeded (expected timeout before submit!)\n");
goto out_unlock;
}
Expand All @@ -91,7 +91,7 @@ static int igt_wait_request(void *arg)

i915_request_add(request);

if (i915_request_wait(request, I915_WAIT_LOCKED, 0) != -ETIME) {
if (i915_request_wait(request, 0, 0) != -ETIME) {
pr_err("request wait (busy query) succeeded (expected timeout after submit!)\n");
goto out_unlock;
}
Expand All @@ -101,12 +101,12 @@ static int igt_wait_request(void *arg)
goto out_unlock;
}

if (i915_request_wait(request, I915_WAIT_LOCKED, T / 2) != -ETIME) {
if (i915_request_wait(request, 0, T / 2) != -ETIME) {
pr_err("request wait succeeded (expected timeout!)\n");
goto out_unlock;
}

if (i915_request_wait(request, I915_WAIT_LOCKED, T) == -ETIME) {
if (i915_request_wait(request, 0, T) == -ETIME) {
pr_err("request wait timed out!\n");
goto out_unlock;
}
Expand All @@ -116,7 +116,7 @@ static int igt_wait_request(void *arg)
goto out_unlock;
}

if (i915_request_wait(request, I915_WAIT_LOCKED, T) == -ETIME) {
if (i915_request_wait(request, 0, T) == -ETIME) {
pr_err("request wait timed out when already complete!\n");
goto out_unlock;
}
Expand Down Expand Up @@ -574,9 +574,7 @@ static int live_nop_request(void *arg)

i915_request_add(request);
}
i915_request_wait(request,
I915_WAIT_LOCKED,
MAX_SCHEDULE_TIMEOUT);
i915_request_wait(request, 0, MAX_SCHEDULE_TIMEOUT);

times[1] = ktime_sub(ktime_get_raw(), times[1]);
if (prime == 1)
Expand Down Expand Up @@ -706,9 +704,7 @@ static int live_empty_request(void *arg)
err = PTR_ERR(request);
goto out_batch;
}
i915_request_wait(request,
I915_WAIT_LOCKED,
MAX_SCHEDULE_TIMEOUT);
i915_request_wait(request, 0, MAX_SCHEDULE_TIMEOUT);

for_each_prime_number_from(prime, 1, 8192) {
times[1] = ktime_get_raw();
Expand All @@ -720,9 +716,7 @@ static int live_empty_request(void *arg)
goto out_batch;
}
}
i915_request_wait(request,
I915_WAIT_LOCKED,
MAX_SCHEDULE_TIMEOUT);
i915_request_wait(request, 0, MAX_SCHEDULE_TIMEOUT);

times[1] = ktime_sub(ktime_get_raw(), times[1]);
if (prime == 1)
Expand Down Expand Up @@ -895,8 +889,7 @@ static int live_all_engines(void *arg)
for_each_engine(engine, i915, id) {
long timeout;

timeout = i915_request_wait(request[id],
I915_WAIT_LOCKED,
timeout = i915_request_wait(request[id], 0,
MAX_SCHEDULE_TIMEOUT);
if (timeout < 0) {
err = timeout;
Expand Down Expand Up @@ -1013,8 +1006,7 @@ static int live_sequential_engines(void *arg)
goto out_request;
}

timeout = i915_request_wait(request[id],
I915_WAIT_LOCKED,
timeout = i915_request_wait(request[id], 0,
MAX_SCHEDULE_TIMEOUT);
if (timeout < 0) {
err = timeout;
Expand Down
6 changes: 2 additions & 4 deletions drivers/gpu/drm/i915/selftests/i915_timeline.c
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ static int live_hwsp_wrap(void *arg)

i915_request_add(rq);

if (i915_request_wait(rq, I915_WAIT_LOCKED, HZ / 5) < 0) {
if (i915_request_wait(rq, 0, HZ / 5) < 0) {
pr_err("Wait for timeline writes timed out!\n");
err = -EIO;
goto out;
Expand Down Expand Up @@ -797,9 +797,7 @@ static int live_hwsp_recycle(void *arg)
goto out;
}

if (i915_request_wait(rq,
I915_WAIT_LOCKED,
HZ / 5) < 0) {
if (i915_request_wait(rq, 0, HZ / 5) < 0) {
pr_err("Wait for timeline writes timed out!\n");
i915_timeline_put(tl);
err = -EIO;
Expand Down

0 comments on commit 2f53094

Please sign in to comment.