Skip to contentSkip to conversation

staging: vchiq: Fix local event signalling

PATCH In review Phil Elwell 3 participants 3 messages Jan 11, 2019 – Jan 20, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: vchiq: Fix local event signalling

Prior to the recent event reworking (see Fixes), thread synchronisation was implemented using completions, the worker thread being woken with a call to complete(). The replacement uses waitqueues, which are more like condition variables in that the waiting thread is only woken if the condition is true.

When the VPU signals the ARM, it first sets the event's fired flag to indicate which event is being signalled, but the places in the ARM-side code where the worker thread is being woken - remote_event_signal_local via request_poll - did not do so as it wasn't previously necessary, and since the armed flag was being cleared this lead to a deadlock.

Fixes 852b2876a8a8 ("staging: vchiq: rework remove_event handling")
---
 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 1 +
 1 file changed, 1 insertion(+)
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +1 -0
index 9e17ec6..53f5a1c 100644
@@ -446,6 +446,7 @@ remote_event_wait(wait_queue_head_t *wq, struct remote_event *event)
 static inline void
 remote_event_signal_local(wait_queue_head_t *wq, struct remote_event *event)
 {
+	event->fired = 1;
 	event->armed = 0;
 	wake_up_all(wq);
 }
Signature · 1 line
2.7.4
Tested-by on v1 1/1
#1 lore raw
Quoted 17 lines

Phil Elwell <[email protected]> hat am 11. Januar 2019 um 12:34 geschrieben:

Prior to the recent event reworking (see Fixes), thread synchronisation was implemented using completions, the worker thread being woken with a call to complete(). The replacement uses waitqueues, which are more like condition variables in that the waiting thread is only woken if the condition is true.

When the VPU signals the ARM, it first sets the event's fired flag to indicate which event is being signalled, but the places in the ARM-side code where the worker thread is being woken - remote_event_signal_local via request_poll - did not do so as it wasn't previously necessary, and since the armed flag was being cleared this lead to a deadlock.

Quoted 2 lines
Fixes 852b2876a8a8 ("staging: vchiq: rework remove_event handling")

Thanks

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Tested-by on v1 1/1
#2 lore raw
In reply to Phil Elwell

Hi Phil,

Quoted 6 lines · Phil Elwell

Prior to the recent event reworking (see Fixes), thread synchronisation was implemented using completions, the worker thread being woken with a call to complete(). The replacement uses waitqueues, which are more like condition variables in that the waiting thread is only woken if the condition is true.

Quoted 6 lines

When the VPU signals the ARM, it first sets the event's fired flag to indicate which event is being signalled, but the places in the ARM-side code where the worker thread is being woken - remote_event_signal_local via request_poll - did not do so as it wasn't previously necessary, and since the armed flag was being cleared this lead to a deadlock.

This fixes an issue I've had on linux 5.0-pre to 5.0-rc2+: the bcm2835-audio driver would block on close, and then nothing would work until the process was killed. Sample log:

bcm2835_audio bcm2835_audio: failed to close VCHI service connection (status=1)

Quoted 3 lines
Fixes 852b2876a8a8 ("staging: vchiq: rework remove_event handling")

Regards,

Anisse

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel