Skip to content

Commit 8795359

Browse files
rchatrehansendc
authored andcommitted
x86/sgx: Silence softlockup detection when releasing large enclaves
Vijay reported that the "unclobbered_vdso_oversubscribed" selftest triggers the softlockup detector. Actual SGX systems have 128GB of enclave memory or more. The "unclobbered_vdso_oversubscribed" selftest creates one enclave which consumes all of the enclave memory on the system. Tearing down such a large enclave takes around a minute, most of it in the loop where the EREMOVE instruction is applied to each individual 4k enclave page. Spending one minute in a loop triggers the softlockup detector. Add a cond_resched() to give other tasks a chance to run and placate the softlockup detector. Cc: [email protected] Fixes: 1728ab5 ("x86/sgx: Add a page reclaimer") Reported-by: Vijay Dhanraj <[email protected]> Signed-off-by: Reinette Chatre <[email protected]> Signed-off-by: Dave Hansen <[email protected]> Reviewed-by: Jarkko Sakkinen <[email protected]> Acked-by: Dave Hansen <[email protected]> Tested-by: Jarkko Sakkinen <[email protected]> (kselftest as sanity check) Link: https://lkml.kernel.org/r/ced01cac1e75f900251b0a4ae1150aa8ebd295ec.1644345232.git.reinette.chatre@intel.com
1 parent dfd42fa commit 8795359

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

arch/x86/kernel/cpu/sgx/encl.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,8 @@ void sgx_encl_release(struct kref *ref)
410410
}
411411

412412
kfree(entry);
413+
/* Invoke scheduler to prevent soft lockups. */
414+
cond_resched();
413415
}
414416

415417
xa_destroy(&encl->page_array);

0 commit comments

Comments
 (0)