Commit 66e40750 authored by Chris Wilson's avatar Chris Wilson

drm/i915/gt: Shrink the critical section for irq signaling

Let's only wait for the list iterator when decoupling the virtual
breadcrumb, as the signaling of all the requests may take a long time,
during which we do not want to keep the tasklet spinning.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarMatthew Brost <matthew.brost@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201224135544.1713-6-chris@chris-wilson.co.uk
parent bab0557c
...@@ -234,6 +234,7 @@ static void signal_irq_work(struct irq_work *work) ...@@ -234,6 +234,7 @@ static void signal_irq_work(struct irq_work *work)
intel_breadcrumbs_disarm_irq(b); intel_breadcrumbs_disarm_irq(b);
rcu_read_lock(); rcu_read_lock();
atomic_inc(&b->signaler_active);
list_for_each_entry_rcu(ce, &b->signalers, signal_link) { list_for_each_entry_rcu(ce, &b->signalers, signal_link) {
struct i915_request *rq; struct i915_request *rq;
...@@ -269,6 +270,7 @@ static void signal_irq_work(struct irq_work *work) ...@@ -269,6 +270,7 @@ static void signal_irq_work(struct irq_work *work)
} }
} }
} }
atomic_dec(&b->signaler_active);
rcu_read_unlock(); rcu_read_unlock();
llist_for_each_safe(signal, sn, signal) { llist_for_each_safe(signal, sn, signal) {
......
...@@ -34,6 +34,7 @@ struct intel_breadcrumbs { ...@@ -34,6 +34,7 @@ struct intel_breadcrumbs {
spinlock_t signalers_lock; /* protects the list of signalers */ spinlock_t signalers_lock; /* protects the list of signalers */
struct list_head signalers; struct list_head signalers;
struct llist_head signaled_requests; struct llist_head signaled_requests;
atomic_t signaler_active;
spinlock_t irq_lock; /* protects the interrupt from hardirq context */ spinlock_t irq_lock; /* protects the interrupt from hardirq context */
struct irq_work irq_work; /* for use from inside irq_lock */ struct irq_work irq_work; /* for use from inside irq_lock */
......
...@@ -594,7 +594,8 @@ static void kick_siblings(struct i915_request *rq, struct intel_context *ce) ...@@ -594,7 +594,8 @@ static void kick_siblings(struct i915_request *rq, struct intel_context *ce)
* ce->signal_link. * ce->signal_link.
*/ */
i915_request_cancel_breadcrumb(rq); i915_request_cancel_breadcrumb(rq);
irq_work_sync(&engine->breadcrumbs->irq_work); while (atomic_read(&engine->breadcrumbs->signaler_active))
cpu_relax();
} }
if (READ_ONCE(ve->request)) if (READ_ONCE(ve->request))
......
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