public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Move assert of page pin vs bind count into i915_vma_unbind
@ 2016-12-30 17:33 Chris Wilson
  2016-12-30 18:03 ` ✓ Fi.CI.BAT: success for " Patchwork
  2016-12-30 19:24 ` [PATCH] " Daniel Vetter
  0 siblings, 2 replies; 3+ messages in thread
From: Chris Wilson @ 2016-12-30 17:33 UTC (permalink / raw)
  To: intel-gfx; +Cc: Daniel Vetter

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>
---
 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

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* ✓ Fi.CI.BAT: success for drm/i915: Move assert of page pin vs bind count into i915_vma_unbind
  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 ` Patchwork
  2016-12-30 19:24 ` [PATCH] " Daniel Vetter
  1 sibling, 0 replies; 3+ messages in thread
From: Patchwork @ 2016-12-30 18:03 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Move assert of page pin vs bind count into i915_vma_unbind
URL   : https://patchwork.freedesktop.org/series/17324/
State : success

== Summary ==

Series 17324v1 drm/i915: Move assert of page pin vs bind count into i915_vma_unbind
https://patchwork.freedesktop.org/api/1.0/series/17324/revisions/1/mbox/


fi-bdw-5557u     total:246  pass:232  dwarn:0   dfail:0   fail:0   skip:14 
fi-bsw-n3050     total:246  pass:207  dwarn:0   dfail:0   fail:0   skip:39 
fi-bxt-j4205     total:246  pass:224  dwarn:0   dfail:0   fail:0   skip:22 
fi-bxt-t5700     total:82   pass:69   dwarn:0   dfail:0   fail:0   skip:12 
fi-byt-j1900     total:246  pass:219  dwarn:0   dfail:0   fail:0   skip:27 
fi-byt-n2820     total:246  pass:215  dwarn:0   dfail:0   fail:0   skip:31 
fi-hsw-4770      total:246  pass:227  dwarn:0   dfail:0   fail:0   skip:19 
fi-hsw-4770r     total:246  pass:227  dwarn:0   dfail:0   fail:0   skip:19 
fi-ivb-3520m     total:246  pass:225  dwarn:0   dfail:0   fail:0   skip:21 
fi-ivb-3770      total:246  pass:225  dwarn:0   dfail:0   fail:0   skip:21 
fi-kbl-7500u     total:246  pass:225  dwarn:0   dfail:0   fail:0   skip:21 
fi-skl-6260u     total:246  pass:233  dwarn:0   dfail:0   fail:0   skip:13 
fi-skl-6700hq    total:246  pass:226  dwarn:0   dfail:0   fail:0   skip:20 
fi-skl-6700k     total:246  pass:222  dwarn:3   dfail:0   fail:0   skip:21 
fi-skl-6770hq    total:246  pass:233  dwarn:0   dfail:0   fail:0   skip:13 
fi-snb-2520m     total:246  pass:215  dwarn:0   dfail:0   fail:0   skip:31 
fi-snb-2600      total:246  pass:214  dwarn:0   dfail:0   fail:0   skip:32 

e4c1cef7d100f25abfb41035e691b60c555a0ae4 drm-tip: 2016y-12m-30d-17h-03m-36s UTC integration manifest
1e615ff7 drm/i915: Move assert of page pin vs bind count into i915_vma_unbind

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3414/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/i915: Move assert of page pin vs bind count into i915_vma_unbind
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Vetter @ 2016-12-30 19:24 UTC (permalink / raw)
  To: Chris Wilson; +Cc: Daniel Vetter, intel-gfx

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-12-30 19:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH] " Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox