On Thu, Jul 20, 2017 at 11:08:35AM -0700, Sean Christopherson wrote:
Add utilities for starting/stopping the swap kthread, and ensure that
These utility weaken the readability of the code more than help
reuse of anything non-trivial. You h
ksgxswapd_tsk is either NULL or valid. Attempt to run the swap
thread
if it is not running when when sgx_alloc_page wants to wake it. Return
sgx_run_swap_kthread's error if both it and sgx_alloc_page_fast fail so
the application sees the more critical error, e.g. -ENOMEM vs -EBUSY.
Previously, sgx_pm_resume didn't check the return of kthread_run, which
can fail with -ENOMEM. Upon failure, SGX applications would hang due
to the lack of a kernel thread to perform EPC swapping, and the kernel
would crash on the next system suspend due to passing an error pointer
to kthread_stop.
This other (separate) change makes sense.
Signed-off-by: Sean Christopherson
<sean.j.christopherson(a)intel.com>
/Jarkko