All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] tests/i915/gem_exec_suspend: Add support for local memory
@ 2021-10-12  5:01 sai.gowtham.ch
  2021-10-12  5:47 ` [igt-dev] ✗ Fi.CI.BAT: failure for " Patchwork
  2021-10-13 15:10 ` [igt-dev] [PATCH i-g-t] " Zbigniew Kempczyński
  0 siblings, 2 replies; 3+ messages in thread
From: sai.gowtham.ch @ 2021-10-12  5:01 UTC (permalink / raw)
  To: igt-dev, sai.gowtham.ch, zbigniew.kempczynski

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

Add support for local memory region (Device memory)

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

diff --git a/tests/i915/gem_exec_suspend.c b/tests/i915/gem_exec_suspend.c
index 887bb735..ac7e1b7c 100644
--- a/tests/i915/gem_exec_suspend.c
+++ b/tests/i915/gem_exec_suspend.c
@@ -51,8 +51,19 @@
 #define CACHED (1<<8)
 #define HANG (2<<8)
 
+static uint32_t batch_create(int fd, uint32_t batch_size, uint32_t region)
+{
+	const uint32_t bbe = MI_BATCH_BUFFER_END;
+	uint32_t handle;
+
+	handle = gem_create_in_memory_regions(fd, batch_size, region);
+	gem_write(fd, handle, 0, &bbe, sizeof(bbe));
+
+	return handle;
+}
+
 static void run_test(int fd, const intel_ctx_t *ctx,
-		     unsigned engine, unsigned flags);
+		     unsigned engine, unsigned flags, uint32_t region);
 
 static void check_bo(int fd, uint32_t handle)
 {
@@ -67,16 +78,15 @@ static void check_bo(int fd, uint32_t handle)
 	munmap(map, 4096);
 }
 
-static void test_all(int fd, const intel_ctx_t *ctx, unsigned flags)
+static void test_all(int fd, const intel_ctx_t *ctx, unsigned flags, uint32_t region)
 {
-	run_test(fd, ctx, ALL_ENGINES, flags & ~0xff);
+	run_test(fd, ctx, ALL_ENGINES, flags & ~0xff, region);
 }
 
 static void run_test(int fd, const intel_ctx_t *ctx,
-		     unsigned engine, unsigned flags)
+		     unsigned engine, unsigned flags, uint32_t region)
 {
 	const unsigned int gen = intel_gen(intel_get_drm_devid(fd));
-	const uint32_t bbe = MI_BATCH_BUFFER_END;
 	struct drm_i915_gem_exec_object2 obj[2];
 	struct drm_i915_gem_relocation_entry reloc;
 	struct drm_i915_gem_execbuffer2 execbuf;
@@ -100,7 +110,7 @@ static void run_test(int fd, const intel_ctx_t *ctx,
 
 	/* Before suspending, check normal operation */
 	if (mode(flags) != NOSLEEP)
-		test_all(fd, ctx, flags);
+		test_all(fd, ctx, flags, region);
 
 	gem_quiescent_gpu(fd);
 
@@ -117,8 +127,7 @@ static void run_test(int fd, const intel_ctx_t *ctx,
 	if (!gem_has_lmem(fd))
 		gem_set_caching(fd, obj[0].handle, !!(flags & CACHED));
 	obj[0].flags |= EXEC_OBJECT_WRITE;
-	obj[1].handle = gem_create(fd, 4096);
-	gem_write(fd, obj[1].handle, 0, &bbe, sizeof(bbe));
+	obj[1].handle = batch_create(fd, 4096, region);
 	igt_require(__gem_execbuf(fd, &execbuf) == 0);
 	gem_close(fd, obj[1].handle);
 
@@ -222,7 +231,7 @@ static void run_test(int fd, const intel_ctx_t *ctx,
 
 	/* After resume, make sure it still works */
 	if (mode(flags) != NOSLEEP)
-		test_all(fd, ctx, flags);
+		test_all(fd, ctx, flags, region);
 }
 
 struct battery_sample {
@@ -250,7 +259,7 @@ static double d_time(const struct battery_sample *after,
 }
 
 static void power_test(int i915, const intel_ctx_t *ctx,
-		       unsigned engine, unsigned flags)
+		       unsigned engine, unsigned flags, uint32_t region)
 {
 	struct battery_sample before, after;
 	char *status;
@@ -270,7 +279,7 @@ static void power_test(int i915, const intel_ctx_t *ctx,
 	igt_set_autoresume_delay(5 * 60); /* 5 minutes; longer == more stable */
 
 	igt_assert(get_power(dir, &before));
-	run_test(i915, ctx, engine, flags);
+	run_test(i915, ctx, engine, flags, region);
 	igt_assert(get_power(dir, &after));
 
 	igt_set_autoresume_delay(0);
@@ -296,6 +305,10 @@ igt_main
 	igt_hang_t hang;
 	const intel_ctx_t *ctx;
 	int fd;
+	char *sub_name;
+	uint32_t region;
+	struct drm_i915_query_memory_regions *query_info;
+	struct igt_collection *set, *regions;
 
 	igt_fixture {
 		fd = drm_open_driver_master(DRIVER_INTEL);
@@ -304,49 +317,111 @@ igt_main
 		ctx = intel_ctx_create_all_physical(fd);
 
 		igt_fork_hang_detector(fd);
+		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);
+	}
+
+	igt_subtest_with_dynamic("basic") {
+		for_each_combination(regions, 1, set) {
+			sub_name = memregion_dynamic_subtest_name(regions);
+			region = igt_collection_get_value(regions, 0);
+			igt_dynamic_f("%s", sub_name)
+				run_test(fd, ctx, ALL_ENGINES, NOSLEEP, region);
+			free(sub_name);
+		}
 	}
 
-	igt_subtest("basic")
-		run_test(fd, ctx, ALL_ENGINES, NOSLEEP);
-	igt_subtest("basic-S0")
-		run_test(fd, ctx, ALL_ENGINES, IDLE);
-	igt_subtest("basic-S3-devices")
-		run_test(fd, ctx, ALL_ENGINES, SUSPEND_DEVICES);
-	igt_subtest("basic-S3")
-		run_test(fd, ctx, ALL_ENGINES, SUSPEND);
-	igt_subtest("basic-S4-devices")
-		run_test(fd, ctx, ALL_ENGINES, HIBERNATE_DEVICES);
-	igt_subtest("basic-S4")
-		run_test(fd, ctx, ALL_ENGINES, HIBERNATE);
+	igt_subtest_with_dynamic("basic-S0") {
+		for_each_combination(regions, 1, set) {
+			sub_name = memregion_dynamic_subtest_name(regions);
+			region = igt_collection_get_value(regions, 0);
+			igt_dynamic_f("%s", sub_name)
+				run_test(fd, ctx, ALL_ENGINES, IDLE, region);
+			free(sub_name);
+		}
+	}
+
+	igt_subtest_with_dynamic("basic-S3-devices") {
+		for_each_combination(regions, 1, set) {
+			sub_name = memregion_dynamic_subtest_name(regions);
+			region = igt_collection_get_value(regions, 0);
+			igt_dynamic_f("%s", sub_name)
+				run_test(fd, ctx, ALL_ENGINES, SUSPEND_DEVICES, region);
+			free(sub_name);
+		}
+	}
+
+	igt_subtest_with_dynamic("basic-S3") {
+		for_each_combination(regions, 1, set) {
+			sub_name = memregion_dynamic_subtest_name(regions);
+			region = igt_collection_get_value(regions, 0);
+			igt_dynamic_f("%s", sub_name)
+				run_test(fd, ctx, ALL_ENGINES, SUSPEND, region);
+			free(sub_name);
+		}
+	}
+
+	igt_subtest_with_dynamic("basic-S4-devices") {
+		for_each_combination(regions, 1, set) {
+			sub_name = memregion_dynamic_subtest_name(regions);
+			region = igt_collection_get_value(regions, 0);
+			igt_dynamic_f("%s", sub_name)
+				run_test(fd, ctx, ALL_ENGINES, HIBERNATE_DEVICES, region);
+			free(sub_name);
+		}
+	}
+
+	igt_subtest_with_dynamic("basic-S4") {
+		for_each_combination(regions, 1, set) {
+			sub_name = memregion_dynamic_subtest_name(regions);
+			region = igt_collection_get_value(regions, 0);
+			igt_dynamic_f("%s", sub_name)
+				run_test(fd, ctx, ALL_ENGINES, HIBERNATE, region);
+			free(sub_name);
+		}
+	}
 
 	for (m = modes; m->suffix; m++) {
 		igt_subtest_with_dynamic_f("fixed%s", m->suffix) {
-			igt_require(gem_has_lmem(fd));
 			for_each_ctx_engine(fd, ctx, e) {
 				if (!gem_class_can_store_dword(fd, e->class))
 					continue;
-				igt_dynamic_f("%s", e->name)
-					run_test(fd, ctx, e->flags, m->mode);
+				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)
+						run_test(fd, ctx, e->flags, m->mode, region);
+				}
 			}
 		}
 
 		igt_subtest_with_dynamic_f("uncached%s", m->suffix) {
-			igt_require(!gem_has_lmem(fd));
 			for_each_ctx_engine(fd, ctx, e) {
 				if (!gem_class_can_store_dword(fd, e->class))
 					continue;
-				igt_dynamic_f("%s", e->name)
-					run_test(fd, ctx, e->flags, m->mode | UNCACHED);
+				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)
+						run_test(fd, ctx, e->flags, m->mode | UNCACHED, region);
+				}
 			}
 		}
 
 		igt_subtest_with_dynamic_f("cached%s", m->suffix) {
-			igt_require(!gem_has_lmem(fd));
 			for_each_ctx_engine(fd, ctx, e) {
 				if (!gem_class_can_store_dword(fd, e->class))
 					continue;
-				igt_dynamic_f("%s", e->name)
-					run_test(fd, ctx, e->flags, m->mode | CACHED);
+				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)
+						run_test(fd, ctx, e->flags, m->mode | CACHED, region);
+				}
 			}
 		}
 	}
@@ -356,17 +431,49 @@ igt_main
 		hang = igt_allow_hang(fd, 0, 0);
 	}
 
-	igt_subtest("hang-S3")
-		run_test(fd, intel_ctx_0(fd), 0, SUSPEND | HANG);
-	igt_subtest("hang-S4")
-		run_test(fd, intel_ctx_0(fd), 0, HIBERNATE | HANG);
+	igt_subtest_with_dynamic("hang-S3") {
+		for_each_combination(regions, 1, set) {
+			sub_name = memregion_dynamic_subtest_name(regions);
+			region = igt_collection_get_value(regions, 0);
+			igt_dynamic_f("%s", sub_name)
+				run_test(fd, intel_ctx_0(fd), 0, SUSPEND | HANG, region);
+			free(sub_name);
+		}
+	}
 
-	igt_subtest("power-S0")
-		power_test(fd, intel_ctx_0(fd), 0, IDLE);
-	igt_subtest("power-S3")
-		power_test(fd, intel_ctx_0(fd), 0, SUSPEND);
+	igt_subtest_with_dynamic("hang-S4") {
+		for_each_combination(regions, 1, set) {
+			sub_name = memregion_dynamic_subtest_name(regions);
+			region = igt_collection_get_value(regions, 0);
+			igt_dynamic_f("%s", sub_name)
+				run_test(fd, intel_ctx_0(fd), 0, HIBERNATE | HANG, region);
+			free(sub_name);
+		}
+	}
+
+	igt_subtest_with_dynamic("power-S0") {
+		for_each_combination(regions, 1, set) {
+			sub_name = memregion_dynamic_subtest_name(regions);
+			region = igt_collection_get_value(regions, 0);
+			igt_dynamic_f("%s", sub_name)
+				power_test(fd, intel_ctx_0(fd), 0, IDLE, region);
+			free(sub_name);
+		}
+	}
+
+	igt_subtest_with_dynamic("power-S3") {
+		for_each_combination(regions, 1, set) {
+			sub_name = memregion_dynamic_subtest_name(regions);
+			region = igt_collection_get_value(regions, 0);
+			igt_dynamic_f("%s", sub_name)
+				power_test(fd, intel_ctx_0(fd), 0, SUSPEND, region);
+			free(sub_name);
+		}
+	}
 
 	igt_fixture {
+		free(query_info);
+		igt_collection_destroy(set);
 		igt_disallow_hang(fd, hang);
 		intel_ctx_destroy(fd, ctx);
 		close(fd);
-- 
2.32.0

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

* [igt-dev] ✗ Fi.CI.BAT: failure for tests/i915/gem_exec_suspend: Add support for local memory
  2021-10-12  5:01 [igt-dev] [PATCH i-g-t] tests/i915/gem_exec_suspend: Add support for local memory sai.gowtham.ch
@ 2021-10-12  5:47 ` Patchwork
  2021-10-13 15:10 ` [igt-dev] [PATCH i-g-t] " Zbigniew Kempczyński
  1 sibling, 0 replies; 3+ messages in thread
From: Patchwork @ 2021-10-12  5:47 UTC (permalink / raw)
  To: sai.gowtham.ch; +Cc: igt-dev

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

== Series Details ==

Series: tests/i915/gem_exec_suspend: Add support for local memory
URL   : https://patchwork.freedesktop.org/series/95706/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_10720 -> IGTPW_6309
====================================================

Summary
-------

  **FAILURE**

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

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

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

### IGT changes ###

#### Possible regressions ####

  * {igt@gem_exec_suspend@basic-s0@smem} (NEW):
    - fi-bdw-gvtdvm:      NOTRUN -> [INCOMPLETE][1]
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6309/fi-bdw-gvtdvm/igt@gem_exec_suspend@basic-s0@smem.html

  * igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
    - fi-icl-y:           [PASS][2] -> [INCOMPLETE][3]
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10720/fi-icl-y/igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a.html
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6309/fi-icl-y/igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a.html

  
New tests
---------

  New tests have been introduced between CI_DRM_10720 and IGTPW_6309:

### New IGT tests (2) ###

  * igt@gem_exec_suspend@basic-s0@smem:
    - Statuses : 1 incomplete(s) 31 pass(s)
    - Exec time: [0.0, 20.39] s

  * igt@gem_exec_suspend@basic-s3@smem:
    - Statuses : 31 pass(s)
    - Exec time: [1.24, 13.60] s

  

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

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

### IGT changes ###

#### Issues hit ####

  * igt@amdgpu/amd_basic@cs-compute:
    - fi-elk-e7500:       NOTRUN -> [SKIP][4] ([fdo#109271]) +49 similar issues
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6309/fi-elk-e7500/igt@amdgpu/amd_basic@cs-compute.html

  * igt@amdgpu/amd_basic@semaphore:
    - fi-bdw-5557u:       NOTRUN -> [SKIP][5] ([fdo#109271]) +23 similar issues
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6309/fi-bdw-5557u/igt@amdgpu/amd_basic@semaphore.html

  * igt@kms_flip@basic-flip-vs-modeset@c-dp1:
    - fi-cfl-8109u:       [PASS][6] -> [FAIL][7] ([i915#4165]) +1 similar issue
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10720/fi-cfl-8109u/igt@kms_flip@basic-flip-vs-modeset@c-dp1.html
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6309/fi-cfl-8109u/igt@kms_flip@basic-flip-vs-modeset@c-dp1.html

  * igt@kms_frontbuffer_tracking@basic:
    - fi-cml-u2:          [PASS][8] -> [DMESG-WARN][9] ([i915#4269])
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10720/fi-cml-u2/igt@kms_frontbuffer_tracking@basic.html
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6309/fi-cml-u2/igt@kms_frontbuffer_tracking@basic.html

  * igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-b:
    - fi-cfl-8109u:       [PASS][10] -> [DMESG-WARN][11] ([i915#295]) +18 similar issues
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10720/fi-cfl-8109u/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-b.html
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6309/fi-cfl-8109u/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-b.html

  
  {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
  [i915#1982]: https://gitlab.freedesktop.org/drm/intel/issues/1982
  [i915#295]: https://gitlab.freedesktop.org/drm/intel/issues/295
  [i915#4165]: https://gitlab.freedesktop.org/drm/intel/issues/4165
  [i915#4269]: https://gitlab.freedesktop.org/drm/intel/issues/4269


Participating hosts (35 -> 34)
------------------------------

  Additional (1): fi-elk-e7500 
  Missing    (2): fi-kbl-soraka fi-bsw-cyan 


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

  * CI: CI-20190529 -> None
  * IGT: IGT_6242 -> IGTPW_6309

  CI-20190529: 20190529
  CI_DRM_10720: 8a8d1f74b64edddbbb43fa4be5e438a12ba70707 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_6309: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6309/index.html
  IGT_6242: 721fd85ee95225ed5df322f7182bdfa9b86a3e68 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git

== Logs ==

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

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

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

* Re: [igt-dev] [PATCH i-g-t] tests/i915/gem_exec_suspend: Add support for local memory
  2021-10-12  5:01 [igt-dev] [PATCH i-g-t] tests/i915/gem_exec_suspend: Add support for local memory sai.gowtham.ch
  2021-10-12  5:47 ` [igt-dev] ✗ Fi.CI.BAT: failure for " Patchwork
@ 2021-10-13 15:10 ` Zbigniew Kempczyński
  1 sibling, 0 replies; 3+ messages in thread
From: Zbigniew Kempczyński @ 2021-10-13 15:10 UTC (permalink / raw)
  To: sai.gowtham.ch; +Cc: igt-dev

On Tue, Oct 12, 2021 at 10:31:22AM +0530, sai.gowtham.ch@intel.com wrote:
> From: Ch Sai Gowtham <sai.gowtham.ch@intel.com>
> 
> Add support for local memory region (Device memory)
> 
> Signed-off-by: Ch Sai Gowtham <sai.gowtham.ch@intel.com>
> Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
> ---
>  tests/i915/gem_exec_suspend.c | 187 ++++++++++++++++++++++++++--------
>  1 file changed, 147 insertions(+), 40 deletions(-)
> 
> diff --git a/tests/i915/gem_exec_suspend.c b/tests/i915/gem_exec_suspend.c
> index 887bb735..ac7e1b7c 100644
> --- a/tests/i915/gem_exec_suspend.c
> +++ b/tests/i915/gem_exec_suspend.c
> @@ -51,8 +51,19 @@
>  #define CACHED (1<<8)
>  #define HANG (2<<8)
>  
> +static uint32_t batch_create(int fd, uint32_t batch_size, uint32_t region)
> +{
> +	const uint32_t bbe = MI_BATCH_BUFFER_END;
> +	uint32_t handle;
> +
> +	handle = gem_create_in_memory_regions(fd, batch_size, region);
> +	gem_write(fd, handle, 0, &bbe, sizeof(bbe));
> +
> +	return handle;
> +}
> +
>  static void run_test(int fd, const intel_ctx_t *ctx,
> -		     unsigned engine, unsigned flags);
> +		     unsigned engine, unsigned flags, uint32_t region);
>  
>  static void check_bo(int fd, uint32_t handle)
>  {
> @@ -67,16 +78,15 @@ static void check_bo(int fd, uint32_t handle)
>  	munmap(map, 4096);
>  }
>  
> -static void test_all(int fd, const intel_ctx_t *ctx, unsigned flags)
> +static void test_all(int fd, const intel_ctx_t *ctx, unsigned flags, uint32_t region)
>  {
> -	run_test(fd, ctx, ALL_ENGINES, flags & ~0xff);
> +	run_test(fd, ctx, ALL_ENGINES, flags & ~0xff, region);
>  }
>  
>  static void run_test(int fd, const intel_ctx_t *ctx,
> -		     unsigned engine, unsigned flags)
> +		     unsigned engine, unsigned flags, uint32_t region)
>  {
>  	const unsigned int gen = intel_gen(intel_get_drm_devid(fd));
> -	const uint32_t bbe = MI_BATCH_BUFFER_END;
>  	struct drm_i915_gem_exec_object2 obj[2];
>  	struct drm_i915_gem_relocation_entry reloc;
>  	struct drm_i915_gem_execbuffer2 execbuf;
> @@ -100,7 +110,7 @@ static void run_test(int fd, const intel_ctx_t *ctx,
>  
>  	/* Before suspending, check normal operation */
>  	if (mode(flags) != NOSLEEP)
> -		test_all(fd, ctx, flags);
> +		test_all(fd, ctx, flags, region);
>  
>  	gem_quiescent_gpu(fd);
>  
> @@ -117,8 +127,7 @@ static void run_test(int fd, const intel_ctx_t *ctx,
>  	if (!gem_has_lmem(fd))
>  		gem_set_caching(fd, obj[0].handle, !!(flags & CACHED));
>  	obj[0].flags |= EXEC_OBJECT_WRITE;
> -	obj[1].handle = gem_create(fd, 4096);

I think target buffer also should be created in specified region.
Currently only batch is moving between regions but target is always
taken from system memory.

I don't think cross-regioning would be interesting so both objects created 
within same region would be enough. After resume we would see if target
buffer contains what we expect of.

> -	gem_write(fd, obj[1].handle, 0, &bbe, sizeof(bbe));
> +	obj[1].handle = batch_create(fd, 4096, region);
>  	igt_require(__gem_execbuf(fd, &execbuf) == 0);
>  	gem_close(fd, obj[1].handle);
>  
> @@ -222,7 +231,7 @@ static void run_test(int fd, const intel_ctx_t *ctx,
>  
>  	/* After resume, make sure it still works */
>  	if (mode(flags) != NOSLEEP)
> -		test_all(fd, ctx, flags);
> +		test_all(fd, ctx, flags, region);
>  }
>  
>  struct battery_sample {
> @@ -250,7 +259,7 @@ static double d_time(const struct battery_sample *after,
>  }
>  
>  static void power_test(int i915, const intel_ctx_t *ctx,
> -		       unsigned engine, unsigned flags)
> +		       unsigned engine, unsigned flags, uint32_t region)
>  {
>  	struct battery_sample before, after;
>  	char *status;
> @@ -270,7 +279,7 @@ static void power_test(int i915, const intel_ctx_t *ctx,
>  	igt_set_autoresume_delay(5 * 60); /* 5 minutes; longer == more stable */
>  
>  	igt_assert(get_power(dir, &before));
> -	run_test(i915, ctx, engine, flags);
> +	run_test(i915, ctx, engine, flags, region);
>  	igt_assert(get_power(dir, &after));
>  
>  	igt_set_autoresume_delay(0);
> @@ -296,6 +305,10 @@ igt_main
>  	igt_hang_t hang;
>  	const intel_ctx_t *ctx;
>  	int fd;
> +	char *sub_name;
> +	uint32_t region;
> +	struct drm_i915_query_memory_regions *query_info;
> +	struct igt_collection *set, *regions;
>  
>  	igt_fixture {
>  		fd = drm_open_driver_master(DRIVER_INTEL);
> @@ -304,49 +317,111 @@ igt_main
>  		ctx = intel_ctx_create_all_physical(fd);
>  
>  		igt_fork_hang_detector(fd);
> +		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);
> +	}
> +
> +	igt_subtest_with_dynamic("basic") {
> +		for_each_combination(regions, 1, set) {
> +			sub_name = memregion_dynamic_subtest_name(regions);
> +			region = igt_collection_get_value(regions, 0);
> +			igt_dynamic_f("%s", sub_name)
> +				run_test(fd, ctx, ALL_ENGINES, NOSLEEP, region);
> +			free(sub_name);
> +		}
>  	}
>  
> -	igt_subtest("basic")
> -		run_test(fd, ctx, ALL_ENGINES, NOSLEEP);
> -	igt_subtest("basic-S0")
> -		run_test(fd, ctx, ALL_ENGINES, IDLE);
> -	igt_subtest("basic-S3-devices")
> -		run_test(fd, ctx, ALL_ENGINES, SUSPEND_DEVICES);
> -	igt_subtest("basic-S3")
> -		run_test(fd, ctx, ALL_ENGINES, SUSPEND);
> -	igt_subtest("basic-S4-devices")
> -		run_test(fd, ctx, ALL_ENGINES, HIBERNATE_DEVICES);
> -	igt_subtest("basic-S4")
> -		run_test(fd, ctx, ALL_ENGINES, HIBERNATE);
> +	igt_subtest_with_dynamic("basic-S0") {
> +		for_each_combination(regions, 1, set) {
> +			sub_name = memregion_dynamic_subtest_name(regions);
> +			region = igt_collection_get_value(regions, 0);
> +			igt_dynamic_f("%s", sub_name)
> +				run_test(fd, ctx, ALL_ENGINES, IDLE, region);
> +			free(sub_name);
> +		}
> +	}
> +
> +	igt_subtest_with_dynamic("basic-S3-devices") {
> +		for_each_combination(regions, 1, set) {
> +			sub_name = memregion_dynamic_subtest_name(regions);
> +			region = igt_collection_get_value(regions, 0);
> +			igt_dynamic_f("%s", sub_name)
> +				run_test(fd, ctx, ALL_ENGINES, SUSPEND_DEVICES, region);
> +			free(sub_name);
> +		}
> +	}
> +
> +	igt_subtest_with_dynamic("basic-S3") {
> +		for_each_combination(regions, 1, set) {
> +			sub_name = memregion_dynamic_subtest_name(regions);
> +			region = igt_collection_get_value(regions, 0);
> +			igt_dynamic_f("%s", sub_name)
> +				run_test(fd, ctx, ALL_ENGINES, SUSPEND, region);
> +			free(sub_name);
> +		}
> +	}
> +
> +	igt_subtest_with_dynamic("basic-S4-devices") {
> +		for_each_combination(regions, 1, set) {
> +			sub_name = memregion_dynamic_subtest_name(regions);
> +			region = igt_collection_get_value(regions, 0);
> +			igt_dynamic_f("%s", sub_name)
> +				run_test(fd, ctx, ALL_ENGINES, HIBERNATE_DEVICES, region);
> +			free(sub_name);
> +		}
> +	}
> +
> +	igt_subtest_with_dynamic("basic-S4") {
> +		for_each_combination(regions, 1, set) {
> +			sub_name = memregion_dynamic_subtest_name(regions);
> +			region = igt_collection_get_value(regions, 0);
> +			igt_dynamic_f("%s", sub_name)
> +				run_test(fd, ctx, ALL_ENGINES, HIBERNATE, region);
> +			free(sub_name);
> +		}
> +	}
>  
>  	for (m = modes; m->suffix; m++) {
>  		igt_subtest_with_dynamic_f("fixed%s", m->suffix) {
> -			igt_require(gem_has_lmem(fd));
>  			for_each_ctx_engine(fd, ctx, e) {
>  				if (!gem_class_can_store_dword(fd, e->class))
>  					continue;
> -				igt_dynamic_f("%s", e->name)
> -					run_test(fd, ctx, e->flags, m->mode);
> +				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)
> +						run_test(fd, ctx, e->flags, m->mode, region);
> +				}
>  			}
>  		}
>  
>  		igt_subtest_with_dynamic_f("uncached%s", m->suffix) {
> -			igt_require(!gem_has_lmem(fd));
>  			for_each_ctx_engine(fd, ctx, e) {
>  				if (!gem_class_can_store_dword(fd, e->class))
>  					continue;
> -				igt_dynamic_f("%s", e->name)
> -					run_test(fd, ctx, e->flags, m->mode | UNCACHED);
> +				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)
> +						run_test(fd, ctx, e->flags, m->mode | UNCACHED, region);
> +				}
>  			}
>  		}
>  
>  		igt_subtest_with_dynamic_f("cached%s", m->suffix) {
> -			igt_require(!gem_has_lmem(fd));
>  			for_each_ctx_engine(fd, ctx, e) {
>  				if (!gem_class_can_store_dword(fd, e->class))
>  					continue;
> -				igt_dynamic_f("%s", e->name)
> -					run_test(fd, ctx, e->flags, m->mode | CACHED);
> +				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)
> +						run_test(fd, ctx, e->flags, m->mode | CACHED, region);
> +				}

Cached and uncached runs makes sense only on integrated cards
where fixed on discrete. So those igt_require() properly
detects runtime constraints to run the test and you should
keep those in the code.

--
Zbigniew

>  			}
>  		}
>  	}
> @@ -356,17 +431,49 @@ igt_main
>  		hang = igt_allow_hang(fd, 0, 0);
>  	}
>  
> -	igt_subtest("hang-S3")
> -		run_test(fd, intel_ctx_0(fd), 0, SUSPEND | HANG);
> -	igt_subtest("hang-S4")
> -		run_test(fd, intel_ctx_0(fd), 0, HIBERNATE | HANG);
> +	igt_subtest_with_dynamic("hang-S3") {
> +		for_each_combination(regions, 1, set) {
> +			sub_name = memregion_dynamic_subtest_name(regions);
> +			region = igt_collection_get_value(regions, 0);
> +			igt_dynamic_f("%s", sub_name)
> +				run_test(fd, intel_ctx_0(fd), 0, SUSPEND | HANG, region);
> +			free(sub_name);
> +		}
> +	}
>  
> -	igt_subtest("power-S0")
> -		power_test(fd, intel_ctx_0(fd), 0, IDLE);
> -	igt_subtest("power-S3")
> -		power_test(fd, intel_ctx_0(fd), 0, SUSPEND);
> +	igt_subtest_with_dynamic("hang-S4") {
> +		for_each_combination(regions, 1, set) {
> +			sub_name = memregion_dynamic_subtest_name(regions);
> +			region = igt_collection_get_value(regions, 0);
> +			igt_dynamic_f("%s", sub_name)
> +				run_test(fd, intel_ctx_0(fd), 0, HIBERNATE | HANG, region);
> +			free(sub_name);
> +		}
> +	}
> +
> +	igt_subtest_with_dynamic("power-S0") {
> +		for_each_combination(regions, 1, set) {
> +			sub_name = memregion_dynamic_subtest_name(regions);
> +			region = igt_collection_get_value(regions, 0);
> +			igt_dynamic_f("%s", sub_name)
> +				power_test(fd, intel_ctx_0(fd), 0, IDLE, region);
> +			free(sub_name);
> +		}
> +	}
> +
> +	igt_subtest_with_dynamic("power-S3") {
> +		for_each_combination(regions, 1, set) {
> +			sub_name = memregion_dynamic_subtest_name(regions);
> +			region = igt_collection_get_value(regions, 0);
> +			igt_dynamic_f("%s", sub_name)
> +				power_test(fd, intel_ctx_0(fd), 0, SUSPEND, region);
> +			free(sub_name);
> +		}
> +	}
>  
>  	igt_fixture {
> +		free(query_info);
> +		igt_collection_destroy(set);
>  		igt_disallow_hang(fd, hang);
>  		intel_ctx_destroy(fd, ctx);
>  		close(fd);
> -- 
> 2.32.0
> 

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

end of thread, other threads:[~2021-10-13 15:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-12  5:01 [igt-dev] [PATCH i-g-t] tests/i915/gem_exec_suspend: Add support for local memory sai.gowtham.ch
2021-10-12  5:47 ` [igt-dev] ✗ Fi.CI.BAT: failure for " Patchwork
2021-10-13 15:10 ` [igt-dev] [PATCH i-g-t] " 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.