On Fri, Aug 12, 2022 at 10:41:30PM +0000, Dhanraj, Vijay wrote: > Hi Haitao, > > > -----Original Message----- > > From: Haitao Huang <haitao.huang@xxxxxxxxxxxxxxx> > > Sent: Friday, August 12, 2022 12:12 PM > > To: linux-sgx@xxxxxxxxxxxxxxx; jarkko@xxxxxxxxxx; Chatre, Reinette > > <reinette.chatre@xxxxxxxxx>; dave.hansen@xxxxxxxxxxxxxxx; Dhanraj, Vijay > > <vijay.dhanraj@xxxxxxxxx> > > Subject: [PATCH] x86/sgx: handle VA page allocation failure for EAUG on PF. > > > > Return VM_FAULT_NOPAGE to allow the swapping thread to catch up. > > > > link: https://lore.kernel.org/all/20220804201456.33418-1- > > vijay.dhanraj@xxxxxxxxx/ > > > > Signed-off-by: Haitao Huang <haitao.huang@xxxxxxxxxxxxxxx> > > > > arch/x86/kernel/cpu/sgx/encl.c | 7 +++++-- > > 1 file changed, 5 insertions(+), 2 deletions(-) > > > > diff --git a/arch/x86/kernel/cpu/sgx/encl.c b/arch/x86/kernel/cpu/sgx/encl.c > > index 24c1bb8eb196..1f88f80c4477 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)) > > - goto err_out_epc; > > + 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 > > After applying this patch, I don't see the allocation failure issue with `augment_via_eaccept_long` test case. Ran the test for about ~60 times and all the time it passes. > Tested-by: Vijay Dhanraj <vijay.dhanraj@xxxxxxxxx> Good to hear. Thank you. BR, Jarkko