Message ID | 20220815045347.36173-1-haitao.huang@linux.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | x86/sgx: handle VA page allocation failure for EAUG on PF. | expand |
On Sun, Aug 14, 2022 at 09:53:47PM -0700, Haitao Huang wrote: > Return VM_FAULT_NOPAGE to allow the swapping thread to catch up. > > link: https://lore.kernel.org/all/20220804201456.33418-1-vijay.dhanraj@intel.com/ > > Signed-off-by: Haitao Huang <haitao.huang@linux.intel.com> > --- > arch/x86/kernel/cpu/sgx/encl.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/kernel/cpu/sgx/encl.c b/arch/x86/kernel/cpu/sgx/encl.c > index 24c1bb8eb196..de92c1c8b79d 100644 > --- a/arch/x86/kernel/cpu/sgx/encl.c > +++ b/arch/x86/kernel/cpu/sgx/encl.c > @@ -344,8 +344,11 @@ static vm_fault_t sgx_encl_eaug_page(struct vm_area_struct *vma, > } > > va_page = sgx_encl_grow(encl, false); > - if (IS_ERR(va_page)) > + if (IS_ERR(va_page)) { > + if (PTR_ERR(va_page) == -EBUSY) > + vmret = VM_FAULT_NOPAGE; > goto err_out_epc; > + } > > if (va_page) > list_add(&va_page->list, &encl->va_pages); > -- > 2.25.1 > Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> BR, Jarkko
diff --git a/arch/x86/kernel/cpu/sgx/encl.c b/arch/x86/kernel/cpu/sgx/encl.c index 24c1bb8eb196..de92c1c8b79d 100644 --- a/arch/x86/kernel/cpu/sgx/encl.c +++ b/arch/x86/kernel/cpu/sgx/encl.c @@ -344,8 +344,11 @@ static vm_fault_t sgx_encl_eaug_page(struct vm_area_struct *vma, } va_page = sgx_encl_grow(encl, false); - if (IS_ERR(va_page)) + if (IS_ERR(va_page)) { + if (PTR_ERR(va_page) == -EBUSY) + vmret = VM_FAULT_NOPAGE; goto err_out_epc; + } if (va_page) list_add(&va_page->list, &encl->va_pages);
Return VM_FAULT_NOPAGE to allow the swapping thread to catch up. link: https://lore.kernel.org/all/20220804201456.33418-1-vijay.dhanraj@intel.com/ Signed-off-by: Haitao Huang <haitao.huang@linux.intel.com> --- arch/x86/kernel/cpu/sgx/encl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)