drm/i915: Don't disable interrupts independently of the lock
Subsystems (2)
PATCH 1/1 drm/i915: Don't disable interrupts independently of the lock
The locks (active.lock and rq->lock) need to be taken with disabled interrupts. This is done in i915_request_retire() by disabling the interrupts independently of the locks itself.
While local_irq_disable()+spin_lock() equals spin_lock_irq() on vanilla it does not on PREEMPT_RT. Also, it is not obvious if there is a special reason to why the interrupts are disabled independently of the lock.
Enable/disable interrupts as part of the locking instruction.
--- drivers/gpu/drm/i915/i915_request.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_request.c +2 -6
@@ -251,15 +251,13 @@ static bool i915_request_retire(struct i active->retire (active, rq); } -local_irq_disable (); -/* * We only loosely track inflight requests across preemption, * and so we may find ourselves attempting to retire a _completed_ * request that we have removed from the HW and put back on a run * queue. */ -spin_lock (&rq->engine->active.lock); +spin_lock_irq (&rq->engine->active.lock);list_del (&rq->sched.link);spin_unlock (&rq->engine->active.lock);
@@ -278,9 +276,7 @@ static bool i915_request_retire(struct i__notify_execute_cb (rq); }GEM_BUG_ON (!list_empty (&rq->execute_cb)); -spin_unlock (&rq->lock); - -local_irq_enable (); +spin_unlock_irq (&rq->lock);remove_from_client (rq);list_del (&rq->link);
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting Sebastian Andrzej Siewior (2019-10-10 17:06:40)
Quoted 34 lines
The locks (active.lock and
rq->lock) need to be taken with disabled interrupts. This is done ini915_request_retire()by disabling the interrupts independently of the locks itself.
While local_irq_disable()+spin_lock() equalsspin_lock_irq()on vanilla it does not onPREEMPT_RT. Also, it is not obvious if there is a special reason to why the interrupts are disabled independently of the lock.Enable/disable interrupts as part of the locking instruction.
Signed-off-by Sebastian Andrzej Siewior <[email protected]>--- drivers/gpu/drm/i915/i915_request.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/i915_request.c +1
-3@@ -251,15 +251,13 @@ static bool i915_request_retire(struct i active->retire (active, rq); } -local_irq_disable (); -/* * We only loosely track inflight requests across preemption, * and so we may find ourselves attempting to retire a _completed_ * request that we have removed from the HW and put back on a run * queue. */ -spin_lock (&rq->engine->active.lock); +spin_lock_irq (&rq->engine->active.lock);list_del (&rq->sched.link);spin_unlock (&rq->engine->active.lock);
drivers/gpu/drm/i915/i915_request.c static bool i915_request_retire(struct i · line 279
Quoted 7 lines
drivers/gpu/drm/i915/i915_request.c +1
-3@@ -278,9 +276,7 @@ static bool i915_request_retire(struct i__notify_execute_cb (rq); }GEM_BUG_ON (!list_empty (&rq->execute_cb)); -spin_unlock (&rq->lock); - -local_irq_enable (); +spin_unlock_irq (&rq->lock);
Nothing screams about the imbalance? irq off from one lock to the other? -Chris
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 19 lines · Chris Wilson
Quoted 19 lines
drivers/gpu/drm/i915/i915_request.c +1
-3@@ -251,15 +251,13 @@ static bool i915_request_retire(struct i active->retire (active, rq); } -local_irq_disable (); -/* * We only loosely track inflight requests across preemption, * and so we may find ourselves attempting to retire a _completed_ * request that we have removed from the HW and put back on a run * queue. */ -spin_lock (&rq->engine->active.lock); +spin_lock_irq (&rq->engine->active.lock);list_del (&rq->sched.link);spin_unlock (&rq->engine->active.lock);
Quoted 10 lines
drivers/gpu/drm/i915/i915_request.c static bool i915_request_retire(struct i · line 279
Quoted 8 lines
drivers/gpu/drm/i915/i915_request.c +1
-3@@ -278,9 +276,7 @@ static bool i915_request_retire(struct i__notify_execute_cb (rq); }GEM_BUG_ON (!list_empty (&rq->execute_cb)); -spin_unlock (&rq->lock); - -local_irq_enable (); +spin_unlock_irq (&rq->lock);Nothing screams about the imbalance? irq off from one lock to the other?
There is no imbalance, is there? Interrupts are disabled as part of acquiring the first lock and enabled again as part of releasing the second lock.
It may not look beautiful.
I'm just not sure if this
| spin_lock_irq(&rq->engine->active.lock); | list_del(&rq->sched.link); | spin_unlock_irq(&rq->engine->active.lock); | | spin_lock_irq(&rq->lock); | i915_request_mark_complete(rq);
…
| spin_unlock_irq(&rq->lock);
has been avoided because an interrupt here could change something or if this is just an optimisation.
Quoted 1 line
-Chris
Sebastian
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting Sebastian Andrzej Siewior (2019-10-10 19:26:10)
Quoted 31 lines · Chris Wilson
Quoted 19 lines
Quoted 19 lines
drivers/gpu/drm/i915/i915_request.c +1
-3@@ -251,15 +251,13 @@ static bool i915_request_retire(struct i active->retire (active, rq); } -local_irq_disable (); -/* * We only loosely track inflight requests across preemption, * and so we may find ourselves attempting to retire a _completed_ * request that we have removed from the HW and put back on a run * queue. */ -spin_lock (&rq->engine->active.lock); +spin_lock_irq (&rq->engine->active.lock);list_del (&rq->sched.link);spin_unlock (&rq->engine->active.lock);Quoted 10 lines
drivers/gpu/drm/i915/i915_request.c static bool i915_request_retire(struct i · line 279
Quoted 8 lines
drivers/gpu/drm/i915/i915_request.c +1
-3@@ -278,9 +276,7 @@ static bool i915_request_retire(struct i__notify_execute_cb (rq); }GEM_BUG_ON (!list_empty (&rq->execute_cb)); -spin_unlock (&rq->lock); - -local_irq_enable (); +spin_unlock_irq (&rq->lock);Nothing screams about the imbalance? irq off from one lock to the other?
Quoted 4 lines
There is no imbalance, is there? Interrupts are disabled as part of acquiring the first lock and enabled again as part of releasing the second lock.
It may not look beautiful.
Sure, it's at the same scope, I just expect at some point lockdep to complain :)
Quoted 8 lines
I'm just not sure if this
| spin_lock_irq(&rq->engine->active.lock); | list_del(&rq->sched.link); | spin_unlock_irq(&rq->engine->active.lock); | | spin_lock_irq(&rq->lock); | i915_request_mark_complete(rq);
Quoted 5 lines
…
|spin_unlock_irq(&rq->lock);has been avoided because an interrupt here could change something or if this is just an optimisation.
Just avoiding the back-to-back enable/disable.
-Chris
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 9 lines · Chris Wilson
Quoted 9 lines
| spin_lock_irq(&rq->engine->active.lock); | list_del(&rq->sched.link); | spin_unlock_irq(&rq->engine->active.lock); | | spin_lock_irq(&rq->lock); | i915_request_mark_complete(rq);…
|spin_unlock_irq(&rq->lock);
Quoted 4 lines
Quoted 2 lines
has been avoided because an interrupt here could change something or if this is just an optimisation.
Just avoiding the back-to-back enable/disable.
as I assumed. Is the patch okay?
Quoted 1 line
-Chris
Sebastian
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BUILD: failure for drm/i915: Don't disable interrupts independently of the lock (rev2)
In reply to Sebastian Andrzej Siewior== Series Details ==
== Series Details ==
Series: drm/i915: Don't disable interrupts independently of the lock (rev2)
URL : https://patchwork.freedesktop.org/series/59289/
State : failure
== Summary ==
Applying: drm/i915: Don't disable interrupts independently of the lock
error: sha1 information is lacking or useless (drivers/gpu/drm/i915/i915_request.c).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch' to see the failed patch
Patch failed at 0001 drm/i915: Don't disable interrupts independently of the lock When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx