From: Jack Wang jinpu.wang@ionos.com
mainline inclusion from mainline-v6.6-rc1 commit 3d7d72a34e05b23e21bafc8bfb861e73c86b31f3 category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I9TZZB
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i...
--------------------------------
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@ionos.com Signed-off-by: Jack Wang jinpu.wang@ionos.com Signed-off-by: Ingo Molnar mingo@kernel.org Tested-by: Yu Zhang yu.zhang@ionos.com Reviewed-by: Jarkko Sakkinen jarkko@kernel.org Reviewed-by: Kai Huang kai.huang@intel.com Acked-by: Haitao Huang haitao.huang@linux.intel.com Cc: stable@vger.kernel.org Signed-off-by: Xiang Yang xiangyang3@huawei.com --- 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 b4f9a50de776..6d0531f8b087 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))
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/8401 邮件列表地址:https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/S...
FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/8401 Mailing list address: https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/S...