drm/amdgpu: use spin_lock_irqsave to avoid deadlock by local interrupt
Subsystems (2)
PATCH 1/1 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
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c +3 -2
@@ -144,15 +144,16 @@ static void amdgpu_vkms_crtc_atomic_disable(struct drm_crtc *crtc,static void amdgpu_vkms_crtc_atomic_flush (struct drm_crtc *crtc,struct drm_atomic_state *state) { +unsigned long flags;if (crtc->state->event) { -spin_lock (&crtc->dev->event_lock); +spin_lock_irqsave (&crtc->dev->event_lock, flags);if (drm_crtc_vblank_get (crtc) !=0 )drm_crtc_send_vblank_event (crtc, crtc->state->event);else drm_crtc_arm_vblank_event (crtc, crtc->state->event); -spin_unlock (&crtc->dev->event_lock); +spin_unlock_irqrestore (&crtc->dev->event_lock, flags); crtc->state->event =NULL ; }
Signature · 1 line
2.17.1
I can confirm that the fault no longer occurs when the patch is implemented.
Thanks,
Kelly
-----Original Message-----
From: Chen, Guchun <[email protected]>
Sent: January 10, 2022 12:14 AM
To: [email protected]; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Pan, Xinhui <[email protected]>; Zytaruk, Kelly <[email protected]>; Huang, Qiliang (Warden) <[email protected]>; Zhang, Bokun <[email protected]>
Cc: Chen, Guchun <[email protected]>
Subject: [PATCH] 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
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c +3 -3
@@ -144,15 +144,16 @@ static void amdgpu_vkms_crtc_atomic_disable(struct drm_crtc *crtc, static void amdgpu_vkms_crtc_atomic_flush(struct drm_crtc *crtc, struct drm_atomic_state *state) { +unsigned long flags;if (crtc->state->event) { -spin_lock (&crtc->dev->event_lock); +spin_lock_irqsave (&crtc->dev->event_lock, flags);if (drm_crtc_vblank_get (crtc) !=0 )drm_crtc_send_vblank_event (crtc, crtc->state->event);else drm_crtc_arm_vblank_event (crtc, crtc->state->event); -spin_unlock (&crtc->dev->event_lock); +spin_unlock_irqrestore (&crtc->dev->event_lock, flags); crtc->state->event =NULL ; } --
2.17.1
[Public]
Thanks Kelly. I will push this patch with a tag like "Tested-by: Zytaruk, Kelly <[email protected]>". Pls let me know if you have any concern.
Regards,
Guchun
-----Original Message-----
From: Zytaruk, Kelly <[email protected]>
Sent: Monday, January 10, 2022 11:42 PM
To: Chen, Guchun <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Pan, Xinhui <[email protected]>; Huang, Qiliang (Warden) <[email protected]>; Zhang, Bokun <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: use spin_lock_irqsave to avoid deadlock by local interrupt
I can confirm that the fault no longer occurs when the patch is implemented.
Thanks,
Kelly
-----Original Message-----
From: Chen, Guchun <[email protected]>
Sent: January 10, 2022 12:14 AM
To: [email protected]; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Pan, Xinhui <[email protected]>; Zytaruk, Kelly <[email protected]>; Huang, Qiliang (Warden) <[email protected]>; Zhang, Bokun <[email protected]>
Cc: Chen, Guchun <[email protected]>
Subject: [PATCH] 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
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c +3 -3
@@ -144,15 +144,16 @@ static void amdgpu_vkms_crtc_atomic_disable(struct drm_crtc *crtc, static void amdgpu_vkms_crtc_atomic_flush(struct drm_crtc *crtc, struct drm_atomic_state *state) { +unsigned long flags;if (crtc->state->event) { -spin_lock (&crtc->dev->event_lock); +spin_lock_irqsave (&crtc->dev->event_lock, flags);if (drm_crtc_vblank_get (crtc) !=0 )drm_crtc_send_vblank_event (crtc, crtc->state->event);else drm_crtc_arm_vblank_event (crtc, crtc->state->event); -spin_unlock (&crtc->dev->event_lock); +spin_unlock_irqrestore (&crtc->dev->event_lock, flags); crtc->state->event =NULL ; } --
2.17.1
Thanks Guchun.
Tag is okay.
Kelly
-----Original Message-----
From: Chen, Guchun <[email protected]>
Sent: January 10, 2022 10:01 PM
To: Zytaruk, Kelly <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Pan, Xinhui <[email protected]>; Huang, Qiliang (Warden) <[email protected]>; Zhang, Bokun <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: use spin_lock_irqsave to avoid deadlock by local interrupt
[Public]
Thanks Kelly. I will push this patch with a tag like "Tested-by: Zytaruk, Kelly <[email protected]>". Pls let me know if you have any concern.
Regards,
Guchun
-----Original Message-----
From: Zytaruk, Kelly <[email protected]>
Sent: Monday, January 10, 2022 11:42 PM
To: Chen, Guchun <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Pan, Xinhui <[email protected]>; Huang, Qiliang (Warden) <[email protected]>; Zhang, Bokun <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: use spin_lock_irqsave to avoid deadlock by local interrupt
I can confirm that the fault no longer occurs when the patch is implemented.
Thanks,
Kelly
-----Original Message-----
From: Chen, Guchun <[email protected]>
Sent: January 10, 2022 12:14 AM
To: [email protected]; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Pan, Xinhui <[email protected]>; Zytaruk, Kelly <[email protected]>; Huang, Qiliang (Warden) <[email protected]>; Zhang, Bokun <[email protected]>
Cc: Chen, Guchun <[email protected]>
Subject: [PATCH] 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
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c +3 -3
@@ -144,15 +144,16 @@ static void amdgpu_vkms_crtc_atomic_disable(struct drm_crtc *crtc, static void amdgpu_vkms_crtc_atomic_flush(struct drm_crtc *crtc, struct drm_atomic_state *state) { +unsigned long flags;if (crtc->state->event) { -spin_lock (&crtc->dev->event_lock); +spin_lock_irqsave (&crtc->dev->event_lock, flags);if (drm_crtc_vblank_get (crtc) !=0 )drm_crtc_send_vblank_event (crtc, crtc->state->event);else drm_crtc_arm_vblank_event (crtc, crtc->state->event); -spin_unlock (&crtc->dev->event_lock); +spin_unlock_irqrestore (&crtc->dev->event_lock, flags); crtc->state->event =NULL ; } --
2.17.1
[AMD Official Use Only]
________________________________
From: Chen, Guchun <[email protected]>
Sent: Monday, January 10, 2022 12:13 AM
To: [email protected] <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Pan, Xinhui <[email protected]>; Zytaruk, Kelly <[email protected]>; Huang, Qiliang (Warden) <[email protected]>; Zhang, Bokun <[email protected]>
Cc: Chen, Guchun <[email protected]>
Subject: [PATCH] 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
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c +3 -2
@@ -144,15 +144,16 @@ static void amdgpu_vkms_crtc_atomic_disable(struct drm_crtc *crtc,static void amdgpu_vkms_crtc_atomic_flush (struct drm_crtc *crtc,struct drm_atomic_state *state) { +unsigned long flags;if (crtc->state->event) { -spin_lock (&crtc->dev->event_lock); +spin_lock_irqsave (&crtc->dev->event_lock, flags);if (drm_crtc_vblank_get (crtc) !=0 )drm_crtc_send_vblank_event (crtc, crtc->state->event);else drm_crtc_arm_vblank_event (crtc, crtc->state->event); -spin_unlock (&crtc->dev->event_lock); +spin_unlock_irqrestore (&crtc->dev->event_lock, flags); crtc->state->event =NULL ; }
--
2.17.1