drm/i915/selftests: ditch the kernel context
Subsystems (2)
PATCH 1/1 drm/i915/selftests: ditch the kernel context
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.
--- drivers/gpu/drm/i915/selftests/huge_pages.c | 57 +++++++++++++++++++---------- 1 file changed, 38 insertions(+), 19 deletions(-)
drivers/gpu/drm/i915/selftests/huge_pages.c +38 -19
@@ -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; }
Signature · 6 lines
2.13.6 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting Matthew Auld (2017-10-10 14:30:30)
Quoted 7 lines
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 fori915_vma_is_ggtt(), so now seems like the opportune time to instead create our own context.
Also
Quoted 1 line
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 :)
Quoted 12 lines
Signed-off-by Matthew Auld <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Chris Wilson <[email protected]>--- drivers/gpu/drm/i915/selftests/huge_pages.c | 57 +++++++++++++++++++---------- 1 file changed, 38 insertions(+), 19 deletions(-)drivers/gpu/drm/i915/selftests/huge_pages.c +0
-0
drivers/gpu/drm/i915/selftests/huge_pages.c static int cpu_check(struct drm_i915_gem_object *obj, u32 dword, u32 val) · line 1051
Quoted 6 lines
drivers/gpu/drm/i915/selftests/huge_pages.c +2
-1@@ -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.
Quoted 15 lines
drivers/gpu/drm/i915/selftests/huge_pages.c +9
-1@@ -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;
drivers/gpu/drm/i915/selftests/huge_pages.c int i915_gem_huge_page_live_selftests(struct drm_i915_private *dev_priv) · line 1733
Quoted 10 lines
drivers/gpu/drm/i915/selftests/huge_pages.c +7
-0+ } + + 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.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for drm/i915/selftests: ditch the kernel context
In reply to Matthew Auld== Series Details ==
== 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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx