All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Cc: linux-sgx@vger.kernel.org
Subject: Re: [PATCH for_v23 2/3] x86/sgx: Do not add in-use EPC page to the free page list
Date: Wed, 23 Oct 2019 08:23:11 -0700	[thread overview]
Message-ID: <20191023152310.GK329@linux.intel.com> (raw)
In-Reply-To: <20191023124340.GG23733@linux.intel.com>

On Wed, Oct 23, 2019 at 03:43:40PM +0300, Jarkko Sakkinen wrote:
> On Tue, Oct 22, 2019 at 03:49:21PM -0700, Sean Christopherson wrote:
> > Don't add an EPC page to the free page list of EREMOVE fails, as doing
> > so will cause any future attempt to use the EPC page to fail, and likely
> > WARN as well.
> > 
> > Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> > ---
> >  arch/x86/kernel/cpu/sgx/main.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/x86/kernel/cpu/sgx/main.c b/arch/x86/kernel/cpu/sgx/main.c
> > index d45bf6fca0c8..8e7557d3ff03 100644
> > --- a/arch/x86/kernel/cpu/sgx/main.c
> > +++ b/arch/x86/kernel/cpu/sgx/main.c
> > @@ -138,7 +138,8 @@ int sgx_free_page(struct sgx_epc_page *page)
> >  	spin_unlock(&sgx_active_page_list_lock);
> >  
> >  	ret = __eremove(sgx_epc_addr(page));
> > -	WARN_ONCE(ret, "EREMOVE returned %d (0x%x)", ret, ret);
> > +	if (WARN_ONCE(ret, "EREMOVE returned %d (0x%x)", ret, ret))
> > +		return -EIO;
> 
> How did you end up choosing -EIO? Don't immediately have any better
> suggestion but neither sure if that is the best choice. That is why I'm
> asking.

sgx_edbgrd() and sgx_edbgwr() return -EIO on failure, and they're the only
other case I can think of where an ENCLS instruction failure is reported
to userspace *and* may or may not be due to a fault.

I honestly didn't spend much time thinking about it as the code is dropped
in the next path.

  reply	other threads:[~2019-10-23 15:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-22 22:49 [PATCH for_v23 0/3] x86/sgx: More cleanup for v23 Sean Christopherson
2019-10-22 22:49 ` [PATCH for_v23 1/3] x86/sgx: Update the free page count in a single operation Sean Christopherson
2019-10-23 12:44   ` Jarkko Sakkinen
2019-10-24 13:11     ` Jarkko Sakkinen
2019-10-22 22:49 ` [PATCH for_v23 2/3] x86/sgx: Do not add in-use EPC page to the free page list Sean Christopherson
2019-10-23 12:43   ` Jarkko Sakkinen
2019-10-23 15:23     ` Sean Christopherson [this message]
2019-10-22 22:49 ` [PATCH for_v23 3/3] x86/sgx: Move reclaim logic out of sgx_free_page() Sean Christopherson
2019-10-23 12:42   ` Jarkko Sakkinen
2019-10-23 15:19     ` Sean Christopherson
2019-10-24 18:35 ` [PATCH for_v23 0/3] x86/sgx: More cleanup for v23 Jarkko Sakkinen
2019-10-24 20:22   ` Sean Christopherson
2019-10-28 20:35     ` Jarkko Sakkinen

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=20191023152310.GK329@linux.intel.com \
    --to=sean.j.christopherson@intel.com \
    --cc=jarkko.sakkinen@linux.intel.com \
    --cc=linux-sgx@vger.kernel.org \
    /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.