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 for_v21 1/2] x86/sgx: Use SRCU to protect mm_list during reclaim
Date: Fri, 12 Jul 2019 06:44:09 +0300 [thread overview]
Message-ID: <20190712034409.6qusjbljfexe2ogf@linux.intel.com> (raw)
In-Reply-To: <20190711212549.GO15067@linux.intel.com>
On Thu, Jul 11, 2019 at 02:25:49PM -0700, Sean Christopherson wrote:
> On Fri, Jul 12, 2019 at 12:13:07AM +0300, Jarkko Sakkinen wrote:
> > On Thu, Jul 11, 2019 at 09:16:24AM -0700, Sean Christopherson wrote:
> > > Not taking a reference to encl_mm is not just an optimization, it's also
> > > functionally necessary and a major motivation to moving to SRCu. Putting
> > > the reference can invoke sgx_encl_mm_release(), which calls
> > > synchronize_srcu() and will deadlock if done while holding the SRCU read
> > > lock. Not taking a reference paves the way for additional refcounting
> > > improvements that would be extremely difficult to implement when using
> > > the custom walker due to cyclical dependencies on the refcount.
> >
> > I'm not sure I get this. The existing code does not have a call to
> > synchronize_srcu().
>
> Does this read any better?
>
> Not taking a reference to encl_mm is not just an optimization, it's also
> functionally necessary and a major motivation to moving to SRCU. From a
> functional perspective, putting the encl_mm reference can invoke
> sgx_encl_mm_release(), which now calls synchronize_srcu() and thus will
> deadlock if triggered while holding the SRCU read lock. In terms of
> motivation, not taking a reference paves the way for additional refcounting
> improvements that would be extremely difficult to implement when using
> the custom walker due to cyclical dependencies on the encl_mm's refcount.
No need to change the commit message. Was just a question. I got the
code change :-) Thanks anyway for elaborating.
>
> > > - if (!encl)
> > > - return;
> > > + lockdep_assert_held_exclusive(&mm->mmap_sem);
> >
> > Just a question: what does it check (12:10AM too tired to check,
> > apologies)?
>
> Asserts that the caller has done down_write(&mmap_sem), i.e. guarantees
> that sgx_encl_mm_add() cannot be called in parallel on the same mm_struct.
next prev parent reply other threads:[~2019-07-12 3:44 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-11 16:16 [PATCH for_v21 0/2] x86/sgx: Use SRCU and mmu_notifier Sean Christopherson
2019-07-11 16:16 ` [PATCH for_v21 1/2] x86/sgx: Use SRCU to protect mm_list during reclaim Sean Christopherson
2019-07-11 21:13 ` Jarkko Sakkinen
2019-07-11 21:25 ` Sean Christopherson
2019-07-12 3:44 ` Jarkko Sakkinen [this message]
2019-07-11 16:16 ` [PATCH for_v21 2/2] x86/sgx: Use mmu_notifier.release() instead of per-vma refcounting Sean Christopherson
2019-07-11 21:16 ` Jarkko Sakkinen
2019-07-11 18:01 ` [PATCH for_v21 0/2] x86/sgx: Use SRCU and mmu_notifier Jarkko Sakkinen
2019-07-11 21:51 ` Jarkko Sakkinen
2019-07-12 4:17 ` 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=20190712034409.6qusjbljfexe2ogf@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