Skip to content

Commit 2096b74

Browse files
Guchun Chenalexdeucher
authored andcommitted
drm/amdgpu: use spin_lock_irqsave to avoid deadlock by local interrupt
This is observed in SRIOV case with virtual KMS as display. _raw_spin_lock_irqsave+0x37/0x40 drm_handle_vblank+0x69/0x350 [drm] ? try_to_wake_up+0x432/0x5c0 ? amdgpu_vkms_prepare_fb+0x1c0/0x1c0 [amdgpu] drm_crtc_handle_vblank+0x17/0x20 [drm] amdgpu_vkms_vblank_simulate+0x4d/0x80 [amdgpu] __hrtimer_run_queues+0xfb/0x230 hrtimer_interrupt+0x109/0x220 __sysvec_apic_timer_interrupt+0x64/0xe0 asm_call_irq_on_stack+0x12/0x20 Fixes: 84ec374 ("drm/amdgpu: create amdgpu_vkms (v4)") Signed-off-by: Guchun Chen <[email protected]> Acked-by: Alex Deucher <[email protected]> Tested-by: Kelly Zytaruk <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 4eaf21b commit 2096b74

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,15 +144,16 @@ static void amdgpu_vkms_crtc_atomic_disable(struct drm_crtc *crtc,
144144
static void amdgpu_vkms_crtc_atomic_flush(struct drm_crtc *crtc,
145145
struct drm_atomic_state *state)
146146
{
147+
unsigned long flags;
147148
if (crtc->state->event) {
148-
spin_lock(&crtc->dev->event_lock);
149+
spin_lock_irqsave(&crtc->dev->event_lock, flags);
149150

150151
if (drm_crtc_vblank_get(crtc) != 0)
151152
drm_crtc_send_vblank_event(crtc, crtc->state->event);
152153
else
153154
drm_crtc_arm_vblank_event(crtc, crtc->state->event);
154155

155-
spin_unlock(&crtc->dev->event_lock);
156+
spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
156157

157158
crtc->state->event = NULL;
158159
}

0 commit comments

Comments
 (0)