Skip to contentSkip to conversation

drm/i915/selftests: Extend partial vma coverage to check parallel creation

PATCH In review Abdiel Janulgue 3 participants 6 messages Apr 9, 2018

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

PATCH 1/2 drm/i915/selftests: Extend partial vma coverage to check parallel creation

From: Chris Wilson <[email protected]>

One important use of partial vma is to provide mappable access to the object while it is being used elsewhere (pinned entirely into the unmappable portion of the Global GTT, i.e. for use as a display scanout).

Cc Joonas Lahtinen <[email protected]>
---
 drivers/gpu/drm/i915/selftests/i915_vma.c | 59 +++++++++++++++++++++++++++----
 1 file changed, 52 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/selftests/i915_vma.c +52 -7
index eb89e30..ea48bac 100644
@@ -606,11 +606,17 @@ static int igt_vma_partial(void *arg)
 	struct drm_i915_private *i915 = arg;
 	struct i915_address_space *vm = &i915->ggtt.base;
 	const unsigned int npages = 1021; /* prime! */
-	struct drm_i915_gem_object *obj;
+	struct drm_i915_gem_object *obj = NULL;
 	const struct phase {
 		const char *name;
+		unsigned int flags;
+#define CREATE		BIT(0)
+#define WHOLE		BIT(1)
 	} phases[] = {
-		{ "create" },
+		{ "create", CREATE },
+		{ "lookup" },
+		{ "whole", WHOLE },
+		{ "recreate", CREATE | WHOLE },
 		{ "lookup" },
 		{ },
 	}, *p;
@@ -618,17 +624,44 @@ static int igt_vma_partial(void *arg)
 	struct i915_vma *vma;
 	int err = -ENOMEM;
 
-	/* Create lots of different VMA for the object and check that
+	/*
+	 * Create lots of different VMA for the object and check that
 	 * we are returned the same VMA when we later request the same range.
 	 */
 
-	obj = i915_gem_object_create_internal(i915, npages*PAGE_SIZE);
-	if (IS_ERR(obj))
-		goto out;
-
 	for (p = phases; p->name; p++) { /* exercise both create/lookup */
 		unsigned int count, nvma;
 
+		if (p->flags & CREATE) {
+			if (obj)
+				i915_gem_object_put(obj);
+
+			obj = i915_gem_object_create_internal(i915,
+							      npages*PAGE_SIZE);
+			if (IS_ERR(obj))
+				goto out;
+		}
+
+		if (p->flags & WHOLE) {
+			/*
+			 * Make sure we can create mappable partial vma
+			 * while the whole object is in use elsewhere.
+			 */
+			vma = i915_vma_instance(obj, vm, NULL);
+			if (IS_ERR(vma)) {
+				err = PTR_ERR(vma);
+				goto out_object;
+			}
+
+			err = i915_vma_unbind(vma);
+			if (err)
+				goto out_object;
+
+			err = i915_vma_pin(vma, 0, 0, PIN_GLOBAL | PIN_HIGH);
+			if (err)
+				goto out_object;
+		}
+
 		nvma = 0;
 		for_each_prime_number_from(sz, 1, npages) {
 			for_each_prime_number_from(offset, 0, npages - sz) {
@@ -707,12 +740,24 @@ static int igt_vma_partial(void *arg)
 			err = -EINVAL;
 			goto out_object;
 		}
+
+		if (p->flags & WHOLE) {
+			vma = i915_vma_instance(obj, vm, NULL);
+			if (IS_ERR(vma)) {
+				err = PTR_ERR(vma);
+				goto out_object;
+			}
+
+			i915_vma_unpin(vma);
+		}
 	}
 
 out_object:
 	i915_gem_object_put(obj);
 out:
 	return err;
+#undef CREATE
+#undef WHOLE
 }
 
 int i915_vma_mock_selftests(void)
Signature · 6 lines
2.7.4

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

PATCH 2/2 drm/i915/selftests: Compare mappable vma against instance in unmappable region

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.

Cc Joonas Lahtinen <[email protected]>
Cc Chris Wilson <[email protected]>
---
 drivers/gpu/drm/i915/selftests/i915_vma.c | 44 ++++++++++++++++++++++++++++++-
 1 file changed, 43 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/selftests/i915_vma.c +43 -1
index ea48bac..10cf4df 100644
@@ -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);
 		}
 	}
Signature · 6 lines
2.7.4

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

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

Quoting Abdiel Janulgue (2018-04-09 12:28:04)

Quoted 9 lines

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.

Cc Joonas Lahtinen <[email protected]>
Cc Chris Wilson <[email protected]>

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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

✗ Fi.CI.CHECKPATCH: warning for series starting with [1/2] drm/i915/selftests: Extend partial vma coverage to check parallel creation

In reply to Abdiel Janulgue
== Series Details ==

== Series Details ==

Series: series starting with [1/2] drm/i915/selftests: Extend partial vma coverage to check parallel creation
URL : https://patchwork.freedesktop.org/series/41359/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
6a326fc76a03 drm/i915/selftests: Extend partial vma coverage to check parallel creation
-:60: CHECK:SPACING: spaces preferred around that '*' (ctx:VxV)
#60: FILE: drivers/gpu/drm/i915/selftests/i915_vma.c:640:
+							      npages*PAGE_SIZE);
 							            ^

total: 0 errors, 0 warnings, 1 checks, 92 lines checked
d9b8dd829776 drm/i915/selftests: Compare mappable vma against instance in unmappable region -:7: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line) #7:
Add an additional comparison to check the entire vma created in the mappable

total: 0 errors, 1 warnings, 0 checks, 68 lines checked

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

#4 lore raw

✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915/selftests: Extend partial vma coverage to check parallel creation

In reply to Abdiel Janulgue
== Series Details ==

== Series Details ==

Series: series starting with [1/2] drm/i915/selftests: Extend partial vma coverage to check parallel creation
URL : https://patchwork.freedesktop.org/series/41359/
State : success

== Summary ==

Series 41359v1 series starting with [1/2] drm/i915/selftests: Extend partial vma coverage to check parallel creation
https://patchwork.freedesktop.org/api/1.0/series/41359/revisions/1/mbox/

---- Known issues:

Test debugfs_test:

        Subgroup read_all_entries:
                incomplete -> PASS       (fi-snb-2520m) fdo#103713
Test gem_ctx_param:
        Subgroup basic-default:
                incomplete -> PASS       (fi-cnl-y3) fdo#105086
Test kms_chamelium:
        Subgroup dp-edid-read:
                fail       -> PASS       (fi-kbl-7500u) fdo#102505
Test kms_flip:
        Subgroup basic-flip-vs-wf_vblank:
                fail       -> PASS       (fi-cfl-s3) fdo#100368

fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
fdo#105086 https://bugs.freedesktop.org/show_bug.cgi?id=105086
fdo#102505 https://bugs.freedesktop.org/show_bug.cgi?id=102505
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368

fi-bdw-5557u     total:285  pass:264  dwarn:0   dfail:0   fail:0   skip:21  time:429s
fi-bdw-gvtdvm    total:285  pass:261  dwarn:0   dfail:0   fail:0   skip:24  time:440s
fi-blb-e6850     total:285  pass:220  dwarn:1   dfail:0   fail:0   skip:64  time:380s
fi-bsw-n3050     total:285  pass:239  dwarn:0   dfail:0   fail:0   skip:46  time:538s
fi-bwr-2160      total:285  pass:180  dwarn:0   dfail:0   fail:0   skip:105 time:297s
fi-bxt-dsi       total:285  pass:255  dwarn:0   dfail:0   fail:0   skip:30  time:515s
fi-bxt-j4205     total:285  pass:256  dwarn:0   dfail:0   fail:0   skip:29  time:514s
fi-byt-j1900     total:285  pass:250  dwarn:0   dfail:0   fail:0   skip:35  time:519s
fi-byt-n2820     total:285  pass:246  dwarn:0   dfail:0   fail:0   skip:39  time:506s
fi-cfl-8700k     total:285  pass:257  dwarn:0   dfail:0   fail:0   skip:28  time:411s
fi-cfl-s3        total:285  pass:259  dwarn:0   dfail:0   fail:0   skip:26  time:559s
fi-cfl-u         total:285  pass:259  dwarn:0   dfail:0   fail:0   skip:26  time:511s
fi-cnl-y3        total:285  pass:259  dwarn:0   dfail:0   fail:0   skip:26  time:583s
fi-elk-e7500     total:285  pass:226  dwarn:0   dfail:0   fail:0   skip:59  time:431s
fi-gdg-551       total:285  pass:176  dwarn:0   dfail:0   fail:1   skip:108 time:314s
fi-glk-1         total:285  pass:257  dwarn:0   dfail:0   fail:0   skip:28  time:535s
fi-glk-j4005     total:285  pass:256  dwarn:0   dfail:0   fail:0   skip:29  time:486s
fi-hsw-4770      total:285  pass:258  dwarn:0   dfail:0   fail:0   skip:27  time:404s
fi-ilk-650       total:285  pass:225  dwarn:0   dfail:0   fail:0   skip:60  time:428s
fi-ivb-3520m     total:285  pass:256  dwarn:0   dfail:0   fail:0   skip:29  time:476s
fi-ivb-3770      total:285  pass:252  dwarn:0   dfail:0   fail:0   skip:33  time:440s
fi-kbl-7500u     total:285  pass:260  dwarn:1   dfail:0   fail:0   skip:24  time:472s
fi-kbl-7567u     total:285  pass:265  dwarn:0   dfail:0   fail:0   skip:20  time:462s
fi-kbl-r         total:285  pass:258  dwarn:0   dfail:0   fail:0   skip:27  time:511s
fi-pnv-d510      total:285  pass:220  dwarn:1   dfail:0   fail:0   skip:64  time:670s
fi-skl-6260u     total:285  pass:265  dwarn:0   dfail:0   fail:0   skip:20  time:447s
fi-skl-6600u     total:285  pass:258  dwarn:0   dfail:0   fail:0   skip:27  time:533s
fi-skl-6700k2    total:285  pass:261  dwarn:0   dfail:0   fail:0   skip:24  time:501s
fi-skl-6770hq    total:285  pass:265  dwarn:0   dfail:0   fail:0   skip:20  time:502s
fi-skl-guc       total:285  pass:257  dwarn:0   dfail:0   fail:0   skip:28  time:426s
fi-skl-gvtdvm    total:285  pass:262  dwarn:0   dfail:0   fail:0   skip:23  time:445s
fi-snb-2520m     total:285  pass:245  dwarn:0   dfail:0   fail:0   skip:40  time:581s
fi-snb-2600      total:285  pass:245  dwarn:0   dfail:0   fail:0   skip:40  time:398s

1be073153147c5c39cdcbdfdeb4e2595ba595bf7 drm-tip: 2018y-04m-07d-22h-26m-31s UTC integration manifest d9b8dd829776 drm/i915/selftests: Compare mappable vma against instance in unmappable region 6a326fc76a03 drm/i915/selftests: Extend partial vma coverage to check parallel creation

== Logs ==

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

#5 lore raw

✗ Fi.CI.IGT: failure for series starting with [1/2] drm/i915/selftests: Extend partial vma coverage to check parallel creation

In reply to Abdiel Janulgue
== Series Details ==

== Series Details ==

Series: series starting with [1/2] drm/i915/selftests: Extend partial vma coverage to check parallel creation
URL : https://patchwork.freedesktop.org/series/41359/
State : failure

== Summary ==

---- Possible new issues:

Test drv_selftest:

        Subgroup mock_vma:
                pass       -> DMESG-FAIL (shard-hsw)
Test gem_pwrite:
        Subgroup big-gtt-backwards:
                skip       -> PASS       (shard-apl)

---- Known issues:

Test kms_flip:

        Subgroup 2x-flip-vs-expired-vblank-interruptible:
                fail       -> PASS       (shard-hsw) fdo#102887
        Subgroup 2x-plain-flip-fb-recreate:
                fail       -> PASS       (shard-hsw) fdo#100368
        Subgroup modeset-vs-vblank-race-interruptible:
                pass       -> FAIL       (shard-hsw) fdo#103060 +1
Test kms_sysfs_edid_timing:
                pass       -> WARN       (shard-apl) fdo#100047

fdo#102887 https://bugs.freedesktop.org/show_bug.cgi?id=102887
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#103060 https://bugs.freedesktop.org/show_bug.cgi?id=103060
fdo#100047 https://bugs.freedesktop.org/show_bug.cgi?id=100047

shard-apl        total:2680 pass:1835 dwarn:1   dfail:0   fail:7   skip:836 time:12777s
shard-hsw        total:2680 pass:1783 dwarn:1   dfail:1   fail:3   skip:891 time:11456s
Blacklisted hosts:
shard-kbl        total:2680 pass:1960 dwarn:1   dfail:0   fail:9   skip:710 time:9198s
shard-snb        total:2680 pass:1377 dwarn:1   dfail:0   fail:3   skip:1299 time:6941s

== Logs ==

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