Skip to contentSkip to conversation

drm/i915/selftests: add missing gtt shrinker test

PATCH In review Matthew Auld 3 participants 4 messages Jan 31, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915/selftests: add missing gtt shrinker test

Try to catch a bug we've seen in the wild where the shrinker purges the pd/pdp from under us while allocating our paging structures.

References: https://bugs.freedesktop.org/show_bug.cgi?id=104773

---
 drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 84 +++++++++++++++++++++++++++
 1 file changed, 84 insertions(+)
drivers/gpu/drm/i915/selftests/i915_gem_gtt.c +84 -0
index bb7cf998fc65..a40a2a7514fd 100644
@@ -885,6 +885,84 @@ static int shrink_hole(struct drm_i915_private *i915,
 	return err;
 }
 
+static int shrink_boom(struct drm_i915_private *i915,
+		       struct i915_address_space *vm,
+		       u64 hole_start, u64 hole_end,
+		       unsigned long end_time)
+{
+	unsigned int sizes[] = {SZ_2M, SZ_1G};
+	struct drm_i915_gem_object *purge;
+	struct drm_i915_gem_object *explode;
+	struct i915_vma *vma;
+	unsigned int flags = PIN_USER | PIN_OFFSET_FIXED;
+	int err;
+	int i;
+
+	/*
+	 * Catch the case which shrink_hole seems to miss. The setup here
+	 * requires invoking the shrinker as we do the alloc_pt/alloc_pd, while
+	 * ensuring that all vma assiocated with the respective pd/pdp are
+	 * unpinned at the time.
+	 */
+
+	for (i = 0; i < ARRAY_SIZE(sizes); ++i) {
+		unsigned int size = sizes[i];
+
+		purge = fake_dma_object(i915, size);
+		if (IS_ERR(purge))
+			return PTR_ERR(purge);
+
+		vma = i915_vma_instance(purge, vm, NULL);
+		if (IS_ERR(vma)) {
+			err = PTR_ERR(vma);
+			goto err_purge;
+		}
+
+		err = i915_vma_pin(vma, 0, 0, flags);
+		if (err)
+			goto err_purge;
+
+		/* Should now be ripe for purging */
+		i915_vma_unpin(vma);
+
+		explode = fake_dma_object(i915, size);
+		if (IS_ERR(explode)) {
+			err = PTR_ERR(purge);
+			goto err_purge;
+		}
+
+		vm->fault_attr.probability = 100;
+		vm->fault_attr.interval = 1;
+		atomic_set(&vm->fault_attr.times, -1);
+
+		vma = i915_vma_instance(explode, vm, NULL);
+		if (IS_ERR(vma)) {
+			err = PTR_ERR(vma);
+			goto err_explode;
+		}
+
+		err = i915_vma_pin(vma, 0, 0, flags | size);
+		if (err)
+			goto err_explode;
+
+		i915_vma_unpin(vma);
+
+		i915_gem_object_put(purge);
+		i915_gem_object_put(explode);
+
+		memset(&vm->fault_attr, 0, sizeof(vm->fault_attr));
+	}
+
+	return 0;
+
+err_explode:
+	i915_gem_object_put(explode);
+err_purge:
+	i915_gem_object_put(purge);
+
+	return err;
+}
+
 static int exercise_ppgtt(struct drm_i915_private *dev_priv,
 			  int (*func)(struct drm_i915_private *i915,
 				      struct i915_address_space *vm,
@@ -953,6 +1031,11 @@ static int igt_ppgtt_shrink(void *arg)
 	return exercise_ppgtt(arg, shrink_hole);
 }
 
+static int igt_ppgtt_shrink_boom(void *arg)
+{
+	return exercise_ppgtt(arg, shrink_boom);
+}
+
 static int sort_holes(void *priv, struct list_head *A, struct list_head *B)
 {
 	struct drm_mm_node *a = list_entry(A, typeof(*a), hole_stack);
@@ -1577,6 +1660,7 @@ int i915_gem_gtt_live_selftests(struct drm_i915_private *i915)
 		SUBTEST(igt_ppgtt_pot),
 		SUBTEST(igt_ppgtt_fill),
 		SUBTEST(igt_ppgtt_shrink),
+		SUBTEST(igt_ppgtt_shrink_boom),
 		SUBTEST(igt_ggtt_lowlevel),
 		SUBTEST(igt_ggtt_drunk),
 		SUBTEST(igt_ggtt_walk),
Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

✓ Fi.CI.BAT: success for drm/i915/selftests: add missing gtt shrinker test

== Series Details ==

== Series Details ==

Series: drm/i915/selftests: add missing gtt shrinker test
URL : https://patchwork.freedesktop.org/series/37432/
State : success

== Summary ==

Series 37432v1 drm/i915/selftests: add missing gtt shrinker test
https://patchwork.freedesktop.org/api/1.0/series/37432/revisions/1/mbox/

Test debugfs_test:

        Subgroup read_all_entries:
                dmesg-warn -> FAIL       (fi-elk-e7500) fdo#103989 +1
Test gem_mmap_gtt:
        Subgroup basic-small-bo-tiledx:
                fail       -> PASS       (fi-gdg-551) fdo#102575
Test kms_chamelium:
        Subgroup common-hpd-after-suspend:
                dmesg-warn -> PASS       (fi-skl-6700k2) fdo#104108
Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-b:
                incomplete -> PASS       (fi-snb-2520m) fdo#103713

fdo#103989 https://bugs.freedesktop.org/show_bug.cgi?id=103989
fdo#102575 https://bugs.freedesktop.org/show_bug.cgi?id=102575
fdo#104108 https://bugs.freedesktop.org/show_bug.cgi?id=104108
fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713

fi-bdw-5557u     total:288  pass:267  dwarn:0   dfail:0   fail:0   skip:21  time:422s
fi-bdw-gvtdvm    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:422s
fi-blb-e6850     total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:370s
fi-bsw-n3050     total:288  pass:242  dwarn:0   dfail:0   fail:0   skip:46  time:485s
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:282s
fi-bxt-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:478s
fi-bxt-j4205     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:487s
fi-byt-j1900     total:288  pass:253  dwarn:0   dfail:0   fail:0   skip:35  time:465s
fi-byt-n2820     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:451s
fi-cfl-s2        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:567s
fi-elk-e7500     total:224  pass:167  dwarn:10  dfail:0   fail:1   skip:45 
fi-gdg-551       total:288  pass:180  dwarn:0   dfail:0   fail:0   skip:108 time:277s
fi-glk-1         total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:509s
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:387s
fi-hsw-4770r     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:396s
fi-ilk-650       total:288  pass:228  dwarn:0   dfail:0   fail:0   skip:60  time:410s
fi-ivb-3520m     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:452s
fi-ivb-3770      total:288  pass:255  dwarn:0   dfail:0   fail:0   skip:33  time:411s
fi-kbl-7500u     total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  time:457s
fi-kbl-7560u     total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:498s
fi-kbl-7567u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:451s
fi-kbl-r         total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:500s
fi-pnv-d510      total:288  pass:222  dwarn:1   dfail:0   fail:0   skip:65  time:579s
fi-skl-6260u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:430s
fi-skl-6600u     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:509s
fi-skl-6700hq    total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:529s
fi-skl-6700k2    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:489s
fi-skl-6770hq    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:482s
fi-skl-guc       total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:416s
fi-skl-gvtdvm    total:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  time:430s
fi-snb-2520m     total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:522s
fi-snb-2600      total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:394s

Blacklisted hosts:
fi-glk-dsi total:288 pass:258 dwarn:0 dfail:0 fail:0 skip:30 time:470s

ae93f9b9acf3e9cdbb2be1b68a97c3cc6db66fad drm-tip: 2018y-01m-31d-16h-31m-38s UTC integration manifest 6939c297c5bd drm/i915/selftests: add missing gtt shrinker test

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7843/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw

✗ Fi.CI.IGT: warning for drm/i915/selftests: add missing gtt shrinker test

In reply to Matthew Auld
== Series Details ==

== Series Details ==

Series: drm/i915/selftests: add missing gtt shrinker test
URL : https://patchwork.freedesktop.org/series/37432/
State : warning

== Summary ==

Test perf:

        Subgroup oa-exponents:
                fail       -> PASS       (shard-apl) fdo#102254
        Subgroup enable-disable:
                pass       -> FAIL       (shard-apl) fdo#103715
Test gem_eio:
        Subgroup in-flight:
                fail       -> PASS       (shard-hsw) fdo#104676 +1
Test kms_flip:
        Subgroup flip-vs-expired-vblank-interruptible:
                pass       -> FAIL       (shard-apl) fdo#102887
        Subgroup basic-plain-flip:
                skip       -> PASS       (shard-apl)
Test kms_plane_multiple:
        Subgroup atomic-pipe-b-tiling-yf:
                fail       -> PASS       (shard-apl)
        Subgroup legacy-pipe-a-tiling-x:
                skip       -> PASS       (shard-apl)
Test kms_vblank:
        Subgroup pipe-c-ts-continuation-suspend:
                dmesg-warn -> PASS       (shard-apl)
        Subgroup pipe-a-query-busy:
                skip       -> PASS       (shard-apl)
        Subgroup pipe-b-accuracy-idle:
                skip       -> PASS       (shard-apl)
        Subgroup pipe-c-wait-forked-busy:
                skip       -> PASS       (shard-apl)
        Subgroup crtc-id:
                skip       -> PASS       (shard-apl)
Test kms_draw_crc:
        Subgroup draw-method-xrgb8888-render-untiled:
                skip       -> PASS       (shard-apl)
        Subgroup draw-method-xrgb2101010-render-xtiled:
                skip       -> PASS       (shard-apl)
Test kms_color:
        Subgroup pipe-a-ctm-0-75:
                skip       -> PASS       (shard-apl)
Test kms_frontbuffer_tracking:
        Subgroup fbc-1p-primscrn-spr-indfb-draw-render:
                skip       -> PASS       (shard-apl) fdo#103167 +1
        Subgroup fbc-1p-primscrn-pri-shrfb-draw-blt:
                skip       -> PASS       (shard-apl) fdo#101623 +2
        Subgroup fbc-rgb101010-draw-mmap-gtt:
                skip       -> PASS       (shard-apl)
Test kms_cursor_crc:
        Subgroup cursor-256x256-rapid-movement:
                skip       -> PASS       (shard-apl) fdo#103326
        Subgroup cursor-256x256-dpms:
                skip       -> PASS       (shard-apl)
        Subgroup cursor-128x42-random:
                skip       -> PASS       (shard-apl)
Test kms_pipe_crc_basic:
        Subgroup nonblocking-crc-pipe-c-frame-sequence:
                skip       -> PASS       (shard-apl) fdo#103481
        Subgroup read-crc-pipe-c:
                skip       -> PASS       (shard-apl) fdo#103191
        Subgroup read-crc-pipe-a:
                skip       -> PASS       (shard-apl)
Test kms_busy:
        Subgroup extended-modeset-hang-newfb-with-reset-render-c:
                skip       -> PASS       (shard-apl)
        Subgroup extended-modeset-hang-oldfb-with-reset-render-c:
                skip       -> PASS       (shard-apl) fdo#103336
Test kms_plane_scaling:
        Subgroup pipe-c-plane-scaling:
                skip       -> PASS       (shard-apl)
Test kms_rotation_crc:
        Subgroup primary-rotation-90-y-tiled:
                skip       -> PASS       (shard-apl)
Test kms_cursor_legacy:
        Subgroup basic-flip-after-cursor-varying-size:
                skip       -> PASS       (shard-apl) fdo#102670
        Subgroup cursora-vs-flipa-atomic:
                skip       -> PASS       (shard-apl)
Test kms_chv_cursor_fail:
        Subgroup pipe-a-128x128-bottom-edge:
                skip       -> PASS       (shard-apl)
Test kms_rmfb:
        Subgroup rmfb-ioctl:
                skip       -> PASS       (shard-apl)
Test kms_ccs:
        Subgroup pipe-b-bad-pixel-format:
                skip       -> PASS       (shard-apl)
Test kms_sysfs_edid_timing:
                warn       -> PASS       (shard-apl) fdo#100047
Test drv_selftest:
        Subgroup live_gtt:
                pass       -> DMESG-FAIL (shard-apl) fdo#103927 +1
        Subgroup live_evict:
                pass       -> SKIP       (shard-apl)
        Subgroup live_contexts:
                pass       -> SKIP       (shard-apl)
        Subgroup live_hangcheck:
                pass       -> SKIP       (shard-apl) fdo#104262 +1
        Subgroup live_guc:
                pass       -> SKIP       (shard-apl)

fdo#102254 https://bugs.freedesktop.org/show_bug.cgi?id=102254
fdo#103715 https://bugs.freedesktop.org/show_bug.cgi?id=103715
fdo#104676 https://bugs.freedesktop.org/show_bug.cgi?id=104676
fdo#102887 https://bugs.freedesktop.org/show_bug.cgi?id=102887
fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#101623 https://bugs.freedesktop.org/show_bug.cgi?id=101623
fdo#103326 https://bugs.freedesktop.org/show_bug.cgi?id=103326
fdo#103481 https://bugs.freedesktop.org/show_bug.cgi?id=103481
fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
fdo#103336 https://bugs.freedesktop.org/show_bug.cgi?id=103336
fdo#102670 https://bugs.freedesktop.org/show_bug.cgi?id=102670
fdo#100047 https://bugs.freedesktop.org/show_bug.cgi?id=100047
fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927
fdo#104262 https://bugs.freedesktop.org/show_bug.cgi?id=104262

shard-apl        total:2822 pass:1725 dwarn:1   dfail:1   fail:25  skip:1069 time:12125s
shard-hsw        total:2838 pass:1734 dwarn:1   dfail:0   fail:12  skip:1090 time:12010s
shard-snb        total:2838 pass:1330 dwarn:1   dfail:0   fail:10  skip:1497 time:6563s

Blacklisted hosts:
shard-kbl total:2838 pass:1865 dwarn:1 dfail:1 fail:22 skip:949 time:9577s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7843/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by on v1 1/1
#3 lore raw
In reply to Matthew Auld

Quoting Matthew Auld (2018-01-31 19:14:53)

Quoted 27 lines

Try to catch a bug we've seen in the wild where the shrinker purges the pd/pdp from under us while allocating our paging structures.

References: https://bugs.freedesktop.org/show_bug.cgi?id=104773

---
 drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 84 +++++++++++++++++++++++++++
 1 file changed, 84 insertions(+)
drivers/gpu/drm/i915/selftests/i915_gem_gtt.c +9 -0
index bb7cf998fc65..a40a2a7514fd 100644
@@ -885,6 +885,84 @@ static int shrink_hole(struct drm_i915_private *i915,
        return err;
 }
 
+static int shrink_boom(struct drm_i915_private *i915,
+                      struct i915_address_space *vm,
+                      u64 hole_start, u64 hole_end,
+                      unsigned long end_time)
+{
+       unsigned int sizes[] = {SZ_2M, SZ_1G};
+       struct drm_i915_gem_object *purge;
+       struct drm_i915_gem_object *explode;
+       struct i915_vma *vma;

drivers/gpu/drm/i915/selftests/i915_gem_gtt.c static int shrink_hole(struct drm_i915_private *i915, · line 906

Quoted 10 lines
drivers/gpu/drm/i915/selftests/i915_gem_gtt.c +10 -0
+       unsigned int flags = PIN_USER | PIN_OFFSET_FIXED;
+       int err;
+       int i;
+
+       /*
+        * Catch the case which shrink_hole seems to miss. The setup here
+        * requires invoking the shrinker as we do the alloc_pt/alloc_pd, while
+        * ensuring that all vma assiocated with the respective pd/pdp are
+        * unpinned at the time.
+        */

Question for everyone: can we see more holes in shrink_hole?

Quoted 48 lines
drivers/gpu/drm/i915/selftests/i915_gem_gtt.c +48 -0
+
+       for (i = 0; i < ARRAY_SIZE(sizes); ++i) {
+               unsigned int size = sizes[i];
+
+               purge = fake_dma_object(i915, size);
+               if (IS_ERR(purge))
+                       return PTR_ERR(purge);
+
+               vma = i915_vma_instance(purge, vm, NULL);
+               if (IS_ERR(vma)) {
+                       err = PTR_ERR(vma);
+                       goto err_purge;
+               }
+
+               err = i915_vma_pin(vma, 0, 0, flags);
+               if (err)
+                       goto err_purge;
+
+               /* Should now be ripe for purging */
+               i915_vma_unpin(vma);
+
+               explode = fake_dma_object(i915, size);
+               if (IS_ERR(explode)) {
+                       err = PTR_ERR(purge);
+                       goto err_purge;
+               }
+
+               vm->fault_attr.probability = 100;
+               vm->fault_attr.interval = 1;
+               atomic_set(&vm->fault_attr.times, -1);
+
+               vma = i915_vma_instance(explode, vm, NULL);
+               if (IS_ERR(vma)) {
+                       err = PTR_ERR(vma);
+                       goto err_explode;
+               }
+
+               err = i915_vma_pin(vma, 0, 0, flags | size);
+               if (err)
+                       goto err_explode;
+
+               i915_vma_unpin(vma);
+
+               i915_gem_object_put(purge);
+               i915_gem_object_put(explode);
+
+               memset(&vm->fault_attr, 0, sizeof(vm->fault_attr));
+       }

drivers/gpu/drm/i915/selftests/i915_gem_gtt.c static int shrink_hole(struct drm_i915_private *i915, · line 964

Quoted 10 lines
drivers/gpu/drm/i915/selftests/i915_gem_gtt.c +10 -0
+
+       return 0;
+
+err_explode:
+       i915_gem_object_put(explode);
+err_purge:
+       i915_gem_object_put(purge);
+
+       return err;
+}

As this demonstrates a shrinker bug we missed in the test intended to find all shrinker bugs,

Just worrying about how deep the iceberg goes. (Though more about catching tomorrow's bug as we should have this one fixed pretty shortly.) -Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx