Linux-ARM-Kernel Archive on lore.kernel.org
 help / Atom feed
* [PATCH] staging: vchiq: Fix local event signalling
@ 2019-01-11 11:34 Phil Elwell
  2019-01-12  0:14 ` Stefan Wahren
  2019-01-20 22:21 ` Anisse Astier
  0 siblings, 2 replies; 3+ messages in thread
From: Phil Elwell @ 2019-01-11 11:34 UTC (permalink / raw)
  To: Eric Anholt, Stefan Wahren, Greg Kroah-Hartman, Dominic Braun,
	Nicolas Saenz Julienne, Arnd Bergmann, linux-rpi-kernel,
	linux-arm-kernel, devel, linux-kernel
  Cc: 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.

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")
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
---
 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
index 9e17ec6..53f5a1c 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -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);
 }
-- 
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: vchiq: Fix local event signalling
  2019-01-11 11:34 [PATCH] staging: vchiq: Fix local event signalling Phil Elwell
@ 2019-01-12  0:14 ` Stefan Wahren
  2019-01-20 22:21 ` Anisse Astier
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Wahren @ 2019-01-12  0:14 UTC (permalink / raw)
  To: Phil Elwell, Eric Anholt, Greg Kroah-Hartman, Dominic Braun,
	Nicolas Saenz Julienne, Arnd Bergmann, linux-rpi-kernel,
	linux-arm-kernel, devel, linux-kernel


> Phil Elwell <phil@raspberrypi.org> 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.
> 
> Fixes: 852b2876a8a8 ("staging: vchiq: rework remove_event handling")
> Signed-off-by: Phil Elwell <phil@raspberrypi.org>

Tested-by: Stefan Wahren <stefan.wahren@i2se.com>

Thanks

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: vchiq: Fix local event signalling
  2019-01-11 11:34 [PATCH] staging: vchiq: Fix local event signalling Phil Elwell
  2019-01-12  0:14 ` Stefan Wahren
@ 2019-01-20 22:21 ` Anisse Astier
  1 sibling, 0 replies; 3+ messages in thread
From: Anisse Astier @ 2019-01-20 22:21 UTC (permalink / raw)
  To: Phil Elwell
  Cc: Stefan Wahren, devel, Arnd Bergmann, Greg Kroah-Hartman,
	linux-kernel, Eric Anholt, linux-rpi-kernel, Dominic Braun,
	Nicolas Saenz Julienne, linux-arm-kernel

Hi Phil,

On Fri, Jan 11, 2019 at 11:34:53AM +0000, Phil Elwell wrote:
> 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.

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)

> 
> Fixes: 852b2876a8a8 ("staging: vchiq: rework remove_event handling")
> Signed-off-by: Phil Elwell <phil@raspberrypi.org>

Tested-by: Anisse Astier <anisse@astier.eu>


Regards,

Anisse

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-11 11:34 [PATCH] staging: vchiq: Fix local event signalling Phil Elwell
2019-01-12  0:14 ` Stefan Wahren
2019-01-20 22:21 ` Anisse Astier

Linux-ARM-Kernel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/0 linux-arm-kernel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-arm-kernel linux-arm-kernel/ https://lore.kernel.org/linux-arm-kernel \
		linux-arm-kernel@lists.infradead.org infradead-linux-arm-kernel@archiver.kernel.org
	public-inbox-index linux-arm-kernel


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-arm-kernel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox