All of lore.kernel.org
 help / color / mirror / Atom feed
From: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
To: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: "tee-dev@lists.linaro.org" <tee-dev@lists.linaro.org>,
	Julien Grall <julien.grall@arm.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
Subject: [Xen-devel] [PATCH v2 2/6] xen/arm: optee: check for preemption while freeing shared buffers
Date: Wed, 18 Sep 2019 18:50:56 +0000	[thread overview]
Message-ID: <20190918185041.22738-3-volodymyr_babchuk@epam.com> (raw)
In-Reply-To: <20190918185041.22738-1-volodymyr_babchuk@epam.com>

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@epam.com>

---

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@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2019-09-18 18:51 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-18 18:50 [Xen-devel] [PATCH v2 0/6] arch/arm: optee: fix TODOs and change status to "Tech Preview" Volodymyr Babchuk
2019-09-18 18:50 ` [Xen-devel] [PATCH v2 1/6] xen/arm: optee: impose limit on shared buffer size Volodymyr Babchuk
2019-09-23  9:29   ` Julien Grall
2019-09-18 18:50 ` Volodymyr Babchuk [this message]
2019-09-23  9:30   ` [Xen-devel] [PATCH v2 2/6] xen/arm: optee: check for preemption while freeing shared buffers Julien Grall
2019-09-18 18:50 ` [Xen-devel] [PATCH v2 3/6] xen/arm: optee: limit number of " Volodymyr Babchuk
2019-09-23  9:31   ` Julien Grall
2019-09-18 18:51 ` [Xen-devel] [PATCH v2 4/6] xen/arm: optee: handle shared buffer translation error Volodymyr Babchuk
2019-09-23  9:42   ` Julien Grall
2019-09-24 11:37     ` Volodymyr Babchuk
2019-09-24 12:06       ` Julien Grall
2019-09-24 13:30         ` Volodymyr Babchuk
2019-09-24 14:08           ` Julien Grall
2019-09-18 18:51 ` [Xen-devel] [PATCH v2 5/6] SUPPORT.md: Describe OP-TEE mediator Volodymyr Babchuk
2019-09-23  9:48   ` Julien Grall
2019-09-18 18:51 ` [Xen-devel] [PATCH v2 6/6] xen/arm: optee: update description in Kconfig Volodymyr Babchuk
2019-09-23  9:46   ` Julien Grall
2019-09-23 10:24 ` [Xen-devel] [PATCH v2 0/6] arch/arm: optee: fix TODOs and change status to "Tech Preview" Julien Grall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190918185041.22738-3-volodymyr_babchuk@epam.com \
    --to=volodymyr_babchuk@epam.com \
    --cc=julien.grall@arm.com \
    --cc=sstabellini@kernel.org \
    --cc=tee-dev@lists.linaro.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.