Re: [Intel-gfx] [PATCH 2/2] drm/i915: Match GTT space sanity checker with implementation

2014-09-11 Thread Daniel Vetter
On Wed, Sep 10, 2014 at 07:52:19PM +0100, Chris Wilson wrote:
 If we believe that the device can cross cache domains in its prefetcher
 (i.e. we allow neighbouring pages in different domains), we don't supply
 a color_adjust callback. Use the presence of this callback to better
 determine when we should be verifying that the GTT space we just
 used is valid.
 
 Signed-off-by: Chris Wilson ch...@chris-wilson.co.uk

I guess this needs some serious beating on vlv/chv?

Merged the first patch to dinq, thanks.
-Daniel

 ---
  drivers/gpu/drm/i915/i915_gem.c | 10 +-
  1 file changed, 5 insertions(+), 5 deletions(-)
 
 diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
 index abb2b2ed9c4c..55e3959a0b76 100644
 --- a/drivers/gpu/drm/i915/i915_gem.c
 +++ b/drivers/gpu/drm/i915/i915_gem.c
 @@ -3011,16 +3011,17 @@ i915_gem_object_get_fence(struct drm_i915_gem_object 
 *obj)
  }
  
  static bool i915_gem_valid_gtt_space(struct drm_device *dev,
 -  struct drm_mm_node *gtt_space,
 +  struct i915_vma *vma,
unsigned long cache_level)
  {
 + struct drm_mm_node *gtt_space = vma-node;
   struct drm_mm_node *other;
  
   /* On non-LLC machines we have to be careful when putting differing
* types of snoopable memory together to avoid the prefetcher
* crossing memory domains and dying.
*/
 - if (HAS_LLC(dev))
 + if (vma-vm-mm.color_adjust == NULL)
   return true;
  
   if (!drm_mm_node_allocated(gtt_space))
 @@ -3146,8 +3147,7 @@ search_free:
   goto err_free_vma;
   }
   }
 - if (WARN_ON(!i915_gem_valid_gtt_space(dev, vma-node,
 -   obj-cache_level))) {
 + if (WARN_ON(!i915_gem_valid_gtt_space(dev, vma, obj-cache_level))) {
   ret = -EINVAL;
   goto err_remove_node;
   }
 @@ -3353,7 +3353,7 @@ int i915_gem_object_set_cache_level(struct 
 drm_i915_gem_object *obj,
   }
  
   list_for_each_entry_safe(vma, next, obj-vma_list, vma_link) {
 - if (!i915_gem_valid_gtt_space(dev, vma-node, cache_level)) {
 + if (!i915_gem_valid_gtt_space(dev, vma, cache_level)) {
   ret = i915_vma_unbind(vma);
   if (ret)
   return ret;
 -- 
 2.1.0
 
 ___
 Intel-gfx mailing list
 Intel-gfx@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 2/2] drm/i915: Match GTT space sanity checker with implementation

2014-09-11 Thread Chris Wilson
On Thu, Sep 11, 2014 at 10:02:27AM +0200, Daniel Vetter wrote:
 On Wed, Sep 10, 2014 at 07:52:19PM +0100, Chris Wilson wrote:
  If we believe that the device can cross cache domains in its prefetcher
  (i.e. we allow neighbouring pages in different domains), we don't supply
  a color_adjust callback. Use the presence of this callback to better
  determine when we should be verifying that the GTT space we just
  used is valid.
  
  Signed-off-by: Chris Wilson ch...@chris-wilson.co.uk
 
 I guess this needs some serious beating on vlv/chv?

This shuts up the warning on byt+ by only running the checker when we
actually insert guard pages. Whether or not we need to add guard pages
on byt+ ppgtt is under scrutiny.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 2/2] drm/i915: Match GTT space sanity checker with implementation

2014-09-11 Thread Chris Wilson
On Thu, Sep 11, 2014 at 09:08:12AM +0100, Chris Wilson wrote:
 On Thu, Sep 11, 2014 at 10:02:27AM +0200, Daniel Vetter wrote:
  On Wed, Sep 10, 2014 at 07:52:19PM +0100, Chris Wilson wrote:
   If we believe that the device can cross cache domains in its prefetcher
   (i.e. we allow neighbouring pages in different domains), we don't supply
   a color_adjust callback. Use the presence of this callback to better
   determine when we should be verifying that the GTT space we just
   used is valid.
   
   Signed-off-by: Chris Wilson ch...@chris-wilson.co.uk
  
  I guess this needs some serious beating on vlv/chv?
 
 This shuts up the warning on byt+ by only running the checker when we
 actually insert guard pages. Whether or not we need to add guard pages
 on byt+ ppgtt is under scrutiny.

Actually it is a bit more than a warning. The sanity checker causes
execbuf to fail and the ddx to mark the kernel as broken and insane.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 2/2] drm/i915: Match GTT space sanity checker with implementation

2014-09-10 Thread Chris Wilson
If we believe that the device can cross cache domains in its prefetcher
(i.e. we allow neighbouring pages in different domains), we don't supply
a color_adjust callback. Use the presence of this callback to better
determine when we should be verifying that the GTT space we just
used is valid.

Signed-off-by: Chris Wilson ch...@chris-wilson.co.uk
---
 drivers/gpu/drm/i915/i915_gem.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index abb2b2ed9c4c..55e3959a0b76 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3011,16 +3011,17 @@ i915_gem_object_get_fence(struct drm_i915_gem_object 
*obj)
 }
 
 static bool i915_gem_valid_gtt_space(struct drm_device *dev,
-struct drm_mm_node *gtt_space,
+struct i915_vma *vma,
 unsigned long cache_level)
 {
+   struct drm_mm_node *gtt_space = vma-node;
struct drm_mm_node *other;
 
/* On non-LLC machines we have to be careful when putting differing
 * types of snoopable memory together to avoid the prefetcher
 * crossing memory domains and dying.
 */
-   if (HAS_LLC(dev))
+   if (vma-vm-mm.color_adjust == NULL)
return true;
 
if (!drm_mm_node_allocated(gtt_space))
@@ -3146,8 +3147,7 @@ search_free:
goto err_free_vma;
}
}
-   if (WARN_ON(!i915_gem_valid_gtt_space(dev, vma-node,
- obj-cache_level))) {
+   if (WARN_ON(!i915_gem_valid_gtt_space(dev, vma, obj-cache_level))) {
ret = -EINVAL;
goto err_remove_node;
}
@@ -3353,7 +3353,7 @@ int i915_gem_object_set_cache_level(struct 
drm_i915_gem_object *obj,
}
 
list_for_each_entry_safe(vma, next, obj-vma_list, vma_link) {
-   if (!i915_gem_valid_gtt_space(dev, vma-node, cache_level)) {
+   if (!i915_gem_valid_gtt_space(dev, vma, cache_level)) {
ret = i915_vma_unbind(vma);
if (ret)
return ret;
-- 
2.1.0

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