From: Daniel Vetter <daniel@ffwll.ch>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: Move assert of page pin vs bind count into i915_vma_unbind
Date: Fri, 30 Dec 2016 20:24:04 +0100 [thread overview]
Message-ID: <20161230192404.GO8712@dvetter-linux.ger.corp.intel.com> (raw)
In-Reply-To: <20161230173314.29157-1-chris@chris-wilson.co.uk>
On Fri, Dec 30, 2016 at 05:33:14PM +0000, Chris Wilson wrote:
> The read of the page pin count and the bind count are unordered,
> presenting races in the assert and it firing off incorrectly. Prevent
> this by restricting the assert to the vma bind/unbind routines where we
> have local cpu ordering between the two.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Fun.
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
> drivers/gpu/drm/i915/i915_drv.h | 1 -
> drivers/gpu/drm/i915/i915_vma.c | 1 +
> 2 files changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 00ecbb4da25e..1aa33444115a 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -3291,7 +3291,6 @@ __i915_gem_object_unpin_pages(struct drm_i915_gem_object *obj)
> GEM_BUG_ON(!obj->mm.pages);
>
> atomic_dec(&obj->mm.pages_pin_count);
> - GEM_BUG_ON(atomic_read(&obj->mm.pages_pin_count) < obj->bind_count);
> }
>
> static inline void
> diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c
> index 414f0f7f5059..d48c68214611 100644
> --- a/drivers/gpu/drm/i915/i915_vma.c
> +++ b/drivers/gpu/drm/i915/i915_vma.c
> @@ -640,6 +640,7 @@ int i915_vma_unbind(struct i915_vma *vma)
> * reaped by the shrinker.
> */
> i915_gem_object_unpin_pages(obj);
> + GEM_BUG_ON(atomic_read(&obj->mm.pages_pin_count) < obj->bind_count);
>
> destroy:
> if (unlikely(i915_vma_is_closed(vma)))
> --
> 2.11.0
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
prev parent reply other threads:[~2016-12-30 19:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-30 17:33 [PATCH] drm/i915: Move assert of page pin vs bind count into i915_vma_unbind Chris Wilson
2016-12-30 18:03 ` ✓ Fi.CI.BAT: success for " Patchwork
2016-12-30 19:24 ` Daniel Vetter [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=20161230192404.GO8712@dvetter-linux.ger.corp.intel.com \
--to=daniel@ffwll.ch \
--cc=chris@chris-wilson.co.uk \
--cc=daniel.vetter@ffwll.ch \
--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