All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: Sean Christopherson <sean.j.christopherson@intel.com>
Cc: platform-driver-x86@vger.kernel.org, x86@kernel.org,
	linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	Darren Hart <dvhart@infradead.org>,
	Andy Shevchenko <andy@infradead.org>
Subject: Re: [PATCH v6 06/11] intel_sgx: driver for Intel Software Guard Extensions
Date: Mon, 4 Dec 2017 10:59:50 +0200	[thread overview]
Message-ID: <20171204085950.dnjsec6xdihhpwbb@linux.intel.com> (raw)
In-Reply-To: <20171130173200.GA11190@linux.intel.com>

On Thu, Nov 30, 2017 at 09:32:01AM -0800, Sean Christopherson wrote:
> On Sat, Nov 25, 2017 at 09:29:24PM +0200, Jarkko Sakkinen wrote:
> > +static void *sgx_try_alloc_page(void)
> > +{
> > +       struct sgx_epc_bank *bank;
> > +       void *page = NULL;
> > +       int i;
> > +
> > +       for (i = 0; i < sgx_nr_epc_banks; i++) {
> > +               bank = &sgx_epc_banks[i];
> > +
> > +               down_write(&bank->lock);
> 
> Is a R/W semaphore actually preferable to a spinlock?  Concurrent
> free calls don't seem that interesting/beneficial because freeing
> an enclave's pages isn't multiplexed across multiple CPUs, unlike
> the allocation of EPC pages.

I get about ~10-15% performance increase on high stress. It is benefical
to spinlock.

> As a whole, I'm not a fan of packing the EPC page pointers into an
> array rather than encapsulating them in a struct+list.  The primary
> benefit I see for the array approach is that it saves ~8 bytes per
> free EPC page, but at a cost of increased memory usage for in-use
> pages and severely restricting the ability to enhance/modify how
> EPC pages are tracked, reclaimed, etc...

This is not true. You can put EPC page descriptor to any structure you
want.

list_head can be dropped from struct sgx_enc_page too.

> The main issue is that the array approach relies on the caller to
> handle reclaim.  This effectively makes it impossible to reclaim
> pages from multiple processes, requires other consumers e.g. KVM
> to implement their own reclaim logic and kthread, and prevents
> cgroup accounting because the cgroup can't initiate reclaim.

Not really following here.

/Jarkko

  reply	other threads:[~2017-12-04  8:59 UTC|newest]

Thread overview: 87+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-25 19:29 [PATCH v6 00/11] Intel SGX Driver Jarkko Sakkinen
2017-11-25 19:29 ` Jarkko Sakkinen
2017-11-25 19:29 ` [PATCH v6 01/11] intel_sgx: updated MAINTAINERS Jarkko Sakkinen
2017-11-25 20:19   ` Joe Perches
2017-11-26 10:41     ` Bjørn Mork
2017-11-26 15:33       ` Jarkko Sakkinen
2017-11-25 19:29 ` [PATCH v6 02/11] x86: add SGX definition to cpufeature Jarkko Sakkinen
2017-11-25 19:29 ` [PATCH v6 03/11] x86: define IA32_FEATURE_CONTROL.SGX_ENABLE Jarkko Sakkinen
2017-11-28 17:13   ` Sean Christopherson
2017-11-28 20:47     ` Jarkko Sakkinen
2017-11-25 19:29 ` [PATCH v6 04/11] x86: define IA32_FEATUE_CONTROL.SGX_LC Jarkko Sakkinen
2017-11-28 17:16   ` Sean Christopherson
2017-11-28 18:28     ` Sean Christopherson
2017-11-28 20:53       ` Jarkko Sakkinen
2017-11-28 21:24         ` Jarkko Sakkinen
2017-11-28 21:33           ` Sean Christopherson
2017-11-28 21:55             ` Jarkko Sakkinen
2017-11-28 22:00               ` Sean Christopherson
2017-11-28 22:21                 ` Jarkko Sakkinen
2017-11-29 15:38                   ` Jarkko Sakkinen
2017-11-30  3:05                     ` Kai Huang
2017-11-30 16:44                       ` Jarkko Sakkinen
2017-11-28 21:40           ` Jarkko Sakkinen
2017-11-28 21:44             ` Sean Christopherson
2017-11-28 22:03               ` Jarkko Sakkinen
2017-11-28 22:11                 ` Jarkko Sakkinen
2017-11-28 20:51     ` Jarkko Sakkinen
2017-11-25 19:29 ` [PATCH v6 05/11] x86: add SGX MSRs to msr-index.h Jarkko Sakkinen
2017-11-28 17:22   ` Sean Christopherson
2017-11-28 20:48     ` Jarkko Sakkinen
2017-11-25 19:29 ` [PATCH v6 06/11] intel_sgx: driver for Intel Software Guard Extensions Jarkko Sakkinen
2017-11-26 17:33   ` Jarkko Sakkinen
2017-11-26 18:46     ` Jarkko Sakkinen
2017-11-26 19:01       ` Jarkko Sakkinen
2017-11-29 18:02         ` Jarkko Sakkinen
2017-11-28 19:07   ` Sean Christopherson
2017-11-30 17:32   ` Sean Christopherson
2017-12-04  8:59     ` Jarkko Sakkinen [this message]
2017-11-25 19:29 ` [PATCH v6 07/11] intel_sgx: ptrace() support Jarkko Sakkinen
2017-11-26 15:44   ` Jarkko Sakkinen
2017-11-26 15:50     ` Joe Perches
2017-11-26 16:53       ` Jarkko Sakkinen
2017-11-26 17:01   ` Jarkko Sakkinen
2017-11-25 19:29 ` [PATCH v6 08/11] intel_sgx: in-kernel launch enclave Jarkko Sakkinen
2017-11-27  9:58   ` Till Smejkal
2017-11-28 20:17     ` Jarkko Sakkinen
2017-11-28 22:38   ` Jarkko Sakkinen
2017-12-04  9:23     ` Jarkko Sakkinen
2017-11-25 19:29 ` [PATCH v6 09/11] fs/pipe.c: export create_pipe_files() and replace_fd() Jarkko Sakkinen
2017-11-25 19:29   ` Jarkko Sakkinen
2017-11-28 14:35   ` Christoph Hellwig
2017-11-28 20:42     ` Jarkko Sakkinen
2017-11-28 21:05       ` Christoph Hellwig
2017-11-28 21:57         ` Jarkko Sakkinen
2017-11-29 23:13           ` Christoph Hellwig
2017-11-30 16:43             ` Jarkko Sakkinen
2017-11-30 18:38               ` James Bottomley
2017-12-04  9:00                 ` Jarkko Sakkinen
2017-12-04  9:00                   ` Jarkko Sakkinen
2017-12-07 17:37                   ` Jarkko Sakkinen
2017-12-07 17:37                     ` Jarkko Sakkinen
2017-12-08 13:05                     ` Jarkko Sakkinen
2017-11-25 19:29 ` [PATCH v6 10/11] intel_sgx: glue code for in-kernel LE Jarkko Sakkinen
2017-12-13 23:34   ` Christopherson, Sean J
2017-11-25 19:29 ` [PATCH v6 11/11] intel_sgx: driver documentation Jarkko Sakkinen
2017-11-25 19:29   ` Jarkko Sakkinen
2017-12-12 14:07 ` [PATCH v6 00/11] Intel SGX Driver Pavel Machek
2017-12-12 14:07   ` Pavel Machek
2017-12-14 11:18   ` Jarkko Sakkinen
2017-12-14 11:18     ` Jarkko Sakkinen
2017-12-19 23:33   ` Jarkko Sakkinen
2017-12-19 23:33     ` Jarkko Sakkinen
2017-12-20 13:18     ` Jarkko Sakkinen
2017-12-20 13:18       ` Jarkko Sakkinen
2018-01-04 14:17 ` Cedric Blancher
2018-01-04 14:17   ` Cedric Blancher
2018-01-04 14:27   ` Greg Kroah-Hartman
2018-01-04 14:27     ` Greg Kroah-Hartman
2018-01-04 19:18     ` Ozgur
2018-01-04 15:08   ` James Bottomley
2018-01-04 15:08     ` James Bottomley
2018-01-09 14:27   ` Jarkko Sakkinen
2018-01-09 14:27     ` Jarkko Sakkinen
2018-02-08  8:46     ` Pavel Machek
2018-02-08  8:46       ` Pavel Machek
2018-02-08 13:48       ` Jarkko Sakkinen
2018-02-08 13:48         ` 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=20171204085950.dnjsec6xdihhpwbb@linux.intel.com \
    --to=jarkko.sakkinen@linux.intel.com \
    --cc=andy@infradead.org \
    --cc=dvhart@infradead.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=sean.j.christopherson@intel.com \
    --cc=tglx@linutronix.de \
    --cc=x86@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.