drm/i915: Reduce test_and_set_bit to set_bit in i915_request_submit()

Avoid the full blown memory barrier of test_and_set_bit() by noting the
completed request and removing it from the lists.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Andi Shyti <andi.shyti@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210114135612.13210-5-chris@chris-wilson.co.uk
This commit is contained in:
Chris Wilson 2021-01-14 13:56:12 +00:00
Родитель 2d60d3e0a2
Коммит 9736387a9f
1 изменённых файлов: 9 добавлений и 7 удалений

Просмотреть файл

@ -551,8 +551,10 @@ bool __i915_request_submit(struct i915_request *request)
* dropped upon retiring. (Otherwise if resubmit a *retired* * dropped upon retiring. (Otherwise if resubmit a *retired*
* request, this would be a horrible use-after-free.) * request, this would be a horrible use-after-free.)
*/ */
if (__i915_request_is_complete(request)) if (__i915_request_is_complete(request)) {
goto xfer; list_del_init(&request->sched.link);
goto active;
}
if (unlikely(intel_context_is_banned(request->context))) if (unlikely(intel_context_is_banned(request->context)))
i915_request_set_error_once(request, -EIO); i915_request_set_error_once(request, -EIO);
@ -587,11 +589,11 @@ bool __i915_request_submit(struct i915_request *request)
engine->serial++; engine->serial++;
result = true; result = true;
xfer: GEM_BUG_ON(test_bit(I915_FENCE_FLAG_ACTIVE, &request->fence.flags));
if (!test_and_set_bit(I915_FENCE_FLAG_ACTIVE, &request->fence.flags)) { list_move_tail(&request->sched.link, &engine->active.requests);
list_move_tail(&request->sched.link, &engine->active.requests); active:
clear_bit(I915_FENCE_FLAG_PQUEUE, &request->fence.flags); clear_bit(I915_FENCE_FLAG_PQUEUE, &request->fence.flags);
} set_bit(I915_FENCE_FLAG_ACTIVE, &request->fence.flags);
/* /*
* XXX Rollback bonded-execution on __i915_request_unsubmit()? * XXX Rollback bonded-execution on __i915_request_unsubmit()?