Skip to content
Commit 3d7d72a3 authored by Jack Wang's avatar Jack Wang Committed by Ingo Molnar
Browse files

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:

  8795359e ("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: 540745dd

 ("x86/sgx: Introduce virtual EPC for use by KVM guests")
Reported-by: default avatarYu Zhang <yu.zhang@ionos.com>
Signed-off-by: default avatarJack Wang <jinpu.wang@ionos.com>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
Tested-by: default avatarYu Zhang <yu.zhang@ionos.com>
Reviewed-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
Reviewed-by: default avatarKai Huang <kai.huang@intel.com>
Acked-by: default avatarHaitao Huang <haitao.huang@linux.intel.com>
Cc: stable@vger.kernel.org
parent 659df86a
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment