[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v2 2/6] xen/arm: optee: check for preemption while freeing shared buffers


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Date: Wed, 18 Sep 2019 18:50:56 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AqXfQOLOnYJoNe5kfocRbeNB6ZWU3b9htobggzv1TZU=; b=DEUTSdcN2Ffyv8+i9or8GgLdxL8o8D6u2OYdu40zMJDW37Y57dP8sQuJ2Sd0m4+EtpOJ+Bekn1j4IzPMb48RCW6n81FbSkXuLD0B2J1qscXG6JJ3+My8wx/bcU0WdzAJ9wH6Hvh7slsKYPnMpegQJTzAYE5ANXLwH3hTKnRBKXyjypjgxBi+LiSVbjw4Vvm/CU4CaiTnPYyhV0DMXd2LGOexmAK4cxRI/bNU5ZGgB6NL7M3FwpoJKpKMtHxlu+l5Ndr9FFMqg5eduGaMf/+RYErfObqs1L1eCaF9eA2iU1rfGJIBMQpFYI4UTcO0jAufooKPT44qbJTZIqTLlXl9bg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RLa/pWlBl5eHyJPHOizEjb6edtJI48jRE9w6GHlsTzJ7tG9txafUUS/u3i94E1R1E7iInD8/JYZ+Z2zWI8c7aAvXF772t2PZDQU0TZFDFoMVxqXh+VxEW8v7OpzdRtwIcq9HVglDtqWEl7VPjjNeOHuD5bTRFYWJntDPyfFjjRPVA7qrRhZ4R7sIOkMwuEvYUot/sqx4pOe055OL5KvWG6t5ssVSs5sLfwRVFz9OJFRw7mHgRJ4hQO5AugijZUdztx72TFQdM32rHz46Vh5FVn5KYz8KacdrYdZHps4EPC3hVJ2/20er4akXb9AQlSoovK+hfdd5YqDLldRQzynYYw==
  • Authentication-results: spf=none (sender IP is ) smtp.mailfrom=Volodymyr_Babchuk@xxxxxxxx;
  • Cc: "tee-dev@xxxxxxxxxxxxxxxx" <tee-dev@xxxxxxxxxxxxxxxx>, Julien Grall <julien.grall@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Wed, 18 Sep 2019 18:51:03 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHVblIBa+Rcg914Z0Sq56RvzPPcmg==
  • Thread-topic: [PATCH v2 2/6] xen/arm: optee: check for preemption while freeing shared buffers

We can check for hypercall_preempt_check() in the loop inside
optee_relinquish_resources() to increase hypervisor responsiveness in
case if preemption is required.

Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>

---

Changes from v1:
 - Removed extra hypercall_preempt_check()
 - Updated the commit message
---
 xen/arch/arm/tee/optee.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/xen/arch/arm/tee/optee.c b/xen/arch/arm/tee/optee.c
index d64e9c3b85..55d11b91a9 100644
--- a/xen/arch/arm/tee/optee.c
+++ b/xen/arch/arm/tee/optee.c
@@ -633,17 +633,14 @@ static int optee_relinquish_resources(struct domain *d)
     list_for_each_entry_safe( shm_rpc, shm_rpc_tmp, &ctx->shm_rpc_list, list )
         free_shm_rpc(ctx, shm_rpc->cookie);
 
-    if ( hypercall_preempt_check() )
-        return -ERESTART;
-
-    /*
-     * TODO: Guest can pin up to MAX_TOTAL_SMH_BUF_PG pages and all of
-     * them will be put in this loop. It is worth considering to
-     * check for preemption inside the loop.
-     */
     list_for_each_entry_safe( optee_shm_buf, optee_shm_buf_tmp,
                               &ctx->optee_shm_buf_list, list )
+    {
+        if ( hypercall_preempt_check() )
+            return -ERESTART;
+
         free_optee_shm_buf(ctx, optee_shm_buf->cookie);
+    }
 
     if ( hypercall_preempt_check() )
         return -ERESTART;
-- 
2.22.0

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.