linux-sgx.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: Sean Christopherson <sean.j.christopherson@intel.com>
Cc: linux-sgx@vger.kernel.org
Subject: Re: [PATCH v3] x86/sgx: Fix deadlock and race conditions between fork() and EPC reclaim
Date: Mon, 6 Apr 2020 23:41:01 +0300	[thread overview]
Message-ID: <20200406204047.GA31633@linux.intel.com> (raw)
In-Reply-To: <20200406161557.GE21330@linux.intel.com>

On Mon, Apr 06, 2020 at 09:15:57AM -0700, Sean Christopherson wrote:
> >  	encl->ssaframesize = secs->ssa_frame_size;
> > +	encl->mm_list_version = 1;
> 
> This is unnecessary.  A mm_list_version of '0' means the list walk started
> when there were no mm structs associated with the enclave, i.e. skipping
> everything related to walking the list is ok.  It's subtle, and I dislike
> relying on that behavior, but IMO it's preferable to incorrectly implying
> that a list version of '0' is somehow bad.

'0' means whatever code requires to mean. There is no absolute meaning.

> > +	for ( ; ; ) {
> > +		next = encl->mm_list_version;
> >  
> > -		down_read(&encl_mm->mm->mmap_sem);
> > +		if (version == next)
> > +			break;
> 
> Functionally this works, but I personally find it the logic kludgy, and it
> generates worse code.  Not that we're at the point where counting uops is a
> to priority, but I don't think it makes sense to go out of our way to make
> the resulting code worse.

I'll pick v2 then.

/Jarkko

      reply	other threads:[~2020-04-06 20:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-04  1:07 [PATCH v3] x86/sgx: Fix deadlock and race conditions between fork() and EPC reclaim Jarkko Sakkinen
2020-04-06 16:15 ` Sean Christopherson
2020-04-06 20:41   ` Jarkko Sakkinen [this message]

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