All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915/selftests: ditch the kernel context
@ 2017-10-10 13:30 Matthew Auld
  2017-10-10 13:54 ` Chris Wilson
  2017-10-10 14:52 ` ✗ Fi.CI.BAT: failure for " Patchwork
  0 siblings, 2 replies; 3+ messages in thread
From: Matthew Auld @ 2017-10-10 13:30 UTC (permalink / raw)
  To: intel-gfx

There's really no good reason to be using the kernel context for the
huge-page livetests. Also with the introduction of commit bef27bdb6cfb
("drm/i915: Assert we do not try to expand VMA for hugepage inside GGTT")
we start hitting the bug on in the selftests, since the kernel context
will always return true for i915_vma_is_ggtt(), so now seems like the
opportune time to instead create our own context.

Fixes: bef27bdb6cfb ("drm/i915: Assert we do not try to expand VMA for hugepage inside GGTT")
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/selftests/huge_pages.c | 57 +++++++++++++++++++----------
 1 file changed, 38 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/i915/selftests/huge_pages.c b/drivers/gpu/drm/i915/selftests/huge_pages.c
index b8b9d0822199..c53f8474113a 100644
--- a/drivers/gpu/drm/i915/selftests/huge_pages.c
+++ b/drivers/gpu/drm/i915/selftests/huge_pages.c
@@ -1047,10 +1047,10 @@ static int cpu_check(struct drm_i915_gem_object *obj, u32 dword, u32 val)
 	return err;
 }
 
-static int igt_write_huge(struct drm_i915_gem_object *obj)
+static int igt_write_huge(struct i915_gem_context *ctx,
+			  struct drm_i915_gem_object *obj)
 {
 	struct drm_i915_private *i915 = to_i915(obj->base.dev);
-	struct i915_gem_context *ctx = i915->kernel_context;
 	struct i915_address_space *vm = ctx->ppgtt ? &ctx->ppgtt->base : &i915->ggtt.base;
 	struct intel_engine_cs *engine;
 	struct i915_vma *vma;
@@ -1149,7 +1149,8 @@ static int igt_write_huge(struct drm_i915_gem_object *obj)
 
 static int igt_ppgtt_exhaust_huge(void *arg)
 {
-	struct drm_i915_private *i915 = arg;
+	struct i915_gem_context *ctx = arg;
+	struct drm_i915_private *i915 = ctx->i915;
 	unsigned long supported = INTEL_INFO(i915)->page_sizes;
 	static unsigned int pages[ARRAY_SIZE(page_sizes)];
 	struct drm_i915_gem_object *obj;
@@ -1220,7 +1221,7 @@ static int igt_ppgtt_exhaust_huge(void *arg)
 			/* Force the page-size for the gtt insertion */
 			obj->mm.page_sizes.sg = page_sizes;
 
-			err = igt_write_huge(obj);
+			err = igt_write_huge(ctx, obj);
 			if (err) {
 				pr_err("exhaust write-huge failed with size=%u\n",
 				       size);
@@ -1245,7 +1246,8 @@ static int igt_ppgtt_exhaust_huge(void *arg)
 
 static int igt_ppgtt_internal_huge(void *arg)
 {
-	struct drm_i915_private *i915 = arg;
+	struct i915_gem_context *ctx = arg;
+	struct drm_i915_private *i915 = ctx->i915;
 	struct drm_i915_gem_object *obj;
 	static const unsigned int sizes[] = {
 		SZ_64K,
@@ -1280,7 +1282,7 @@ static int igt_ppgtt_internal_huge(void *arg)
 			goto out_unpin;
 		}
 
-		err = igt_write_huge(obj);
+		err = igt_write_huge(ctx, obj);
 		if (err) {
 			pr_err("internal write-huge failed with size=%u\n",
 			       size);
@@ -1308,7 +1310,8 @@ static inline bool igt_can_allocate_thp(struct drm_i915_private *i915)
 
 static int igt_ppgtt_gemfs_huge(void *arg)
 {
-	struct drm_i915_private *i915 = arg;
+	struct i915_gem_context *ctx = arg;
+	struct drm_i915_private *i915 = ctx->i915;
 	struct drm_i915_gem_object *obj;
 	static const unsigned int sizes[] = {
 		SZ_2M,
@@ -1347,7 +1350,7 @@ static int igt_ppgtt_gemfs_huge(void *arg)
 			goto out_unpin;
 		}
 
-		err = igt_write_huge(obj);
+		err = igt_write_huge(ctx, obj);
 		if (err) {
 			pr_err("gemfs write-huge failed with size=%u\n",
 			       size);
@@ -1370,9 +1373,10 @@ static int igt_ppgtt_gemfs_huge(void *arg)
 
 static int igt_ppgtt_pin_update(void *arg)
 {
-	struct drm_i915_private *dev_priv = arg;
+	struct i915_gem_context *ctx = arg;
+	struct drm_i915_private *dev_priv = ctx->i915;
 	unsigned long supported = INTEL_INFO(dev_priv)->page_sizes;
-	struct i915_hw_ppgtt *ppgtt = dev_priv->kernel_context->ppgtt;
+	struct i915_hw_ppgtt *ppgtt = ctx->ppgtt;
 	struct drm_i915_gem_object *obj;
 	struct i915_vma *vma;
 	unsigned int flags = PIN_USER | PIN_OFFSET_FIXED;
@@ -1473,8 +1477,7 @@ static int igt_ppgtt_pin_update(void *arg)
 	 * land in the now stale 2M page.
 	 */
 
-	err = gpu_write(vma, dev_priv->kernel_context, dev_priv->engine[RCS],
-			0, 0xdeadbeaf);
+	err = gpu_write(vma, ctx, dev_priv->engine[RCS], 0, 0xdeadbeaf);
 	if (err)
 		goto out_unpin;
 
@@ -1492,9 +1495,9 @@ static int igt_ppgtt_pin_update(void *arg)
 
 static int igt_tmpfs_fallback(void *arg)
 {
-	struct drm_i915_private *i915 = arg;
+	struct i915_gem_context *ctx = arg;
+	struct drm_i915_private *i915 = ctx->i915;
 	struct vfsmount *gemfs = i915->mm.gemfs;
-	struct i915_gem_context *ctx = i915->kernel_context;
 	struct i915_address_space *vm = ctx->ppgtt ? &ctx->ppgtt->base : &i915->ggtt.base;
 	struct drm_i915_gem_object *obj;
 	struct i915_vma *vma;
@@ -1549,8 +1552,8 @@ static int igt_tmpfs_fallback(void *arg)
 
 static int igt_shrink_thp(void *arg)
 {
-	struct drm_i915_private *i915 = arg;
-	struct i915_gem_context *ctx = i915->kernel_context;
+	struct i915_gem_context *ctx = arg;
+	struct drm_i915_private *i915 = ctx->i915;
 	struct i915_address_space *vm = ctx->ppgtt ? &ctx->ppgtt->base : &i915->ggtt.base;
 	struct drm_i915_gem_object *obj;
 	struct i915_vma *vma;
@@ -1590,8 +1593,7 @@ static int igt_shrink_thp(void *arg)
 	if (err)
 		goto out_unpin;
 
-	err = gpu_write(vma, i915->kernel_context, i915->engine[RCS], 0,
-			0xdeadbeaf);
+	err = gpu_write(vma, ctx, i915->engine[RCS], 0, 0xdeadbeaf);
 	if (err)
 		goto out_unpin;
 
@@ -1700,6 +1702,8 @@ int i915_gem_huge_page_live_selftests(struct drm_i915_private *dev_priv)
 		SUBTEST(igt_ppgtt_gemfs_huge),
 		SUBTEST(igt_ppgtt_internal_huge),
 	};
+	struct drm_file *file;
+	struct i915_gem_context *ctx;
 	int err;
 
 	if (!USES_PPGTT(dev_priv)) {
@@ -1707,9 +1711,24 @@ int i915_gem_huge_page_live_selftests(struct drm_i915_private *dev_priv)
 		return 0;
 	}
 
+	file = mock_file(dev_priv);
+	if (IS_ERR(file))
+		return PTR_ERR(file);
+
 	mutex_lock(&dev_priv->drm.struct_mutex);
-	err = i915_subtests(tests, dev_priv);
+
+	ctx = live_context(dev_priv, file);
+	if (IS_ERR(ctx)) {
+		err = PTR_ERR(ctx);
+		goto out_unlock;
+	}
+
+	err = i915_subtests(tests, ctx);
+
+out_unlock:
 	mutex_unlock(&dev_priv->drm.struct_mutex);
 
+	mock_file_free(dev_priv, file);
+
 	return err;
 }
-- 
2.13.6

_______________________________________________
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

* Re: [PATCH] drm/i915/selftests: ditch the kernel context
  2017-10-10 13:30 [PATCH] drm/i915/selftests: ditch the kernel context Matthew Auld
@ 2017-10-10 13:54 ` Chris Wilson
  2017-10-10 14:52 ` ✗ Fi.CI.BAT: failure for " Patchwork
  1 sibling, 0 replies; 3+ messages in thread
From: Chris Wilson @ 2017-10-10 13:54 UTC (permalink / raw)
  To: Matthew Auld, intel-gfx

Quoting Matthew Auld (2017-10-10 14:30:30)
> There's really no good reason to be using the kernel context for the
> huge-page livetests. Also with the introduction of commit bef27bdb6cfb
> ("drm/i915: Assert we do not try to expand VMA for hugepage inside GGTT")
> we start hitting the bug on in the selftests, since the kernel context
> will always return true for i915_vma_is_ggtt(), so now seems like the
> opportune time to instead create our own context.
> 

Also
Fixes: 4049866f0913 ("drm/i915/selftests: huge page tests")
> Fixes: bef27bdb6cfb ("drm/i915: Assert we do not try to expand VMA for hugepage inside GGTT")

I think it's worth saying that the explosion is a result of the two :)

> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/selftests/huge_pages.c | 57 +++++++++++++++++++----------
>  1 file changed, 38 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/selftests/huge_pages.c b/drivers/gpu/drm/i915/selftests/huge_pages.c
> index b8b9d0822199..c53f8474113a 100644
> --- a/drivers/gpu/drm/i915/selftests/huge_pages.c
> +++ b/drivers/gpu/drm/i915/selftests/huge_pages.c
> @@ -1047,10 +1047,10 @@ static int cpu_check(struct drm_i915_gem_object *obj, u32 dword, u32 val)
>         return err;
>  }
>  
> -static int igt_write_huge(struct drm_i915_gem_object *obj)
> +static int igt_write_huge(struct i915_gem_context *ctx,
> +                         struct drm_i915_gem_object *obj)

These all seem to follow through nicely.

> @@ -1707,9 +1711,24 @@ int i915_gem_huge_page_live_selftests(struct drm_i915_private *dev_priv)
>                 return 0;
>         }
>  
> +       file = mock_file(dev_priv);
> +       if (IS_ERR(file))
> +               return PTR_ERR(file);
> +
>         mutex_lock(&dev_priv->drm.struct_mutex);
> -       err = i915_subtests(tests, dev_priv);
> +
> +       ctx = live_context(dev_priv, file);
> +       if (IS_ERR(ctx)) {
> +               err = PTR_ERR(ctx);
> +               goto out_unlock;
> +       }
> +
> +       err = i915_subtests(tests, ctx);
> +
> +out_unlock:
>         mutex_unlock(&dev_priv->drm.struct_mutex);
>  
> +       mock_file_free(dev_priv, file);
> +
>         return err;

Oh, we could do s/dev_priv/i915/ here now.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
_______________________________________________
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

* ✗ Fi.CI.BAT: failure for drm/i915/selftests: ditch the kernel context
  2017-10-10 13:30 [PATCH] drm/i915/selftests: ditch the kernel context Matthew Auld
  2017-10-10 13:54 ` Chris Wilson
@ 2017-10-10 14:52 ` Patchwork
  1 sibling, 0 replies; 3+ messages in thread
From: Patchwork @ 2017-10-10 14:52 UTC (permalink / raw)
  To: Matthew Auld; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/selftests: ditch the kernel context
URL   : https://patchwork.freedesktop.org/series/31658/
State : failure

== Summary ==

Series 31658v1 drm/i915/selftests: ditch the kernel context
https://patchwork.freedesktop.org/api/1.0/series/31658/revisions/1/mbox/

Test gem_exec_suspend:
        Subgroup basic-s3:
                pass       -> FAIL       (fi-ivb-3770)
        Subgroup basic-s4-devices:
                pass       -> FAIL       (fi-ivb-3770)
Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-a:
                pass       -> FAIL       (fi-ivb-3770)
        Subgroup suspend-read-crc-pipe-b:
                pass       -> FAIL       (fi-ivb-3770)
        Subgroup suspend-read-crc-pipe-c:
                pass       -> FAIL       (fi-ivb-3770)
                incomplete -> PASS       (fi-kbl-7560u) fdo#102846
Test drv_module_reload:
        Subgroup basic-reload:
                pass       -> INCOMPLETE (fi-ivb-3770)

fdo#102846 https://bugs.freedesktop.org/show_bug.cgi?id=102846

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:458s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:469s
fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:390s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:561s
fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:283s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:523s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:529s
fi-byt-j1900     total:289  pass:253  dwarn:1   dfail:0   fail:0   skip:35  time:544s
fi-byt-n2820     total:289  pass:249  dwarn:1   dfail:0   fail:0   skip:39  time:515s
fi-cfl-s         total:289  pass:256  dwarn:1   dfail:0   fail:0   skip:32  time:564s
fi-cnl-y         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:612s
fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:430s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:598s
fi-hsw-4770      total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:435s
fi-hsw-4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:416s
fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:458s
fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:505s
fi-ivb-3770      total:286  pass:252  dwarn:0   dfail:0   fail:5   skip:28 
fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:498s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:583s
fi-kbl-7567u     total:289  pass:265  dwarn:4   dfail:0   fail:0   skip:20  time:485s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:590s
fi-pnv-d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66  time:665s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:480s
fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:653s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:531s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:516s
fi-snb-2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:579s
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:432s
fi-skl-gvtdvm failed to connect after reboot

1071dc8e15487dd849401c5842d94b312e23d111 drm-tip: 2017y-10m-10d-14h-03m-19s UTC integration manifest
4bfb6493c16b drm/i915/selftests: ditch the kernel context

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_5974/
_______________________________________________
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:[~2017-10-10 14:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-10 13:30 [PATCH] drm/i915/selftests: ditch the kernel context Matthew Auld
2017-10-10 13:54 ` Chris Wilson
2017-10-10 14:52 ` ✗ Fi.CI.BAT: failure for " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.