All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] tests/i915/gem_exec_capture : Add support for local memory
@ 2022-04-20  8:45 sai.gowtham.ch
  2022-04-20 10:18 ` [igt-dev] ✗ Fi.CI.BAT: failure for tests/i915/gem_exec_capture : Add support for local memory (rev3) Patchwork
  2022-04-21 11:27 ` [igt-dev] [PATCH i-g-t] tests/i915/gem_exec_capture : Add support for local memory Zbigniew Kempczyński
  0 siblings, 2 replies; 3+ messages in thread
From: sai.gowtham.ch @ 2022-04-20  8:45 UTC (permalink / raw)
  To: igt-dev, sai.gowtham.ch, zbigniew.kempczynski

From: Ch Sai Gowtham <sai.gowtham.ch@intel.com>

Adding local memory support to many-4K-zero subtest and used
new macro for_each_memory_region for memory regioning.

Signed-off-by: Ch Sai Gowtham <sai.gowtham.ch@intel.com>
Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
---
 tests/i915/gem_exec_capture.c | 94 ++++++++++++++++++++---------------
 1 file changed, 55 insertions(+), 39 deletions(-)

diff --git a/tests/i915/gem_exec_capture.c b/tests/i915/gem_exec_capture.c
index 60f8df04..97f024c0 100644
--- a/tests/i915/gem_exec_capture.c
+++ b/tests/i915/gem_exec_capture.c
@@ -250,7 +250,8 @@ static void wait_to_die(int fence_out)
 
 static void __capture1(int fd, int dir, uint64_t ahnd, const intel_ctx_t *ctx,
 		       const struct intel_execution_engine2 *e,
-		       uint32_t target, uint64_t target_size, uint32_t region)
+		       uint32_t target, uint64_t target_size,
+		       struct drm_i915_gem_memory_class_instance *region)
 {
 	const unsigned int gen = intel_gen(intel_get_drm_devid(fd));
 	struct drm_i915_gem_exec_object2 obj[4];
@@ -268,13 +269,13 @@ static void __capture1(int fd, int dir, uint64_t ahnd, const intel_ctx_t *ctx,
 	saved_engine = configure_hangs(fd, e, ctx->id);
 
 	memset(obj, 0, sizeof(obj));
-	obj[SCRATCH].handle = gem_create_in_memory_regions(fd, 4096, region);
+	obj[SCRATCH].handle = gem_create_in_memory_region_list(fd, 4096, region, 1);
 	obj[SCRATCH].flags = EXEC_OBJECT_WRITE;
 	obj[CAPTURE].handle = target;
 	obj[CAPTURE].flags = EXEC_OBJECT_CAPTURE;
 	obj[NOCAPTURE].handle = gem_create(fd, 4096);
 
-	obj[BATCH].handle = gem_create_in_memory_regions(fd, 4096, region);
+	obj[BATCH].handle = gem_create_in_memory_region_list(fd, 4096, region, 1);
 	obj[BATCH].relocs_ptr = (uintptr_t)reloc;
 	obj[BATCH].relocation_count = !ahnd ? ARRAY_SIZE(reloc) : 0;
 
@@ -384,12 +385,13 @@ static void __capture1(int fd, int dir, uint64_t ahnd, const intel_ctx_t *ctx,
 }
 
 static void capture(int fd, int dir, const intel_ctx_t *ctx,
-		    const struct intel_execution_engine2 *e, uint32_t region)
+		const struct intel_execution_engine2 *e,
+		struct drm_i915_gem_memory_class_instance *region)
 {
 	uint32_t handle;
 	uint64_t ahnd, obj_size = 4096;
 
-	igt_assert_eq(__gem_create_in_memory_regions(fd, &handle, &obj_size, region), 0);
+	igt_assert_eq(__gem_create_in_memory_region_list(fd, &handle, &obj_size, region, 1), 0);
 	ahnd = get_reloc_ahnd(fd, ctx->id);
 
 	__capture1(fd, dir, ahnd, ctx, e, handle, obj_size, region);
@@ -415,7 +417,8 @@ static struct offset *
 __captureN(int fd, int dir, uint64_t ahnd, const intel_ctx_t *ctx,
 	   const struct intel_execution_engine2 *e,
 	   unsigned int size, int count,
-	   unsigned int flags, int *_fence_out)
+	   unsigned int flags, int *_fence_out,
+	   struct drm_i915_gem_memory_class_instance *region)
 #define INCREMENTAL 0x1
 #define ASYNC 0x2
 {
@@ -436,9 +439,10 @@ __captureN(int fd, int dir, uint64_t ahnd, const intel_ctx_t *ctx,
 	obj = calloc(count + 2, sizeof(*obj));
 	igt_assert(obj);
 
-	obj[0].handle = gem_create(fd, 4096);
+	obj[0].handle = gem_create_in_memory_region_list(fd, 4096, region, 1);
 	obj[0].offset = get_offset(ahnd, obj[0].handle, 4096, 0);
-	obj[0].flags = EXEC_OBJECT_WRITE | (ahnd ? EXEC_OBJECT_PINNED : 0);
+	obj[0].flags = EXEC_OBJECT_SUPPORTS_48B_ADDRESS | EXEC_OBJECT_WRITE |
+			(ahnd ? EXEC_OBJECT_PINNED : 0);
 
 	for (i = 0; i < count; i++) {
 		obj[i + 1].handle = gem_create(fd, size);
@@ -459,11 +463,11 @@ __captureN(int fd, int dir, uint64_t ahnd, const intel_ctx_t *ctx,
 		}
 	}
 
-	obj[count + 1].handle = gem_create(fd, 4096);
+	obj[count + 1].handle = gem_create_in_memory_region_list(fd, 4096, region, 1);
 	obj[count + 1].relocs_ptr = (uintptr_t)reloc;
 	obj[count + 1].relocation_count = !ahnd ? ARRAY_SIZE(reloc) : 0;
 	obj[count + 1].offset = get_offset(ahnd, obj[count + 1].handle, 4096, 0);
-	obj[count + 1].flags = ahnd ? EXEC_OBJECT_PINNED : 0;
+	obj[count + 1].flags = EXEC_OBJECT_SUPPORTS_48B_ADDRESS | ahnd ? EXEC_OBJECT_PINNED : 0;
 
 	memset(reloc, 0, sizeof(reloc));
 	reloc[0].target_handle = obj[count + 1].handle; /* recurse */
@@ -585,14 +589,16 @@ __captureN(int fd, int dir, uint64_t ahnd, const intel_ctx_t *ctx,
 		saved = configure_hangs(fd, e, ctx->id); \
 	} while(0)
 
-static void many(int fd, int dir, uint64_t size, unsigned int flags)
+static void many(int fd, int dir, uint64_t size, unsigned int flags,
+		struct drm_i915_gem_memory_class_instance *region)
 {
 	const struct intel_execution_engine2 *e;
 	const intel_ctx_t *ctx;
-	uint64_t ram, gtt, ahnd;
+	uint64_t ram, gtt, ahnd, lmem_size;
 	unsigned long count, blobs;
 	struct offset *offsets;
 	struct gem_engine_properties saved_engine;
+	struct drm_i915_query_memory_regions *info;
 
 	find_first_available_engine(fd, ctx, e, saved_engine);
 
@@ -601,13 +607,21 @@ static void many(int fd, int dir, uint64_t size, unsigned int flags)
 	igt_debug("Available objects in GTT:%"PRIu64", RAM:%"PRIu64"\n",
 		  gtt, ram);
 
-	count = min(gtt, ram) / 4;
+	info = gem_get_query_memory_regions(fd);
+	lmem_size = gpu_meminfo_region_total_size(info, I915_MEMORY_CLASS_DEVICE) / size;
+
+	if (region->memory_class == I915_MEMORY_CLASS_SYSTEM)
+		count = min(gtt, ram) / 4;
+	else
+		count = min(gtt, lmem_size) / 4;
+
 	igt_require(count > 1);
 
 	intel_require_memory(count, size, CHECK_RAM);
 	ahnd = get_reloc_ahnd(fd, ctx->id);
 
-	offsets = __captureN(fd, dir, ahnd, ctx, e, size, count, flags, NULL);
+	offsets = __captureN(fd, dir, ahnd, ctx, e, size, count, flags, NULL,
+			region);
 
 	blobs = check_error_state(dir, offsets, count, size, !!(flags & INCREMENTAL));
 	igt_info("Captured %lu %"PRId64"-blobs out of a total of %lu\n",
@@ -620,7 +634,8 @@ static void many(int fd, int dir, uint64_t size, unsigned int flags)
 }
 
 static void prioinv(int fd, int dir, const intel_ctx_t *ctx,
-		    const struct intel_execution_engine2 *e)
+		    const struct intel_execution_engine2 *e,
+		    struct drm_i915_gem_memory_class_instance *region)
 {
 	const uint32_t bbe = MI_BATCH_BUFFER_END;
 	struct drm_i915_gem_exec_object2 obj = {
@@ -677,7 +692,8 @@ static void prioinv(int fd, int dir, const intel_ctx_t *ctx,
 		/* Reopen the allocator in the new process. */
 		ahnd = get_reloc_ahnd(fd, ctx2->id);
 
-		free(__captureN(fd, dir, ahnd, ctx2, e, size, count, ASYNC, &fence_out));
+		free(__captureN(fd, dir, ahnd, ctx2, e, size, count, ASYNC,
+					&fence_out, region));
 		put_ahnd(ahnd);
 
 		write(link[1], &fd, sizeof(fd)); /* wake the parent up */
@@ -708,7 +724,8 @@ static void prioinv(int fd, int dir, const intel_ctx_t *ctx,
 	put_ahnd(ahnd);
 }
 
-static void userptr(int fd, int dir)
+static void userptr(int fd, int dir,
+		struct drm_i915_gem_memory_class_instance *region)
 {
 	const struct intel_execution_engine2 *e;
 	const intel_ctx_t *ctx;
@@ -716,7 +733,7 @@ static void userptr(int fd, int dir)
 	uint64_t ahnd;
 	void *ptr;
 	int obj_size = 4096;
-	uint32_t system_region = INTEL_MEMORY_REGION_ID(I915_SYSTEM_MEMORY, 0);
+
 	struct gem_engine_properties saved_engine;
 
 	find_first_available_engine(fd, ctx, e, saved_engine);
@@ -726,7 +743,8 @@ static void userptr(int fd, int dir)
 	igt_require(__gem_userptr(fd, ptr, obj_size, 0, 0, &handle) == 0);
 	ahnd = get_reloc_ahnd(fd, ctx->id);
 
-	__capture1(fd, dir, ahnd, ctx, e, handle, obj_size, system_region);
+	__capture1(fd, dir, ahnd, ctx, e, handle, obj_size,
+			region);
 
 	gem_close(fd, handle);
 	put_ahnd(ahnd);
@@ -764,9 +782,10 @@ igt_main
 	int fd = -1;
 	int dir = -1;
 	struct drm_i915_query_memory_regions *query_info;
-	struct igt_collection *regions, *set;
-	char *sub_name;
-	uint32_t region;
+	struct drm_i915_gem_memory_class_instance region_smem = {
+		.memory_class = I915_MEMORY_CLASS_SYSTEM,
+		.memory_instance = 0,
+	};
 
 	igt_fixture {
 		int gen;
@@ -788,56 +807,53 @@ igt_main
 		igt_require(safer_strlen(igt_sysfs_get(dir, "error")) > 0);
 		query_info = gem_get_query_memory_regions(fd);
 		igt_assert(query_info);
-		set = get_memory_region_set(query_info,
-				I915_SYSTEM_MEMORY,
-				I915_DEVICE_MEMORY);
 	}
 
 	test_each_engine("capture", fd, ctx, e) {
-		for_each_combination(regions, 1, set) {
-			sub_name = memregion_dynamic_subtest_name(regions);
-			region = igt_collection_get_value(regions, 0);
-			igt_dynamic_f("%s-%s", e->name, sub_name)
-				capture(fd, dir, ctx, e, region);
-			free(sub_name);
+		for_each_memory_region(r, fd) {
+			igt_dynamic_f("%s-%s", e->name, r->name)
+				capture(fd, dir, ctx, e, &r->ci);
 		}
 	}
 
-	igt_subtest_f("many-4K-zero") {
+	igt_subtest_with_dynamic("many-4K-zero") {
 		igt_require(gem_can_store_dword(fd, 0));
-		many(fd, dir, 1<<12, 0);
+		for_each_memory_region(r, fd) {
+			igt_dynamic_f("%s", r->name)
+				many(fd, dir, 1<<12, 0, &r->ci);
+		}
 	}
 
 	igt_subtest_f("many-4K-incremental") {
 		igt_require(gem_can_store_dword(fd, 0));
-		many(fd, dir, 1<<12, INCREMENTAL);
+		many(fd, dir, 1<<12, INCREMENTAL, &region_smem);
 	}
 
 	igt_subtest_f("many-2M-zero") {
 		igt_require(gem_can_store_dword(fd, 0));
-		many(fd, dir, 2<<20, 0);
+		many(fd, dir, 2<<20, 0, &region_smem);
 	}
 
 	igt_subtest_f("many-2M-incremental") {
 		igt_require(gem_can_store_dword(fd, 0));
-		many(fd, dir, 2<<20, INCREMENTAL);
+		many(fd, dir, 2<<20, INCREMENTAL, &region_smem);
 	}
 
 	igt_subtest_f("many-256M-incremental") {
 		igt_require(gem_can_store_dword(fd, 0));
-		many(fd, dir, 256<<20, INCREMENTAL);
+		many(fd, dir, 256<<20, INCREMENTAL, &region_smem);
 	}
 
 	/* And check we can read from different types of objects */
 
 	igt_subtest_f("userptr") {
 		igt_require(gem_can_store_dword(fd, 0));
-		userptr(fd, dir);
+		userptr(fd, dir, &region_smem);
 	}
 
 	test_each_engine("pi", fd, ctx, e)
 		igt_dynamic_f("%s", (e)->name)
-			prioinv(fd, dir, ctx, e);
+			prioinv(fd, dir, ctx, e, &region_smem);
 
 	igt_fixture {
 		close(dir);
-- 
2.35.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [igt-dev] ✗ Fi.CI.BAT: failure for tests/i915/gem_exec_capture : Add support for local memory (rev3)
  2022-04-20  8:45 [igt-dev] [PATCH i-g-t] tests/i915/gem_exec_capture : Add support for local memory sai.gowtham.ch
@ 2022-04-20 10:18 ` Patchwork
  2022-04-21 11:27 ` [igt-dev] [PATCH i-g-t] tests/i915/gem_exec_capture : Add support for local memory Zbigniew Kempczyński
  1 sibling, 0 replies; 3+ messages in thread
From: Patchwork @ 2022-04-20 10:18 UTC (permalink / raw)
  To: sai.gowtham.ch; +Cc: igt-dev

[-- Attachment #1: Type: text/plain, Size: 4523 bytes --]

== Series Details ==

Series: tests/i915/gem_exec_capture : Add support for local memory (rev3)
URL   : https://patchwork.freedesktop.org/series/95707/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_11526 -> IGTPW_6953
====================================================

Summary
-------

  **FAILURE**

  Serious unknown changes coming with IGTPW_6953 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_6953, 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_6953/index.html

Participating hosts (51 -> 46)
------------------------------

  Missing    (5): fi-hsw-4200u bat-adlm-1 fi-bsw-cyan fi-icl-u2 fi-ctg-p8600 

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

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

### IGT changes ###

#### Possible regressions ####

  * igt@i915_selftest@live@hangcheck:
    - bat-dg1-5:          NOTRUN -> [INCOMPLETE][1]
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6953/bat-dg1-5/igt@i915_selftest@live@hangcheck.html

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

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

### IGT changes ###

#### Issues hit ####

  * igt@i915_selftest@live@gt_engines:
    - bat-dg1-6:          [PASS][2] -> [INCOMPLETE][3] ([i915#4418])
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11526/bat-dg1-6/igt@i915_selftest@live@gt_engines.html
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6953/bat-dg1-6/igt@i915_selftest@live@gt_engines.html

  * igt@kms_busy@basic@modeset:
    - fi-tgl-u2:          [PASS][4] -> [DMESG-WARN][5] ([i915#402]) +2 similar issues
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11526/fi-tgl-u2/igt@kms_busy@basic@modeset.html
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6953/fi-tgl-u2/igt@kms_busy@basic@modeset.html

  * igt@runner@aborted:
    - bat-dg1-6:          NOTRUN -> [FAIL][6] ([i915#4312] / [i915#5257])
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6953/bat-dg1-6/igt@runner@aborted.html
    - fi-bdw-5557u:       NOTRUN -> [FAIL][7] ([i915#4312])
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6953/fi-bdw-5557u/igt@runner@aborted.html

  
#### Possible fixes ####

  * igt@i915_selftest@live@gt_engines:
    - bat-dg1-5:          [INCOMPLETE][8] ([i915#4418]) -> [PASS][9]
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11526/bat-dg1-5/igt@i915_selftest@live@gt_engines.html
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6953/bat-dg1-5/igt@i915_selftest@live@gt_engines.html

  * igt@i915_selftest@live@hangcheck:
    - fi-hsw-g3258:       [INCOMPLETE][10] ([i915#4785]) -> [PASS][11]
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11526/fi-hsw-g3258/igt@i915_selftest@live@hangcheck.html
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6953/fi-hsw-g3258/igt@i915_selftest@live@hangcheck.html

  * igt@i915_selftest@live@reset:
    - {bat-adlp-6}:       [DMESG-FAIL][12] ([i915#4983]) -> [PASS][13]
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11526/bat-adlp-6/igt@i915_selftest@live@reset.html
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6953/bat-adlp-6/igt@i915_selftest@live@reset.html

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

  [i915#402]: https://gitlab.freedesktop.org/drm/intel/issues/402
  [i915#4312]: https://gitlab.freedesktop.org/drm/intel/issues/4312
  [i915#4418]: https://gitlab.freedesktop.org/drm/intel/issues/4418
  [i915#4785]: https://gitlab.freedesktop.org/drm/intel/issues/4785
  [i915#4897]: https://gitlab.freedesktop.org/drm/intel/issues/4897
  [i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
  [i915#5257]: https://gitlab.freedesktop.org/drm/intel/issues/5257


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

  * CI: CI-20190529 -> None
  * IGT: IGT_6440 -> IGTPW_6953

  CI-20190529: 20190529
  CI_DRM_11526: 6094ebd5db15c51e89ce9960d782613f8df57c63 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_6953: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6953/index.html
  IGT_6440: 04262fc75ff3ec42f4db0c929d46b7cd5083911f @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git

== Logs ==

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

[-- Attachment #2: Type: text/html, Size: 5397 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [igt-dev] [PATCH i-g-t] tests/i915/gem_exec_capture : Add support for local memory
  2022-04-20  8:45 [igt-dev] [PATCH i-g-t] tests/i915/gem_exec_capture : Add support for local memory sai.gowtham.ch
  2022-04-20 10:18 ` [igt-dev] ✗ Fi.CI.BAT: failure for tests/i915/gem_exec_capture : Add support for local memory (rev3) Patchwork
@ 2022-04-21 11:27 ` Zbigniew Kempczyński
  1 sibling, 0 replies; 3+ messages in thread
From: Zbigniew Kempczyński @ 2022-04-21 11:27 UTC (permalink / raw)
  To: sai.gowtham.ch; +Cc: igt-dev

On Wed, Apr 20, 2022 at 02:15:37PM +0530, sai.gowtham.ch@intel.com wrote:
> From: Ch Sai Gowtham <sai.gowtham.ch@intel.com>
> 
> Adding local memory support to many-4K-zero subtest and used
> new macro for_each_memory_region for memory regioning.
> 
> Signed-off-by: Ch Sai Gowtham <sai.gowtham.ch@intel.com>
> Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
> ---
>  tests/i915/gem_exec_capture.c | 94 ++++++++++++++++++++---------------
>  1 file changed, 55 insertions(+), 39 deletions(-)
> 
> diff --git a/tests/i915/gem_exec_capture.c b/tests/i915/gem_exec_capture.c
> index 60f8df04..97f024c0 100644
> --- a/tests/i915/gem_exec_capture.c
> +++ b/tests/i915/gem_exec_capture.c
> @@ -250,7 +250,8 @@ static void wait_to_die(int fence_out)
>  
>  static void __capture1(int fd, int dir, uint64_t ahnd, const intel_ctx_t *ctx,
>  		       const struct intel_execution_engine2 *e,
> -		       uint32_t target, uint64_t target_size, uint32_t region)
> +		       uint32_t target, uint64_t target_size,
> +		       struct drm_i915_gem_memory_class_instance *region)
>  {
>  	const unsigned int gen = intel_gen(intel_get_drm_devid(fd));
>  	struct drm_i915_gem_exec_object2 obj[4];
> @@ -268,13 +269,13 @@ static void __capture1(int fd, int dir, uint64_t ahnd, const intel_ctx_t *ctx,
>  	saved_engine = configure_hangs(fd, e, ctx->id);
>  
>  	memset(obj, 0, sizeof(obj));
> -	obj[SCRATCH].handle = gem_create_in_memory_regions(fd, 4096, region);
> +	obj[SCRATCH].handle = gem_create_in_memory_region_list(fd, 4096, region, 1);
>  	obj[SCRATCH].flags = EXEC_OBJECT_WRITE;
>  	obj[CAPTURE].handle = target;
>  	obj[CAPTURE].flags = EXEC_OBJECT_CAPTURE;
>  	obj[NOCAPTURE].handle = gem_create(fd, 4096);
>  
> -	obj[BATCH].handle = gem_create_in_memory_regions(fd, 4096, region);
> +	obj[BATCH].handle = gem_create_in_memory_region_list(fd, 4096, region, 1);
>  	obj[BATCH].relocs_ptr = (uintptr_t)reloc;
>  	obj[BATCH].relocation_count = !ahnd ? ARRAY_SIZE(reloc) : 0;
>  
> @@ -384,12 +385,13 @@ static void __capture1(int fd, int dir, uint64_t ahnd, const intel_ctx_t *ctx,
>  }
>  
>  static void capture(int fd, int dir, const intel_ctx_t *ctx,
> -		    const struct intel_execution_engine2 *e, uint32_t region)
> +		const struct intel_execution_engine2 *e,
> +		struct drm_i915_gem_memory_class_instance *region)
>  {
>  	uint32_t handle;
>  	uint64_t ahnd, obj_size = 4096;
>  
> -	igt_assert_eq(__gem_create_in_memory_regions(fd, &handle, &obj_size, region), 0);
> +	igt_assert_eq(__gem_create_in_memory_region_list(fd, &handle, &obj_size, region, 1), 0);
>  	ahnd = get_reloc_ahnd(fd, ctx->id);
>  
>  	__capture1(fd, dir, ahnd, ctx, e, handle, obj_size, region);
> @@ -415,7 +417,8 @@ static struct offset *
>  __captureN(int fd, int dir, uint64_t ahnd, const intel_ctx_t *ctx,
>  	   const struct intel_execution_engine2 *e,
>  	   unsigned int size, int count,
> -	   unsigned int flags, int *_fence_out)
> +	   unsigned int flags, int *_fence_out,
> +	   struct drm_i915_gem_memory_class_instance *region)
>  #define INCREMENTAL 0x1
>  #define ASYNC 0x2
>  {
> @@ -436,9 +439,10 @@ __captureN(int fd, int dir, uint64_t ahnd, const intel_ctx_t *ctx,
>  	obj = calloc(count + 2, sizeof(*obj));
>  	igt_assert(obj);
>  
> -	obj[0].handle = gem_create(fd, 4096);
> +	obj[0].handle = gem_create_in_memory_region_list(fd, 4096, region, 1);
>  	obj[0].offset = get_offset(ahnd, obj[0].handle, 4096, 0);
> -	obj[0].flags = EXEC_OBJECT_WRITE | (ahnd ? EXEC_OBJECT_PINNED : 0);
> +	obj[0].flags = EXEC_OBJECT_SUPPORTS_48B_ADDRESS | EXEC_OBJECT_WRITE |
> +			(ahnd ? EXEC_OBJECT_PINNED : 0);
>  
>  	for (i = 0; i < count; i++) {
>  		obj[i + 1].handle = gem_create(fd, size);
> @@ -459,11 +463,11 @@ __captureN(int fd, int dir, uint64_t ahnd, const intel_ctx_t *ctx,
>  		}
>  	}
>  
> -	obj[count + 1].handle = gem_create(fd, 4096);
> +	obj[count + 1].handle = gem_create_in_memory_region_list(fd, 4096, region, 1);
>  	obj[count + 1].relocs_ptr = (uintptr_t)reloc;
>  	obj[count + 1].relocation_count = !ahnd ? ARRAY_SIZE(reloc) : 0;
>  	obj[count + 1].offset = get_offset(ahnd, obj[count + 1].handle, 4096, 0);
> -	obj[count + 1].flags = ahnd ? EXEC_OBJECT_PINNED : 0;
> +	obj[count + 1].flags = EXEC_OBJECT_SUPPORTS_48B_ADDRESS | ahnd ? EXEC_OBJECT_PINNED : 0;

	obj[count + 1].flags = EXEC_OBJECT_SUPPORTS_48B_ADDRESS | (ahnd ? EXEC_OBJECT_PINNED : 0);

>  
>  	memset(reloc, 0, sizeof(reloc));
>  	reloc[0].target_handle = obj[count + 1].handle; /* recurse */
> @@ -585,14 +589,16 @@ __captureN(int fd, int dir, uint64_t ahnd, const intel_ctx_t *ctx,
>  		saved = configure_hangs(fd, e, ctx->id); \
>  	} while(0)
>  
> -static void many(int fd, int dir, uint64_t size, unsigned int flags)
> +static void many(int fd, int dir, uint64_t size, unsigned int flags,
> +		struct drm_i915_gem_memory_class_instance *region)
>  {
>  	const struct intel_execution_engine2 *e;
>  	const intel_ctx_t *ctx;
> -	uint64_t ram, gtt, ahnd;
> +	uint64_t ram, gtt, ahnd, lmem_size;
>  	unsigned long count, blobs;
>  	struct offset *offsets;
>  	struct gem_engine_properties saved_engine;
> +	struct drm_i915_query_memory_regions *info;
>  
>  	find_first_available_engine(fd, ctx, e, saved_engine);
>  
> @@ -601,13 +607,21 @@ static void many(int fd, int dir, uint64_t size, unsigned int flags)
>  	igt_debug("Available objects in GTT:%"PRIu64", RAM:%"PRIu64"\n",
>  		  gtt, ram);
>  
> -	count = min(gtt, ram) / 4;
> +	info = gem_get_query_memory_regions(fd);
> +	lmem_size = gpu_meminfo_region_total_size(info, I915_MEMORY_CLASS_DEVICE) / size;
> +
> +	if (region->memory_class == I915_MEMORY_CLASS_SYSTEM)
> +		count = min(gtt, ram) / 4;
> +	else
> +		count = min(gtt, lmem_size) / 4;
> +
>  	igt_require(count > 1);
>  
>  	intel_require_memory(count, size, CHECK_RAM);

This check is not necessary for lmem.

Fix above and resubmit.

--
Zbigniew

>  	ahnd = get_reloc_ahnd(fd, ctx->id);
>  
> -	offsets = __captureN(fd, dir, ahnd, ctx, e, size, count, flags, NULL);
> +	offsets = __captureN(fd, dir, ahnd, ctx, e, size, count, flags, NULL,
> +			region);
>  
>  	blobs = check_error_state(dir, offsets, count, size, !!(flags & INCREMENTAL));
>  	igt_info("Captured %lu %"PRId64"-blobs out of a total of %lu\n",
> @@ -620,7 +634,8 @@ static void many(int fd, int dir, uint64_t size, unsigned int flags)
>  }
>  
>  static void prioinv(int fd, int dir, const intel_ctx_t *ctx,
> -		    const struct intel_execution_engine2 *e)
> +		    const struct intel_execution_engine2 *e,
> +		    struct drm_i915_gem_memory_class_instance *region)
>  {
>  	const uint32_t bbe = MI_BATCH_BUFFER_END;
>  	struct drm_i915_gem_exec_object2 obj = {
> @@ -677,7 +692,8 @@ static void prioinv(int fd, int dir, const intel_ctx_t *ctx,
>  		/* Reopen the allocator in the new process. */
>  		ahnd = get_reloc_ahnd(fd, ctx2->id);
>  
> -		free(__captureN(fd, dir, ahnd, ctx2, e, size, count, ASYNC, &fence_out));
> +		free(__captureN(fd, dir, ahnd, ctx2, e, size, count, ASYNC,
> +					&fence_out, region));
>  		put_ahnd(ahnd);
>  
>  		write(link[1], &fd, sizeof(fd)); /* wake the parent up */
> @@ -708,7 +724,8 @@ static void prioinv(int fd, int dir, const intel_ctx_t *ctx,
>  	put_ahnd(ahnd);
>  }
>  
> -static void userptr(int fd, int dir)
> +static void userptr(int fd, int dir,
> +		struct drm_i915_gem_memory_class_instance *region)
>  {
>  	const struct intel_execution_engine2 *e;
>  	const intel_ctx_t *ctx;
> @@ -716,7 +733,7 @@ static void userptr(int fd, int dir)
>  	uint64_t ahnd;
>  	void *ptr;
>  	int obj_size = 4096;
> -	uint32_t system_region = INTEL_MEMORY_REGION_ID(I915_SYSTEM_MEMORY, 0);
> +
>  	struct gem_engine_properties saved_engine;
>  
>  	find_first_available_engine(fd, ctx, e, saved_engine);
> @@ -726,7 +743,8 @@ static void userptr(int fd, int dir)
>  	igt_require(__gem_userptr(fd, ptr, obj_size, 0, 0, &handle) == 0);
>  	ahnd = get_reloc_ahnd(fd, ctx->id);
>  
> -	__capture1(fd, dir, ahnd, ctx, e, handle, obj_size, system_region);
> +	__capture1(fd, dir, ahnd, ctx, e, handle, obj_size,
> +			region);
>  
>  	gem_close(fd, handle);
>  	put_ahnd(ahnd);
> @@ -764,9 +782,10 @@ igt_main
>  	int fd = -1;
>  	int dir = -1;
>  	struct drm_i915_query_memory_regions *query_info;
> -	struct igt_collection *regions, *set;
> -	char *sub_name;
> -	uint32_t region;
> +	struct drm_i915_gem_memory_class_instance region_smem = {
> +		.memory_class = I915_MEMORY_CLASS_SYSTEM,
> +		.memory_instance = 0,
> +	};
>  
>  	igt_fixture {
>  		int gen;
> @@ -788,56 +807,53 @@ igt_main
>  		igt_require(safer_strlen(igt_sysfs_get(dir, "error")) > 0);
>  		query_info = gem_get_query_memory_regions(fd);
>  		igt_assert(query_info);
> -		set = get_memory_region_set(query_info,
> -				I915_SYSTEM_MEMORY,
> -				I915_DEVICE_MEMORY);
>  	}
>  
>  	test_each_engine("capture", fd, ctx, e) {
> -		for_each_combination(regions, 1, set) {
> -			sub_name = memregion_dynamic_subtest_name(regions);
> -			region = igt_collection_get_value(regions, 0);
> -			igt_dynamic_f("%s-%s", e->name, sub_name)
> -				capture(fd, dir, ctx, e, region);
> -			free(sub_name);
> +		for_each_memory_region(r, fd) {
> +			igt_dynamic_f("%s-%s", e->name, r->name)
> +				capture(fd, dir, ctx, e, &r->ci);
>  		}
>  	}
>  
> -	igt_subtest_f("many-4K-zero") {
> +	igt_subtest_with_dynamic("many-4K-zero") {
>  		igt_require(gem_can_store_dword(fd, 0));
> -		many(fd, dir, 1<<12, 0);
> +		for_each_memory_region(r, fd) {
> +			igt_dynamic_f("%s", r->name)
> +				many(fd, dir, 1<<12, 0, &r->ci);
> +		}
>  	}
>  
>  	igt_subtest_f("many-4K-incremental") {
>  		igt_require(gem_can_store_dword(fd, 0));
> -		many(fd, dir, 1<<12, INCREMENTAL);
> +		many(fd, dir, 1<<12, INCREMENTAL, &region_smem);
>  	}
>  
>  	igt_subtest_f("many-2M-zero") {
>  		igt_require(gem_can_store_dword(fd, 0));
> -		many(fd, dir, 2<<20, 0);
> +		many(fd, dir, 2<<20, 0, &region_smem);
>  	}
>  
>  	igt_subtest_f("many-2M-incremental") {
>  		igt_require(gem_can_store_dword(fd, 0));
> -		many(fd, dir, 2<<20, INCREMENTAL);
> +		many(fd, dir, 2<<20, INCREMENTAL, &region_smem);
>  	}
>  
>  	igt_subtest_f("many-256M-incremental") {
>  		igt_require(gem_can_store_dword(fd, 0));
> -		many(fd, dir, 256<<20, INCREMENTAL);
> +		many(fd, dir, 256<<20, INCREMENTAL, &region_smem);
>  	}
>  
>  	/* And check we can read from different types of objects */
>  
>  	igt_subtest_f("userptr") {
>  		igt_require(gem_can_store_dword(fd, 0));
> -		userptr(fd, dir);
> +		userptr(fd, dir, &region_smem);
>  	}
>  
>  	test_each_engine("pi", fd, ctx, e)
>  		igt_dynamic_f("%s", (e)->name)
> -			prioinv(fd, dir, ctx, e);
> +			prioinv(fd, dir, ctx, e, &region_smem);
>  
>  	igt_fixture {
>  		close(dir);
> -- 
> 2.35.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-21 11:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-20  8:45 [igt-dev] [PATCH i-g-t] tests/i915/gem_exec_capture : Add support for local memory sai.gowtham.ch
2022-04-20 10:18 ` [igt-dev] ✗ Fi.CI.BAT: failure for tests/i915/gem_exec_capture : Add support for local memory (rev3) Patchwork
2022-04-21 11:27 ` [igt-dev] [PATCH i-g-t] tests/i915/gem_exec_capture : Add support for local memory Zbigniew Kempczyński

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.