Re: [Intel-gfx] [PATCH 2/2] drm/i915/selftests: Compare mappable vma against instance in unmappable region

2018-04-09 Thread Chris Wilson
Quoting Abdiel Janulgue (2018-04-09 12:28:04)
> Add an additional comparison to check the entire vma created in the mappable
> region of the global GTT against the one in the unmappable range.
> 
> Further test with an assert_partial as well to ensure the VMA corresponds
> to the original object's backing store.
> 
> Signed-off-by: Abdiel Janulgue 
> Cc: Joonas Lahtinen 
> Cc: Chris Wilson 

It seems like instead of comparing two vma, you just need to compare the
vma->pages against the parent obj->pages.

Don't we already do that? We do check we can write through the vma and
read it via the obj. That should be checking the pages do map correctly,
and are also tiled correctly. And we do check partial vs object dma
addresses.

Adding this pass to igt_vma_partial() looks redundant as you have
already established both vma point to the same obj->pages.
-Chris
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 2/2] drm/i915/selftests: Compare mappable vma against instance in unmappable region

2018-04-09 Thread Abdiel Janulgue
Add an additional comparison to check the entire vma created in the mappable
region of the global GTT against the one in the unmappable range.

Further test with an assert_partial as well to ensure the VMA corresponds
to the original object's backing store.

Signed-off-by: Abdiel Janulgue 
Cc: Joonas Lahtinen 
Cc: Chris Wilson 
---
 drivers/gpu/drm/i915/selftests/i915_vma.c | 44 ++-
 1 file changed, 43 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/selftests/i915_vma.c 
b/drivers/gpu/drm/i915/selftests/i915_vma.c
index ea48bac..10cf4df 100644
--- a/drivers/gpu/drm/i915/selftests/i915_vma.c
+++ b/drivers/gpu/drm/i915/selftests/i915_vma.c
@@ -554,6 +554,30 @@ static bool assert_partial(struct drm_i915_gem_object *obj,
return true;
 }
 
+static bool assert_vma_compare(struct i915_vma *vma1, struct i915_vma *vma2)
+{
+   struct sgt_iter sgt;
+   dma_addr_t dma;
+   unsigned long offset = 0;
+
+   for_each_sgt_dma(dma, sgt, vma1->pages) {
+   dma_addr_t src;
+
+   src = sg_dma_address(vma2->pages->sgl) +
+   (offset << PAGE_SHIFT);
+
+   if (src != dma) {
+   pr_err("VMA comparison failed. DMA mismatch for partial 
"
+  "page offset %lu\n", offset);
+   return false;
+   }
+
+   offset++;
+   }
+
+   return true;
+}
+
 static bool assert_pin(struct i915_vma *vma,
   struct i915_ggtt_view *view,
   u64 size,
@@ -621,7 +645,7 @@ static int igt_vma_partial(void *arg)
{ },
}, *p;
unsigned int sz, offset;
-   struct i915_vma *vma;
+   struct i915_vma *vma, *vma_unmapped = NULL;
int err = -ENOMEM;
 
/*
@@ -660,6 +684,8 @@ static int igt_vma_partial(void *arg)
err = i915_vma_pin(vma, 0, 0, PIN_GLOBAL | PIN_HIGH);
if (err)
goto out_object;
+
+   vma_unmapped = vma;
}
 
nvma = 0;
@@ -748,6 +774,22 @@ static int igt_vma_partial(void *arg)
goto out_object;
}
 
+   if (!assert_partial(obj, vma, 0, npages)) {
+   pr_err("(%s) Inconsistent partial pages for 
(offset=%d, size=%d)\n",
+  p->name, offset, sz);
+   err = -EINVAL;
+   goto out_object;
+   }
+
+   if (vma_unmapped) {
+   if (!assert_vma_compare(vma, vma_unmapped)) {
+   pr_err("(%s) Inconsistent vma from 
unmapped region\n",
+  p->name);
+   err = -EINVAL;
+   goto out_object;
+   }
+   }
+
i915_vma_unpin(vma);
}
}
-- 
2.7.4

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