Skip to contentSkip to conversation

tests/i915/gem_exec_gttfill: Reenable test for discrete

PATCH In review Zbigniew Kempczyński 3 participants 4 messages Apr 1, 2022 – Apr 3, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/i915/gem_exec_gttfill: Reenable test for discrete

Test was turned off unnecessarily for discrete so add softpinning to it and enable it again. Parallel execution on different engines and same vm is thus limited to 4GiB (in userspace we don't have control when same offset would be used for different handles on different engines so we don't want to get -ENOSPC for such situation).

---
 tests/i915/gem_exec_gttfill.c | 40 +++++++++++++++++++++++++++++------
 1 file changed, 34 insertions(+), 6 deletions(-)
tests/i915/gem_exec_gttfill.c +34 -6
index f16428714d..74974d324e 100644
@@ -33,6 +33,7 @@ IGT_TEST_DESCRIPTION("Fill the GTT with batches.");
 struct batch {
 	uint32_t handle;
 	void *ptr;
+	uint64_t offset;
 };
 
 static void xchg_batch(void *array, unsigned int i, unsigned int j)
@@ -45,7 +46,7 @@ static void xchg_batch(void *array, unsigned int i, unsigned int j)
 	batches[j] = tmp;
 }
 
-static void submit(int fd, int gen,
+static void submit(int fd, uint64_t ahnd, int gen,
 		   struct drm_i915_gem_execbuffer2 *eb,
 		   struct drm_i915_gem_relocation_entry *reloc,
 		   struct batch *batches, unsigned int count)
@@ -56,7 +57,7 @@ static void submit(int fd, int gen,
 
 	memset(&obj, 0, sizeof(obj));
 	obj.relocs_ptr = to_user_pointer(reloc);
-	obj.relocation_count = 2;
+	obj.relocation_count = !ahnd ? 2 : 0;
 
 	memset(reloc, 0, 2*sizeof(*reloc));
 	reloc[0].offset = eb->batch_start_offset;
@@ -93,7 +94,17 @@ static void submit(int fd, int gen,
 		reloc[0].target_handle = obj.handle;
 		reloc[1].target_handle = obj.handle;
 
-		obj.offset = 0;
+		if (ahnd) {
+			uint32_t *delta_ptr = batches[i].ptr + reloc[0].delta;
+
+			*delta_ptr = batches[i].offset;
+			batch[1] = batches[i].offset + reloc[0].delta;
+			obj.flags = EXEC_OBJECT_PINNED;
+			obj.offset = batches[i].offset;
+			batch[3] = batches[i].offset;
+		} else {
+			obj.offset = 0;
+		}
 		reloc[0].presumed_offset = obj.offset;
 		reloc[1].presumed_offset = obj.offset;
 
@@ -118,6 +129,7 @@ static void fillgtt(int fd, const intel_ctx_t *ctx, unsigned ring, int timeout)
 	unsigned nengine;
 	unsigned count;
 	uint64_t size;
+	uint64_t ahnd;
 
 	shared = mmap(NULL, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
 	igt_assert(shared != MAP_FAILED);
@@ -157,6 +169,7 @@ static void fillgtt(int fd, const intel_ctx_t *ctx, unsigned ring, int timeout)
 		execbuf.flags |= I915_EXEC_SECURE;
 	execbuf.rsvd1 = ctx->id;
 
+	ahnd = get_reloc_ahnd(fd, ctx->id);
 	batches = calloc(count, sizeof(*batches));
 	igt_assert(batches);
 	for (unsigned i = 0; i < count; i++) {
@@ -164,10 +177,23 @@ static void fillgtt(int fd, const intel_ctx_t *ctx, unsigned ring, int timeout)
 		batches[i].ptr =
 			gem_mmap__device_coherent(fd, batches[i].handle,
 						  0, BATCH_SIZE, PROT_WRITE);
+		batches[i].offset = get_offset(ahnd, batches[i].handle,
+					       BATCH_SIZE, 0);
+		/*
+		 * As we're limiting GTT to 4GiB for softpinning we need to
+		 * ensure we won't assign same offset to two different handles
+		 * otherwise we can encounter -ENOSPC.
+		 */
+		if (batches[i].offset >= 1ull << 32) {
+			gem_close(fd, batches[i].handle);
+			gem_munmap(batches[i].ptr, BATCH_SIZE);
+			count = i - 1;
+			break;
+		}
 	}
 
 	/* Flush all memory before we start the timer */
-	submit(fd, gen, &execbuf, reloc, batches, count);
+	submit(fd, ahnd, gen, &execbuf, reloc, batches, count);
 
 	igt_info("Setup %u batches in %.2fms\n",
 		 count, 1e-6 * igt_nsec_elapsed(&tv));
@@ -179,7 +205,7 @@ static void fillgtt(int fd, const intel_ctx_t *ctx, unsigned ring, int timeout)
 		execbuf.batch_start_offset = child*64;
 		execbuf.flags |= engines[child];
 		igt_until_timeout(timeout) {
-			submit(fd, gen, &execbuf, reloc, batches, count);
+			submit(fd, ahnd, gen, &execbuf, reloc, batches, count);
 			for (unsigned i = 0; i < count; i++) {
 				uint64_t offset, delta;
 
@@ -216,9 +242,9 @@ igt_main
 	igt_fixture {
 		i915 = drm_open_driver(DRIVER_INTEL);
 		igt_require_gem(i915);
-		igt_require(gem_has_relocations(i915));
 		ctx = intel_ctx_create_all_physical(i915);
 		igt_fork_hang_detector(i915);
+		intel_allocator_multiprocess_start();
 	}
 
 	igt_subtest("basic") /* just enough to run a single pass */
@@ -238,8 +264,10 @@ igt_main
 		fillgtt(i915, ctx, ALL_ENGINES, 20);
 
 	igt_fixture {
+		intel_allocator_multiprocess_stop();
 		igt_stop_hang_detector();
 		intel_ctx_destroy(i915, ctx);
 		close(i915);
+
 	}
 }
Signature · 1 line
2.32.0
Reviewed-by Zbigniew Kempczynski on v1 1/1
#1 lore raw

Quoting Zbigniew Kempczyński (2022-04-01 12:38:50)

Quoted 49 lines

Test was turned off unnecessarily for discrete so add softpinning to it and enable it again. Parallel execution on different engines and same vm is thus limited to 4GiB (in userspace we don't have control when same offset would be used for different handles on different engines so we don't want to get -ENOSPC for such situation).

---
 tests/i915/gem_exec_gttfill.c | 40 +++++++++++++++++++++++++++++------
 1 file changed, 34 insertions(+), 6 deletions(-)
tests/i915/gem_exec_gttfill.c +3 -3
index f16428714d..74974d324e 100644
@@ -33,6 +33,7 @@ IGT_TEST_DESCRIPTION("Fill the GTT with batches.");
 struct batch {
        uint32_t handle;
        void *ptr;
+       uint64_t offset;
 };
 
 static void xchg_batch(void *array, unsigned int i, unsigned int j)
@@ -45,7 +46,7 @@ static void xchg_batch(void *array, unsigned int i, unsigned int j)
        batches[j] = tmp;
 }
 
-static void submit(int fd, int gen,
+static void submit(int fd, uint64_t ahnd, int gen,
                   struct drm_i915_gem_execbuffer2 *eb,
                   struct drm_i915_gem_relocation_entry *reloc,
                   struct batch *batches, unsigned int count)
@@ -56,7 +57,7 @@ static void submit(int fd, int gen,
 
        memset(&obj, 0, sizeof(obj));
        obj.relocs_ptr = to_user_pointer(reloc);
-       obj.relocation_count = 2;
+       obj.relocation_count = !ahnd ? 2 : 0;
 
        memset(reloc, 0, 2*sizeof(*reloc));
        reloc[0].offset = eb->batch_start_offset;
@@ -93,7 +94,17 @@ static void submit(int fd, int gen,
                reloc[0].target_handle = obj.handle;
                reloc[1].target_handle = obj.handle;
 
-               obj.offset = 0;

tests/i915/gem_exec_gttfill.c static void submit(int fd, int gen, · line 106

Quoted 10 lines
tests/i915/gem_exec_gttfill.c +10 -0
+               if (ahnd) {
+                       uint32_t *delta_ptr = batches[i].ptr + reloc[0].delta;
+
+                       *delta_ptr = batches[i].offset;
+                       batch[1] = batches[i].offset + reloc[0].delta;
+                       obj.flags = EXEC_OBJECT_PINNED;
+                       obj.offset = batches[i].offset;
+                       batch[3] = batches[i].offset;
+               } else {
+                       obj.offset = 0;

What is this code?

You are missing out on

commit ab0a539f0c723fd86a4d1440ec82004532b0ba22

Author: Chris Wilson <[email protected]>
Date:   Sat Jul 3 10:12:19 2021 +0000

i915/gem_exec_gttfill: Apply relocations inline

The goal of gem_exec_gttfill is to watch what happens when we oversaturate the available GTT, and force the kernel to perform buffer evictions from the virtual address space. We do this by submitting a larger working set than we can possibly make resident, but we can still provide locations hints to the kernel for placing the objects, as the addresses will get reused and eviction occur. The eviction will remain randomised on both a single engine, and across the engines, improving our chance of spotting issues, but we will no long require as many relocations.

#2 lore raw
Quoted 81 lines · Chris Wilson

Quoting Zbigniew Kempczyński (2022-04-01 12:38:50)

Quoted 49 lines

Test was turned off unnecessarily for discrete so add softpinning to it and enable it again. Parallel execution on different engines and same vm is thus limited to 4GiB (in userspace we don't have control when same offset would be used for different handles on different engines so we don't want to get -ENOSPC for such situation).

---
 tests/i915/gem_exec_gttfill.c | 40 +++++++++++++++++++++++++++++------
 1 file changed, 34 insertions(+), 6 deletions(-)
tests/i915/gem_exec_gttfill.c +3 -3
index f16428714d..74974d324e 100644
@@ -33,6 +33,7 @@ IGT_TEST_DESCRIPTION("Fill the GTT with batches.");
 struct batch {
        uint32_t handle;
        void *ptr;
+       uint64_t offset;
 };
 
 static void xchg_batch(void *array, unsigned int i, unsigned int j)
@@ -45,7 +46,7 @@ static void xchg_batch(void *array, unsigned int i, unsigned int j)
        batches[j] = tmp;
 }
 
-static void submit(int fd, int gen,
+static void submit(int fd, uint64_t ahnd, int gen,
                   struct drm_i915_gem_execbuffer2 *eb,
                   struct drm_i915_gem_relocation_entry *reloc,
                   struct batch *batches, unsigned int count)
@@ -56,7 +57,7 @@ static void submit(int fd, int gen,
 
        memset(&obj, 0, sizeof(obj));
        obj.relocs_ptr = to_user_pointer(reloc);
-       obj.relocation_count = 2;
+       obj.relocation_count = !ahnd ? 2 : 0;
 
        memset(reloc, 0, 2*sizeof(*reloc));
        reloc[0].offset = eb->batch_start_offset;
@@ -93,7 +94,17 @@ static void submit(int fd, int gen,
                reloc[0].target_handle = obj.handle;
                reloc[1].target_handle = obj.handle;
 
-               obj.offset = 0;

tests/i915/gem_exec_gttfill.c static void submit(int fd, int gen, · line 106

Quoted 10 lines
tests/i915/gem_exec_gttfill.c +10 -0
+               if (ahnd) {
+                       uint32_t *delta_ptr = batches[i].ptr + reloc[0].delta;
+
+                       *delta_ptr = batches[i].offset;
+                       batch[1] = batches[i].offset + reloc[0].delta;
+                       obj.flags = EXEC_OBJECT_PINNED;
+                       obj.offset = batches[i].offset;
+                       batch[3] = batches[i].offset;
+               } else {
+                       obj.offset = 0;

What is this code?

You are missing out on

commit ab0a539f0c723fd86a4d1440ec82004532b0ba22

Author: Chris Wilson <[email protected]>
Date:   Sat Jul 3 10:12:19 2021 +0000

i915/gem_exec_gttfill: Apply relocations inline

The goal of gem_exec_gttfill is to watch what happens when we oversaturate the available GTT, and force the kernel to perform buffer evictions from the virtual address space. We do this by submitting a larger working set than we can possibly make resident, but we can still provide locations hints to the kernel for placing the objects, as the addresses will get reused and eviction occur. The eviction will remain randomised on both a single engine, and across the engines, improving our chance of spotting issues, but we will no long require as many relocations.

Quoted 2 lines

You're right, I've limited this unnecessarily. Cutting down by casting to uint32_t is wrong, because depending on allocator starting offset I can go beyond 4GiB.

--
Zbigniew

#3 lore raw

[igt-dev] ✗ Fi.CI.BAT: failure for tests/i915/gem_exec_gttfill: Reenable test for discrete

In reply to Zbigniew Kempczyński
== Series Details ==

== Series Details ==

Series: tests/i915/gem_exec_gttfill: Reenable test for discrete
URL : https://patchwork.freedesktop.org/series/102066/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_11438 -> IGTPW_6858
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with IGTPW_6858 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in IGTPW_6858, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6858/index.html

Participating hosts (42 -> 43)
------------------------------

Additional (4): bat-rpls-1 fi-kbl-8809g fi-kbl-guc fi-pnv-d510
Missing (3): fi-bsw-cyan shard-tglu fi-bdw-samus

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in IGTPW_6858:

### IGT changes ###

#### Possible regressions ####

* igt@i915_selftest@live@gt_heartbeat:
- fi-kbl-soraka: [PASS][1] -> [INCOMPLETE][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11438/fi-kbl-soraka/igt@i915_selftest@live@gt_heartbeat.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6858/fi-kbl-soraka/igt@i915_selftest@live@gt_heartbeat.html

#### Suppressed ####

The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.

* igt@gem_lmem_swapping@parallel-random-engines:
- {bat-rpls-1}: NOTRUN -> [INCOMPLETE][3]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6858/bat-rpls-1/igt@[email protected]

Known issues
------------

Here are the changes found in IGTPW_6858 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@fbdev@nullptr:
- fi-kbl-guc: NOTRUN -> [SKIP][4] ([fdo#109271]) +18 similar issues
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6858/fi-kbl-guc/igt@[email protected]

* igt@gem_exec_suspend@basic-s0@smem:
- fi-kbl-8809g: NOTRUN -> [DMESG-WARN][5] ([i915#4962]) +1 similar issue
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6858/fi-kbl-8809g/igt@gem_exec_suspend@[email protected]

* igt@gem_huc_copy@huc-copy:
- fi-pnv-d510: NOTRUN -> [SKIP][6] ([fdo#109271]) +57 similar issues
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6858/fi-pnv-d510/igt@[email protected]
- fi-kbl-8809g: NOTRUN -> [SKIP][7] ([fdo#109271] / [i915#2190])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6858/fi-kbl-8809g/igt@[email protected]

* igt@gem_lmem_swapping@basic:
- fi-kbl-guc: NOTRUN -> [SKIP][8] ([fdo#109271] / [i915#4613]) +3 similar issues
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6858/fi-kbl-guc/igt@[email protected]

* igt@gem_lmem_swapping@random-engines:
- fi-kbl-8809g: NOTRUN -> [SKIP][9] ([fdo#109271] / [i915#4613]) +3 similar issues
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6858/fi-kbl-8809g/igt@[email protected]

* igt@i915_pm_rpm@basic-rte:
- fi-kbl-8809g: NOTRUN -> [SKIP][10] ([fdo#109271]) +54 similar issues
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6858/fi-kbl-8809g/igt@[email protected]

* igt@i915_selftest@live@hangcheck:
- fi-hsw-g3258: [PASS][11] -> [INCOMPLETE][12] ([i915#4785])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11438/fi-hsw-g3258/igt@i915_selftest@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6858/fi-hsw-g3258/igt@i915_selftest@[email protected]

* igt@kms_busy@basic:
- fi-kbl-guc: NOTRUN -> [SKIP][13] ([fdo#109271] / [i915#1845])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6858/fi-kbl-guc/igt@[email protected]

* igt@kms_chamelium@hdmi-edid-read:
- fi-kbl-8809g: NOTRUN -> [SKIP][14] ([fdo#109271] / [fdo#111827]) +8 similar issues
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6858/fi-kbl-8809g/igt@[email protected]

* igt@kms_chamelium@hdmi-hpd-fast:
- fi-kbl-guc: NOTRUN -> [SKIP][15] ([fdo#109271] / [fdo#111827]) +8 similar issues
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6858/fi-kbl-guc/igt@[email protected]

* igt@kms_flip@basic-flip-vs-wf_vblank@a-edp1:
- fi-tgl-u2: [PASS][16] -> [DMESG-WARN][17] ([i915#402])
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11438/fi-tgl-u2/igt@kms_flip@[email protected]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6858/fi-tgl-u2/igt@kms_flip@[email protected]

* igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-c:
- fi-pnv-d510: NOTRUN -> [SKIP][18] ([fdo#109271] / [i915#5341])
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6858/fi-pnv-d510/igt@[email protected]
- fi-kbl-8809g: NOTRUN -> [SKIP][19] ([fdo#109271] / [i915#5341])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6858/fi-kbl-8809g/igt@[email protected]

* igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d:
- fi-kbl-8809g: NOTRUN -> [SKIP][20] ([fdo#109271] / [i915#533])
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6858/fi-kbl-8809g/igt@[email protected]

* igt@runner@aborted:
- fi-kbl-soraka: NOTRUN -> [FAIL][21] ([i915#1436] / [i915#4312])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6858/fi-kbl-soraka/igt@[email protected]
- fi-hsw-g3258: NOTRUN -> [FAIL][22] ([fdo#109271] / [i915#1436] / [i915#4312])
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6858/fi-hsw-g3258/igt@[email protected]

#### Possible fixes ####

* igt@gem_exec_gttfill@basic:
- bat-dg1-6: [SKIP][23] ([i915#4086]) -> [PASS][24]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11438/bat-dg1-6/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6858/bat-dg1-6/igt@[email protected]
- {bat-dg2-9}: [SKIP][25] ([i915#4086]) -> [PASS][26]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11438/bat-dg2-9/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6858/bat-dg2-9/igt@[email protected]

* igt@kms_flip@basic-flip-vs-modeset@a-edp1:
- fi-tgl-u2: [DMESG-WARN][27] ([i915#402]) -> [PASS][28] +1 similar issue
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11438/fi-tgl-u2/igt@kms_flip@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6858/fi-tgl-u2/igt@kms_flip@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[i915#1436]: https://gitlab.freedesktop.org/drm/intel/issues/1436
[i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
[i915#1982]: https://gitlab.freedesktop.org/drm/intel/issues/1982
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#3576]: https://gitlab.freedesktop.org/drm/intel/issues/3576
[i915#402]: https://gitlab.freedesktop.org/drm/intel/issues/402
[i915#4086]: https://gitlab.freedesktop.org/drm/intel/issues/4086
[i915#4312]: https://gitlab.freedesktop.org/drm/intel/issues/4312
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#4785]: https://gitlab.freedesktop.org/drm/intel/issues/4785
[i915#4962]: https://gitlab.freedesktop.org/drm/intel/issues/4962
[i915#5193]: https://gitlab.freedesktop.org/drm/intel/issues/5193
[i915#533]: https://gitlab.freedesktop.org/drm/intel/issues/533
[i915#5341]: https://gitlab.freedesktop.org/drm/intel/issues/5341

Build changes
-------------

* CI: CI-20190529 -> None
* IGT: IGT_6405 -> IGTPW_6858

CI-20190529: 20190529
CI_DRM_11438: 1b225b6e486f2cc9c8c76f2f95d28179e79a85af @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_6858: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6858/index.html
IGT_6405: 50f7bc405cc1411f57855ed23322c6c4d2510b58 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6858/index.html