Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5017224pxj; Wed, 26 May 2021 00:19:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznmx1+/mlvGVZ0FIGxkVHHA8x4UF9VGH4ivPp9Wn7ufH+AmdGfyFlFkl2vzZ2SoO+sGKfE X-Received: by 2002:a17:907:b09:: with SMTP id h9mr31310407ejl.430.1622013577722; Wed, 26 May 2021 00:19:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622013577; cv=none; d=google.com; s=arc-20160816; b=qwoLbjXpp8g/rc07J9fSMRNff9GL2DKjU7rNd4pVFU11VNhAxbL7iO7KD2tWvBnTuw PuAJ76zITlgdzpZ6bZcpDl7MRLIL+N31UFsqbaPRT5sA3r7kReZZTY3v0LE3OCCz9wEZ HQMLrQ1OvI+EMv1R41fSLzSCtG9KtyfcsEyu62Ij6zM3jmgHrXvOC2AEjl4Nmp6r9ERU Jq8DOKGtIuRPOlvdj4bGdIZRI9VTxaVtPAFILkFfAEFZKFqb2tV7jGfjlUWUl1YIK4SV iYUj3MGJzNzjKylFKNgJE4tPYXSsrFRePhyBdwTPCCii7DU87h2mrs1N3pz7gOafiPou mr+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=QTOQh56fmjrfvl67/0DfNnh/0myozslLPBrvqBML5Oo=; b=fPVRtIQtaNCV3/2Lm+6HgUNl/SuPHpHffxOe2V1M20OHWA7+0/wRaOwhe5CmU9Q2I3 gqy3qqbtfH26Sh7rRA1PxnjXCdHosNEjgLf6MS4nznqoSChPeBKjWqsexzNU4PsHN475 79L2ju0EvtpKmk/vQRb6JiF9ifownmGXqdwR2l3u6xyDX+0ktt/rLil6h6Nv2T9r2VC6 BXgka4zgJ1qcTCYBKmAHoZRNepVCLgkuCDR7udE9jpyG+XSaLAiOXTBQkNRw3R18D3Br +C5QMKDWaojXf+AIFgqNFsnYog7tAl+vCFn5DCTZIZic/4UklgRNO1LIofrOl32Rb5gW EIWA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mp18si17842365ejc.543.2021.05.26.00.19.12; Wed, 26 May 2021 00:19:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232974AbhEZHTY (ORCPT + 99 others); Wed, 26 May 2021 03:19:24 -0400 Received: from smtp1.de.adit-jv.com ([93.241.18.167]:39652 "EHLO smtp1.de.adit-jv.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232617AbhEZHTW (ORCPT ); Wed, 26 May 2021 03:19:22 -0400 X-Greylist: delayed 421 seconds by postgrey-1.27 at vger.kernel.org; Wed, 26 May 2021 03:19:22 EDT Received: from hi2exch02.adit-jv.com (hi2exch02.adit-jv.com [10.72.92.28]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp1.de.adit-jv.com (Postfix) with ESMTPS id 9FB883C0579; Wed, 26 May 2021 09:11:04 +0200 (CEST) Received: from lxhi-059.adit-jv.com (10.72.93.144) by hi2exch02.adit-jv.com (10.72.92.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Wed, 26 May 2021 09:11:04 +0200 From: Christoph Gellner To: , CC: , Christoph Gellner Subject: [RFC PATCH 2/3] tee: optee: Allow to freeze while waiting for call_queue Date: Wed, 26 May 2021 09:09:10 +0200 Message-ID: <20210526070911.31681-3-cgellner@de.adit-jv.com> X-Mailer: git-send-email 2.32.0.rc0 In-Reply-To: <20210526070911.31681-1-cgellner@de.adit-jv.com> References: <20210526070911.31681-1-cgellner@de.adit-jv.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.72.93.144] X-ClientProxiedBy: hi2exch02.adit-jv.com (10.72.92.28) To hi2exch02.adit-jv.com (10.72.92.28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When the system is going to hibernate or suspend and the tasks of the other entries in the call queue are frozen wait_for_completion on the call_queue 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 --- drivers/tee/optee/call.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/tee/optee/call.c b/drivers/tee/optee/call.c index 6132cc8d014c..916cfa11cce2 100644 --- a/drivers/tee/optee/call.c +++ b/drivers/tee/optee/call.c @@ -12,6 +12,7 @@ #include #include #include +#include #include "optee_private.h" #include "optee_smc.h" #define CREATE_TRACE_POINTS @@ -50,7 +51,12 @@ static void optee_cq_wait_init(struct optee_call_queue *cq, static void optee_cq_wait_for_completion(struct optee_call_queue *cq, struct optee_call_waiter *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(&cq->mutex); -- 2.32.0.rc0