staging: vchiq: make wait events interruptible [Linux 5.2.1]

staging: vchiq: make wait events interruptible [Linux 5.2.1]

This Linux kernel change "staging: vchiq: make wait events interruptible" is included in the Linux 5.2.1 release. This change is authored by Nicolas Saenz Julienne <nsaenzjulienne [at] suse.de> on Thu May 9 16:31:35 2019 +0200. The commit for this change in Linux stable tree is ec1ce3a (patch) which is from upstream commit 77cf3f5. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream 77cf3f5.

staging: vchiq: make wait events interruptible

commit 77cf3f5dcf35c8f547f075213dbc15146d44cc76 upstream.

The killable version of wait_event() is meant to be used on situations
where it should not fail at all costs, but still have the convenience of
being able to kill it if really necessary. Wait events in VCHIQ doesn't
fit this criteria, as it's mainly used as an interface to V4L2 and ALSA
devices.

Fixes: 852b2876a8a8 ("staging: vchiq: rework remove_event handling")
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

There are 10 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

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 0c387b6..7eb3f33 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -395,13 +395,21 @@ struct vchiq_service *
    init_waitqueue_head(wq);
 }

+/*
+ * All the event waiting routines in VCHIQ used a custom semaphore
+ * implementation that filtered most signals. This achieved a behaviour similar
+ * to the "killable" family of functions. While cleaning up this code all the
+ * routines where switched to the "interruptible" family of functions, as the
+ * former was deemed unjustified and the use "killable" set all VCHIQ's
+ * threads in D state.
+ */
 static inline int
 remote_event_wait(wait_queue_head_t *wq, struct remote_event *event)
 {
    if (!event->fired) {
        event->armed = 1;
        dsb(sy);
-       if (wait_event_killable(*wq, event->fired)) {
+       if (wait_event_interruptible(*wq, event->fired)) {
            event->armed = 0;
            return 0;
        }

Leave a Reply

Your email address will not be published. Required fields are marked *