Commit 52144db1 authored by José Roberto de Souza's avatar José Roberto de Souza Committed by Jani Nikula

drm/i915: Fix preallocated barrier list append

Only the first and the last nodes were being added to
ref->preallocated_barriers.

Renaming variables to make it more easy to read.

Fixes: 84135022 ("drm/i915/gt: Drop mutex serialisation between context pin/unpin")
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: default avatarJosé Roberto de Souza <jose.souza@intel.com>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20200129232345.84512-1-jose.souza@intel.com
(cherry picked from commit d4c3c0b8)
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
parent 5b92415e
...@@ -607,7 +607,7 @@ int i915_active_acquire_preallocate_barrier(struct i915_active *ref, ...@@ -607,7 +607,7 @@ int i915_active_acquire_preallocate_barrier(struct i915_active *ref,
struct intel_engine_cs *engine) struct intel_engine_cs *engine)
{ {
intel_engine_mask_t tmp, mask = engine->mask; intel_engine_mask_t tmp, mask = engine->mask;
struct llist_node *pos = NULL, *next; struct llist_node *first = NULL, *last = NULL;
struct intel_gt *gt = engine->gt; struct intel_gt *gt = engine->gt;
int err; int err;
...@@ -625,6 +625,7 @@ int i915_active_acquire_preallocate_barrier(struct i915_active *ref, ...@@ -625,6 +625,7 @@ int i915_active_acquire_preallocate_barrier(struct i915_active *ref,
*/ */
for_each_engine_masked(engine, gt, mask, tmp) { for_each_engine_masked(engine, gt, mask, tmp) {
u64 idx = engine->kernel_context->timeline->fence_context; u64 idx = engine->kernel_context->timeline->fence_context;
struct llist_node *prev = first;
struct active_node *node; struct active_node *node;
node = reuse_idle_barrier(ref, idx); node = reuse_idle_barrier(ref, idx);
...@@ -658,23 +659,23 @@ int i915_active_acquire_preallocate_barrier(struct i915_active *ref, ...@@ -658,23 +659,23 @@ int i915_active_acquire_preallocate_barrier(struct i915_active *ref,
GEM_BUG_ON(rcu_access_pointer(node->base.fence) != ERR_PTR(-EAGAIN)); GEM_BUG_ON(rcu_access_pointer(node->base.fence) != ERR_PTR(-EAGAIN));
GEM_BUG_ON(barrier_to_engine(node) != engine); GEM_BUG_ON(barrier_to_engine(node) != engine);
next = barrier_to_ll(node); first = barrier_to_ll(node);
next->next = pos; first->next = prev;
if (!pos) if (!last)
pos = next; last = first;
intel_engine_pm_get(engine); intel_engine_pm_get(engine);
} }
GEM_BUG_ON(!llist_empty(&ref->preallocated_barriers)); GEM_BUG_ON(!llist_empty(&ref->preallocated_barriers));
llist_add_batch(next, pos, &ref->preallocated_barriers); llist_add_batch(first, last, &ref->preallocated_barriers);
return 0; return 0;
unwind: unwind:
while (pos) { while (first) {
struct active_node *node = barrier_from_ll(pos); struct active_node *node = barrier_from_ll(first);
pos = pos->next; first = first->next;
atomic_dec(&ref->count); atomic_dec(&ref->count);
intel_engine_pm_put(barrier_to_engine(node)); intel_engine_pm_put(barrier_to_engine(node));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment