[<prev] [next>] [day] [month] [year] [list]
Message-ID: <169403792746.27769.2304744998713665329.tip-bot2@tip-bot2>
Date: Wed, 06 Sep 2023 22:05:27 -0000
From: "tip-bot2 for Jack Wang" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Yu Zhang <yu.zhang@...os.com>, Jack Wang <jinpu.wang@...os.com>,
Ingo Molnar <mingo@...nel.org>,
Jarkko Sakkinen <jarkko@...nel.org>,
Kai Huang <kai.huang@...el.com>,
Haitao Huang <haitao.huang@...ux.intel.com>,
stable@...r.kernel.org, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [tip: x86/urgent] x86/sgx: Break up long non-preemptible delays in
sgx_vepc_release()
The following commit has been merged into the x86/urgent branch of tip:
Commit-ID: 3d7d72a34e05b23e21bafc8bfb861e73c86b31f3
Gitweb: https://git.kernel.org/tip/3d7d72a34e05b23e21bafc8bfb861e73c86b31f3
Author: Jack Wang <jinpu.wang@...os.com>
AuthorDate: Wed, 06 Sep 2023 15:17:12 +02:00
Committer: Ingo Molnar <mingo@...nel.org>
CommitterDate: Wed, 06 Sep 2023 23:55:09 +02:00
x86/sgx: Break up long non-preemptible delays in sgx_vepc_release()
On large enclaves we hit the softlockup warning with following call trace:
xa_erase()
sgx_vepc_release()
__fput()
task_work_run()
do_exit()
The latency issue is similar to the one fixed in:
8795359e35bc ("x86/sgx: Silence softlockup detection when releasing large enclaves")
The test system has 64GB of enclave memory, and all is assigned to a single VM.
Release of 'vepc' takes a longer time and causes long latencies, which triggers
the softlockup warning.
Add cond_resched() to give other tasks a chance to run and reduce
latencies, which also avoids the softlockup detector.
[ mingo: Rewrote the changelog. ]
Fixes: 540745ddbc70 ("x86/sgx: Introduce virtual EPC for use by KVM guests")
Reported-by: Yu Zhang <yu.zhang@...os.com>
Signed-off-by: Jack Wang <jinpu.wang@...os.com>
Signed-off-by: Ingo Molnar <mingo@...nel.org>
Tested-by: Yu Zhang <yu.zhang@...os.com>
Reviewed-by: Jarkko Sakkinen <jarkko@...nel.org>
Reviewed-by: Kai Huang <kai.huang@...el.com>
Acked-by: Haitao Huang <haitao.huang@...ux.intel.com>
Cc: stable@...r.kernel.org
---
arch/x86/kernel/cpu/sgx/virt.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/x86/kernel/cpu/sgx/virt.c b/arch/x86/kernel/cpu/sgx/virt.c
index c3e37ea..7aaa365 100644
--- a/arch/x86/kernel/cpu/sgx/virt.c
+++ b/arch/x86/kernel/cpu/sgx/virt.c
@@ -204,6 +204,7 @@ static int sgx_vepc_release(struct inode *inode, struct file *file)
continue;
xa_erase(&vepc->page_array, index);
+ cond_resched();
}
/*
@@ -222,6 +223,7 @@ static int sgx_vepc_release(struct inode *inode, struct file *file)
list_add_tail(&epc_page->list, &secs_pages);
xa_erase(&vepc->page_array, index);
+ cond_resched();
}
/*
@@ -243,6 +245,7 @@ static int sgx_vepc_release(struct inode *inode, struct file *file)
if (sgx_vepc_free_page(epc_page))
list_add_tail(&epc_page->list, &secs_pages);
+ cond_resched();
}
if (!list_empty(&secs_pages))
Powered by blists - more mailing lists