intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: Move the mb() following release-mmap into release-mmap
Date: Tue, 6 Oct 2015 15:40:02 +0100	[thread overview]
Message-ID: <5613DD42.6040507@linux.intel.com> (raw)
In-Reply-To: <1444132698-20280-1-git-send-email-chris@chris-wilson.co.uk>


Hi,

On 06/10/15 12:58, Chris Wilson wrote:
> As paranoia, we want to ensure that the CPU's PTEs have been revoked for
> the object before we return from i915_gem_release_mmap(). This allows us
> to rely on there being no outstanding memory accesses and guarantees
> serialisation of the code against concurrent access just by calling
> i915_gem_release_mmap().
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>   drivers/gpu/drm/i915/i915_gem.c | 13 ++++++++++---
>   1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 2b8ed7a2faab..642644f12295 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -1877,11 +1877,21 @@ out:
>   void
>   i915_gem_release_mmap(struct drm_i915_gem_object *obj)
>   {
> +	/* Serialisation between user GTT access and our code depends upon
> +	 * revoking the CPU's PTE whilst the mutex is held. The next user
> +	 * pagefault then has to wait until we release the mutex.
> +	 */
> +	lockdep_assert_held(&obj->base.dev->struct_mutex);
> +
>   	if (!obj->fault_mappable)
>   		return;
>
>   	drm_vma_node_unmap(&obj->base.vma_node,
>   			   obj->base.dev->anon_inode->i_mapping);
> +
> +	/* Ensure that the CPU's PTE are revoked before we return */
> +	mb();
> +

smp_mb() or smp_wmb() would not suffice? Is it needed on uniprocessor?

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-10-06 14:40 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-06 10:39 [PATCH 1/2] drm/i915: Kill DRI1 cliprects Chris Wilson
2015-10-06 10:39 ` [PATCH 2/2] drm/i915: Drop i915_gem_obj_is_pinned() from set-cache-level Chris Wilson
2015-10-06 11:28   ` Daniel Vetter
2015-10-06 11:41     ` Chris Wilson
2015-10-06 11:58       ` [PATCH] drm/i915: Move the mb() following release-mmap into release-mmap Chris Wilson
2015-10-06 14:40         ` Tvrtko Ursulin [this message]
2015-10-14 10:57           ` Chris Wilson
2015-10-06 12:02       ` [PATCH] drm/i915: Stop discarding GTT cache-domain on unbind vma Chris Wilson
2015-10-06 12:40         ` Daniel Vetter
2015-10-06 12:46           ` Chris Wilson
2015-10-06 13:05             ` Daniel Vetter
2015-10-07 15:57   ` [PATCH 2/2] drm/i915: Drop i915_gem_obj_is_pinned() from set-cache-level Tvrtko Ursulin
2015-10-07 16:19     ` Chris Wilson
2015-10-08  9:32       ` Tvrtko Ursulin
2015-10-08  9:46         ` Chris Wilson
2015-10-09 10:17           ` Tvrtko Ursulin
2015-10-09 10:34             ` Chris Wilson
2015-10-09 12:01               ` Tvrtko Ursulin
2015-10-06 11:21 ` [PATCH 1/2] drm/i915: Kill DRI1 cliprects Daniel Vetter
2015-10-06 12:43   ` Chris Wilson
2015-10-06 14:19 ` Tvrtko Ursulin
2015-10-06 15:37   ` Chris Wilson
2015-10-07 13:58     ` Daniel Vetter
2015-10-06 14:29 ` Dave Gordon
2015-10-06 15:36   ` Chris Wilson

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=5613DD42.6040507@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.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).