From: "jarkko@kernel.org" <jarkko@kernel.org>
To: "Dhanraj, Vijay" <vijay.dhanraj@intel.com>
Cc: Haitao Huang <haitao.huang@linux.intel.com>,
"linux-sgx@vger.kernel.org" <linux-sgx@vger.kernel.org>,
"Chatre, Reinette" <reinette.chatre@intel.com>,
"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>
Subject: Re: [PATCH] x86/sgx: handle VA page allocation failure for EAUG on PF.
Date: Sun, 14 Aug 2022 22:41:37 +0300 [thread overview]
Message-ID: <YvlP8fOWWmGdZQGy@kernel.org> (raw)
In-Reply-To: <DM8PR11MB559143ADF2DD1A8053641F5AF6679@DM8PR11MB5591.namprd11.prod.outlook.com>
On Fri, Aug 12, 2022 at 10:41:30PM +0000, Dhanraj, Vijay wrote:
> Hi Haitao,
>
> > -----Original Message-----
> > From: Haitao Huang <haitao.huang@linux.intel.com>
> > Sent: Friday, August 12, 2022 12:12 PM
> > To: linux-sgx@vger.kernel.org; jarkko@kernel.org; Chatre, Reinette
> > <reinette.chatre@intel.com>; dave.hansen@linux.intel.com; Dhanraj, Vijay
> > <vijay.dhanraj@intel.com>
> > 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@intel.com/
> >
> > Signed-off-by: Haitao Huang <haitao.huang@linux.intel.com>
> >
> > 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@intel.com>
Good to hear. Thank you.
BR, Jarkko
next prev parent reply other threads:[~2022-08-14 19:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-12 19:12 [PATCH] x86/sgx: handle VA page allocation failure for EAUG on PF Haitao Huang
2022-08-12 22:41 ` Dhanraj, Vijay
2022-08-14 19:41 ` jarkko [this message]
2022-08-14 19:36 ` Jarkko Sakkinen
2022-08-15 4:53 ` Haitao Huang
2022-08-15 23:21 ` Jarkko Sakkinen
2022-08-15 15:01 ` Haitao Huang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YvlP8fOWWmGdZQGy@kernel.org \
--to=jarkko@kernel.org \
--cc=dave.hansen@linux.intel.com \
--cc=haitao.huang@linux.intel.com \
--cc=linux-sgx@vger.kernel.org \
--cc=reinette.chatre@intel.com \
--cc=vijay.dhanraj@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.