[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210809071452.28508-4-cgellner@de.adit-jv.com>
Date: Mon, 9 Aug 2021 09:14:52 +0200
From: Christoph Gellner <cgellner@...adit-jv.com>
To: <op-tee@...ts.trustedfirmware.org>, <linux-kernel@...r.kernel.org>
CC: <jens.wiklander@...aro.org>,
Christoph Gellner <cgellner@...adit-jv.com>
Subject: [PATCH 3/3 RESEND] tee: optee: Allow to freeze while waiting in OPTEE_RPC_WAIT_QUEUE_SLEEP
When the system is going to hibernate or suspend and the task calling
the corresponding OPTEE_RPC_WAIT_QUEUE_WAKEUP gets frozen waiting
for completion in OPTEE_RPC_WAIT_QUEUE_SLEEP might get stuck.
Change wait to interruptible and add try_to_freeze in order to
allow that the waiting task is frozen as well.
Signed-off-by: Christoph Gellner <cgellner@...adit-jv.com>
---
drivers/tee/optee/rpc.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/tee/optee/rpc.c b/drivers/tee/optee/rpc.c
index 1849180b0278..0851b19be529 100644
--- a/drivers/tee/optee/rpc.c
+++ b/drivers/tee/optee/rpc.c
@@ -10,6 +10,7 @@
#include <linux/i2c.h>
#include <linux/slab.h>
#include <linux/tee_drv.h>
+#include <linux/freezer.h>
#include "optee_private.h"
#include "optee_smc.h"
#include "optee_rpc_cmd.h"
@@ -169,7 +170,13 @@ static void wq_sleep(struct optee_wait_queue *wq, u32 key)
struct wq_entry *w = wq_entry_get(wq, key);
if (w) {
- wait_for_completion(&w->c);
+ /*
+ * wait_for_completion but allow hibernation/suspend
+ * to freeze the waiting task
+ */
+ while (wait_for_completion_interruptible(&w->c))
+ try_to_freeze();
+
mutex_lock(&wq->mu);
list_del(&w->link);
mutex_unlock(&wq->mu);
--
2.32.0.rc0
Powered by blists - more mailing lists