Skip to content

Commit c088387

Browse files
KKaras169169Andi Shyti
authored andcommitted
drm/i915/gt: Use spin_lock_irqsave() in interruptible context
spin_lock/unlock() functions used in interrupt contexts could result in a deadlock, as seen in GitLab issue #13399, which occurs when interrupt comes in while holding a lock. Try to remedy the problem by saving irq state before spin lock acquisition. v2: add irqs' state save/restore calls to all locks/unlocks in signal_irq_work() execution (Maciej) v3: use with spin_lock_irqsave() in guc_lrc_desc_unpin() instead of other lock/unlock calls and add Fixes and Cc tags (Tvrtko); change title and commit message Fixes: 2f2cc53 ("drm/i915/guc: Close deregister-context race against CT-loss") Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/13399 Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com> Cc: <stable@vger.kernel.org> # v6.9+ Reviewed-by: Maciej Patelczyk <maciej.patelczyk@intel.com> Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/pusppq5ybyszau2oocboj3mtj5x574gwij323jlclm5zxvimmu@mnfg6odxbpsv
1 parent efa6fbd commit c088387

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3449,10 +3449,10 @@ static inline int guc_lrc_desc_unpin(struct intel_context *ce)
34493449
*/
34503450
ret = deregister_context(ce, ce->guc_id.id);
34513451
if (ret) {
3452-
spin_lock(&ce->guc_state.lock);
3452+
spin_lock_irqsave(&ce->guc_state.lock, flags);
34533453
set_context_registered(ce);
34543454
clr_context_destroyed(ce);
3455-
spin_unlock(&ce->guc_state.lock);
3455+
spin_unlock_irqrestore(&ce->guc_state.lock, flags);
34563456
/*
34573457
* As gt-pm is awake at function entry, intel_wakeref_put_async merely decrements
34583458
* the wakeref immediately but per function spec usage call this after unlock.

0 commit comments

Comments
 (0)