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 1/2] x86/sgx: Remove duplicate check for entry->epc_page in sgx_encl_load_page()
Date: Wed, 21 Aug 2019 17:33:58 -0700 [thread overview]
Message-ID: <20190822003358.GO29345@linux.intel.com> (raw)
In-Reply-To: <20190821232902.29476-2-jarkko.sakkinen@linux.intel.com>
On Thu, Aug 22, 2019 at 02:29:01AM +0300, Jarkko Sakkinen wrote:
> The existence of the page is checked first hand for legit race
> conditions (either two or more concurrent threads running the #PF
> handler or the reclaimer has taken over the page):
>
> /* Page is already resident in the EPC. */
> if (entry->epc_page) {
> if (entry->desc & SGX_ENCL_PAGE_RECLAIMED)
> return ERR_PTR(-EBUSY);
>
> return entry;
> }
>
> After that the existence is a checked as a condition for ELDU.
>
> This commit removes the redundant check.
>
> Cc: Sean Christopherson <sean.j.christopherson@intel.com>
> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
> ---
Ha, I remember seeing this a while back and completely forgot about it.
Reviewed-by: Sean Christopherson <sean.j.christopherson@intel.com>
> arch/x86/kernel/cpu/sgx/encl.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kernel/cpu/sgx/encl.c b/arch/x86/kernel/cpu/sgx/encl.c
> index a20d498e9dcd..d6397f7ef3b8 100644
> --- a/arch/x86/kernel/cpu/sgx/encl.c
> +++ b/arch/x86/kernel/cpu/sgx/encl.c
> @@ -123,7 +123,7 @@ static struct sgx_encl_page *sgx_encl_load_page(struct sgx_encl *encl,
> return ERR_CAST(epc_page);
> }
>
> - epc_page = entry->epc_page ? entry->epc_page : sgx_encl_eldu(entry);
> + epc_page = sgx_encl_eldu(entry);
> if (IS_ERR(epc_page))
> return ERR_CAST(epc_page);
>
> --
> 2.20.1
>
next prev parent reply other threads:[~2019-08-22 0:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-21 23:29 [PATCH 0/2] v22 fixes Jarkko Sakkinen
2019-08-21 23:29 ` [PATCH 1/2] x86/sgx: Remove duplicate check for entry->epc_page in sgx_encl_load_page() Jarkko Sakkinen
2019-08-22 0:33 ` Sean Christopherson [this message]
2019-08-22 14:45 ` Jarkko Sakkinen
2019-08-21 23:29 ` [PATCH 2/2] x86/sgx: Determine SECS at compile time in sgx_encl_eldu() Jarkko Sakkinen
2019-08-22 0:55 ` Sean Christopherson
2019-08-22 14:55 ` 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=20190822003358.GO29345@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).