Skip to contentSkip to conversation

drm/i915/selftest: fix 64K alignment in igt_write_huge

PATCH In review Matthew Auld 5 participants 8 messages Oct 29, 2018 – Oct 30, 2018

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

PATCH 1/1 drm/i915/selftest: fix 64K alignment in igt_write_huge

When using softpin it's not enough to just pad the vma size, we also need to ensure the vma offset is at the start of the pt boundary, if we plan to utilize 64K pages.

---
 drivers/gpu/drm/i915/selftests/huge_pages.c | 28 +++++++++++++--------
 1 file changed, 17 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/selftests/huge_pages.c +17 -11
index 256001b00e32..765e69471958 100644
@@ -1114,8 +1114,8 @@ static int igt_write_huge(struct i915_gem_context *ctx,
 	struct intel_engine_cs *engine;
 	I915_RND_STATE(prng);
 	IGT_TIMEOUT(end_time);
-	unsigned int max_page_size;
 	unsigned int id;
+	u64 alignment;
 	u64 max;
 	u64 num;
 	u64 size;
@@ -1126,16 +1126,19 @@ static int igt_write_huge(struct i915_gem_context *ctx,
 	GEM_BUG_ON(!i915_gem_object_has_pinned_pages(obj));
 
 	size = obj->base.size;
-	if (obj->mm.page_sizes.sg & I915_GTT_PAGE_SIZE_64K)
+	alignment = rounddown_pow_of_two(obj->mm.page_sizes.sg);
+	if (obj->mm.page_sizes.sg & I915_GTT_PAGE_SIZE_64K) {
 		size = round_up(size, I915_GTT_PAGE_SIZE_2M);
+		alignment = max(alignment, I915_GTT_PAGE_SIZE_2M);
+	}
 
-	max_page_size = rounddown_pow_of_two(obj->mm.page_sizes.sg);
-	max = div_u64((vm->total - size), max_page_size);
+	max = div_u64((vm->total - size), alignment);
 
 	n = 0;
 	for_each_engine(engine, i915, id) {
 		if (!intel_engine_can_store_dword(engine)) {
-			pr_info("store-dword-imm not supported on engine=%u\n", id);
+			pr_info("store-dword-imm not supported on engine=%u\n",
+				id);
 			continue;
 		}
 		engines[n++] = engine;
@@ -1160,24 +1163,27 @@ static int igt_write_huge(struct i915_gem_context *ctx,
 	 */
 	i = 0;
 	for_each_prime_number_from(num, 0, max) {
-		u64 offset_low = num * max_page_size;
-		u64 offset_high = (max - num) * max_page_size;
+		u64 offset_low = num * alignment;
+		u64 offset_high = (max - num) * alignment;
 		u32 dword = offset_in_page(num) / 4;
 
 		engine = engines[order[i] % n];
 		i = (i + 1) % (n * I915_NUM_ENGINES);
 
-		err = __igt_write_huge(ctx, engine, obj, size, offset_low, dword, num + 1);
+		err = __igt_write_huge(ctx, engine, obj, size, offset_low,
+				       dword, num + 1);
 		if (err)
 			break;
 
-		err = __igt_write_huge(ctx, engine, obj, size, offset_high, dword, num + 1);
+		err = __igt_write_huge(ctx, engine, obj, size, offset_high,
+				       dword, num + 1);
 		if (err)
 			break;
 
 		if (igt_timeout(end_time,
-				"%s timed out on engine=%u, offset_low=%llx offset_high=%llx, max_page_size=%x\n",
-				__func__, engine->id, offset_low, offset_high, max_page_size))
+				"%s timed out on engine=%u, offset_low=%llx offset_high=%llx, max_page_size=%lx\n",
+				__func__, engine->id, offset_low, offset_high,
+				rounddown_pow_of_two(obj->mm.page_sizes.sg)))
 			break;
 	}
 
Signature · 6 lines
2.17.2

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

Quoting Matthew Auld (2018-10-29 19:36:37)

Quoted 3 lines

When using softpin it's not enough to just pad the vma size, we also need to ensure the vma offset is at the start of the pt boundary, if we plan to utilize 64K pages.

For testing purposes, we have to assume the worst as well as best cases. Looks like we could extend this to cover both aligned and unaligned offsets. Or have I missed the purpose of the test?
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
Quoted 9 lines · Chris Wilson

Quoting Matthew Auld (2018-10-29 19:36:37)

Quoted 3 lines

When using softpin it's not enough to just pad the vma size, we also need to ensure the vma offset is at the start of the pt boundary, if we plan to utilize 64K pages.

For testing purposes, we have to assume the worst as well as best cases. Looks like we could extend this to cover both aligned and unaligned offsets. Or have I missed the purpose of the test?

Yup, even better.

Quoted 5 lines

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

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

#3 lore raw

✗ Fi.CI.SPARSE: warning for drm/i915/selftest: fix 64K alignment in igt_write_huge

In reply to Matthew Auld
== Series Details ==

== Series Details ==

Series: drm/i915/selftest: fix 64K alignment in igt_write_huge
URL : https://patchwork.freedesktop.org/series/51705/
State : warning

== Summary ==

$ dim sparse origin/drm-tip
Sparse version: v0.5.2
Commit: drm/i915/selftest: fix 64K alignment in igt_write_huge
+drivers/gpu/drm/i915/selftests/huge_pages.c:1132:29: warning: expression using sizeof(void)

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

#4 lore raw

✓ Fi.CI.BAT: success for drm/i915/selftest: fix 64K alignment in igt_write_huge

In reply to Matthew Auld
== Series Details ==

== Series Details ==

Series: drm/i915/selftest: fix 64K alignment in igt_write_huge
URL : https://patchwork.freedesktop.org/series/51705/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_5051 -> Patchwork_10635 =

== Summary - SUCCESS ==

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/51705/revisions/1/mbox/

== Known issues ==

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

=== IGT changes ===

    ==== Issues hit ====

    igt@gem_exec_suspend@basic-s3:
      fi-kbl-soraka:      NOTRUN -> INCOMPLETE (fdo#107859, fdo#107774, fdo#107556)

    igt@kms_pipe_crc_basic@nonblocking-crc-pipe-a-frame-sequence:
      fi-byt-clapper:     PASS -> FAIL (fdo#103191, fdo#107362)

    
    ==== Possible fixes ====

    igt@gem_exec_suspend@basic-s3:
      fi-blb-e6850:       INCOMPLETE (fdo#107718) -> PASS

    igt@kms_frontbuffer_tracking@basic:
      fi-icl-u2:          FAIL (fdo#103167) -> PASS

fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
fdo#107362 https://bugs.freedesktop.org/show_bug.cgi?id=107362
fdo#107556 https://bugs.freedesktop.org/show_bug.cgi?id=107556
fdo#107718 https://bugs.freedesktop.org/show_bug.cgi?id=107718
fdo#107774 https://bugs.freedesktop.org/show_bug.cgi?id=107774
fdo#107859 https://bugs.freedesktop.org/show_bug.cgi?id=107859

== Participating hosts (48 -> 43) ==

Additional (1): fi-kbl-soraka
Missing (6): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-pnv-d510

== Build changes ==

* Linux: CI_DRM_5051 -> Patchwork_10635

CI_DRM_5051: 2523b4d2158bc0fc25031aad0def0b4ba04432f2 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4699: 1270ec553741ac20c45178d2b26f9a9562ea565f @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_10635: c5f887b3440ca7d64b51dd4f3f27e368e90510f5 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

c5f887b3440c drm/i915/selftest: fix 64K alignment in igt_write_huge

== Logs ==

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

#5 lore raw

✓ Fi.CI.IGT: success for drm/i915/selftest: fix 64K alignment in igt_write_huge

In reply to Matthew Auld
== Series Details ==

== Series Details ==

Series: drm/i915/selftest: fix 64K alignment in igt_write_huge
URL : https://patchwork.freedesktop.org/series/51705/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_5051_full -> Patchwork_10635_full =

== Summary - SUCCESS ==

No regressions found.

== Known issues ==

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

=== IGT changes ===

    ==== Issues hit ====

    igt@drv_suspend@shrink:
      shard-glk:          PASS -> INCOMPLETE (k.org#198133, fdo#106886, fdo#103359)

    igt@gem_softpin@noreloc-s3:
      shard-skl:          PASS -> INCOMPLETE (fdo#107773, fdo#104108)

    igt@gem_userptr_blits@unsync-unmap:
      shard-glk:          PASS -> DMESG-WARN (fdo#105763, fdo#106538) +1

    igt@kms_busy@extended-modeset-hang-newfb-render-c:
      shard-skl:          NOTRUN -> DMESG-WARN (fdo#107956)

    igt@kms_busy@extended-pageflip-modeset-hang-oldfb-render-b:
      shard-snb:          NOTRUN -> DMESG-WARN (fdo#107956) +1

    igt@kms_color@pipe-c-degamma:
      shard-apl:          PASS -> FAIL (fdo#104782)

    igt@kms_cursor_crc@cursor-256x85-random:
      shard-apl:          PASS -> FAIL (fdo#103232) +2

    igt@kms_draw_crc@draw-method-rgb565-pwrite-ytiled:
      shard-glk:          PASS -> FAIL (fdo#103184)

    igt@kms_fbcon_fbt@psr-suspend:
      shard-skl:          NOTRUN -> FAIL (fdo#107882)

    igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-fullscreen:
      shard-glk:          PASS -> FAIL (fdo#103167)

    igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-spr-indfb-onoff:
      shard-glk:          PASS -> DMESG-FAIL (fdo#106538)

    igt@kms_frontbuffer_tracking@fbc-stridechange:
      shard-skl:          NOTRUN -> FAIL (fdo#105683)

    igt@kms_plane_alpha_blend@pipe-a-alpha-opaque-fb:
      shard-skl:          NOTRUN -> FAIL (fdo#108145) +1

    igt@kms_plane_alpha_blend@pipe-c-coverage-7efc:
      shard-skl:          NOTRUN -> FAIL (fdo#107815)

    igt@kms_plane_multiple@atomic-pipe-b-tiling-x:
      shard-glk:          PASS -> FAIL (fdo#103166)
      shard-apl:          PASS -> FAIL (fdo#103166) +1

    igt@kms_setmode@basic:
      shard-snb:          NOTRUN -> FAIL (fdo#99912)

    igt@pm_rpm@system-suspend-execbuf:
      shard-skl:          PASS -> INCOMPLETE (fdo#107807, fdo#104108)

    
    ==== Possible fixes ====

    igt@gem_eio@in-flight-contexts-1us:
      shard-glk:          FAIL (fdo#105957) -> PASS

    igt@gem_eio@in-flight-suspend:
      shard-glk:          DMESG-WARN -> PASS

    igt@gem_pwrite@big-cpu-forwards:
      shard-apl:          INCOMPLETE (fdo#103927) -> PASS

    igt@kms_cursor_crc@cursor-256x85-onscreen:
      shard-apl:          FAIL (fdo#103232) -> PASS

    igt@kms_cursor_legacy@cursorb-vs-flipb-toggle:
      shard-glk:          DMESG-WARN (fdo#105763, fdo#106538) -> PASS

    igt@kms_draw_crc@draw-method-rgb565-mmap-wc-ytiled:
      shard-glk:          FAIL (fdo#103184) -> PASS

    igt@kms_flip@2x-flip-vs-expired-vblank-interruptible:
      shard-glk:          FAIL (fdo#105363) -> PASS

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-gtt:
      shard-apl:          FAIL (fdo#103167) -> PASS +1
      shard-glk:          FAIL (fdo#103167) -> PASS +1

    igt@kms_plane@plane-position-covered-pipe-a-planes:
      shard-apl:          FAIL (fdo#103166) -> PASS +1

fdo#103166 https://bugs.freedesktop.org/show_bug.cgi?id=103166
fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#103184 https://bugs.freedesktop.org/show_bug.cgi?id=103184
fdo#103232 https://bugs.freedesktop.org/show_bug.cgi?id=103232
fdo#103359 https://bugs.freedesktop.org/show_bug.cgi?id=103359
fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927
fdo#104108 https://bugs.freedesktop.org/show_bug.cgi?id=104108
fdo#104782 https://bugs.freedesktop.org/show_bug.cgi?id=104782
fdo#105363 https://bugs.freedesktop.org/show_bug.cgi?id=105363
fdo#105683 https://bugs.freedesktop.org/show_bug.cgi?id=105683
fdo#105763 https://bugs.freedesktop.org/show_bug.cgi?id=105763
fdo#105957 https://bugs.freedesktop.org/show_bug.cgi?id=105957
fdo#106538 https://bugs.freedesktop.org/show_bug.cgi?id=106538
fdo#106886 https://bugs.freedesktop.org/show_bug.cgi?id=106886
fdo#107773 https://bugs.freedesktop.org/show_bug.cgi?id=107773
fdo#107807 https://bugs.freedesktop.org/show_bug.cgi?id=107807
fdo#107815 https://bugs.freedesktop.org/show_bug.cgi?id=107815
fdo#107882 https://bugs.freedesktop.org/show_bug.cgi?id=107882
fdo#107956 https://bugs.freedesktop.org/show_bug.cgi?id=107956
fdo#108145 https://bugs.freedesktop.org/show_bug.cgi?id=108145
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
k.org#198133 https://bugzilla.kernel.org/show_bug.cgi?id=198133

== Participating hosts (6 -> 6) ==

No changes in participating hosts

== Build changes ==

* Linux: CI_DRM_5051 -> Patchwork_10635

CI_DRM_5051: 2523b4d2158bc0fc25031aad0def0b4ba04432f2 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4699: 1270ec553741ac20c45178d2b26f9a9562ea565f @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_10635: c5f887b3440ca7d64b51dd4f3f27e368e90510f5 @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

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

#6 lore raw
In reply to Matthew Auld
Thank you for the patch! Perhaps something to improve:

Hi Matthew,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on v4.19 next-20181029]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Matthew-Auld/drm-i915-selftest-fix-64K-alignment-in-igt_write_huge/20181030-034107
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: i386-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

In file included from include/linux/list.h:9:0,

                    from include/linux/agp_backend.h:33,
                    from include/drm/drmP.h:35,
                    from drivers/gpu/drm/i915/i915_gem.c:28:
   drivers/gpu/drm/i915/selftests/huge_pages.c: In function 'igt_write_huge':
   include/linux/kernel.h:845:29: warning: comparison of distinct pointer types lacks a cast
      (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
                                ^
   include/linux/kernel.h:859:4: note: in expansion of macro '__typecheck'
      (__typecheck(x, y) && __no_side_effects(x, y))
       ^~~~~~~~~~~
   include/linux/kernel.h:869:24: note: in expansion of macro '__safe_cmp'
     __builtin_choose_expr(__safe_cmp(x, y), \
                           ^~~~~~~~~~
   include/linux/kernel.h:885:19: note: in expansion of macro '__careful_cmp'
    #define max(x, y) __careful_cmp(x, y, >)
                      ^~~~~~~~~~~~~
>> drivers/gpu/drm/i915/selftests/huge_pages.c:1132:15: note: in expansion of macro 'max'
      alignment = max(alignment, I915_GTT_PAGE_SIZE_2M);
                  ^~~

vim +/max +1132 drivers/gpu/drm/i915/selftests/huge_pages.c

1106
1107 static int igt_write_huge(struct i915_gem_context *ctx,
1108 struct drm_i915_gem_object *obj)
1109 {
1110 struct drm_i915_private *i915 = to_i915(obj->base.dev);
1111 struct i915_address_space *vm =
1112 ctx->ppgtt ? &ctx->ppgtt->vm : &i915->ggtt.vm;
1113 static struct intel_engine_cs *engines[I915_NUM_ENGINES];
1114 struct intel_engine_cs *engine;
1115 I915_RND_STATE(prng);
1116 IGT_TIMEOUT(end_time);
1117 unsigned int id;
1118 u64 alignment;
1119 u64 max;
1120 u64 num;
1121 u64 size;
1122 int *order;
1123 int i, n;
1124 int err = 0;
1125
1126 GEM_BUG_ON(!i915_gem_object_has_pinned_pages(obj));
1127
1128 size = obj->base.size;
1129 alignment = rounddown_pow_of_two(obj->mm.page_sizes.sg);
1130 if (obj->mm.page_sizes.sg & I915_GTT_PAGE_SIZE_64K) {
1131 size = round_up(size, I915_GTT_PAGE_SIZE_2M);

> 1132			alignment = max(alignment, I915_GTT_PAGE_SIZE_2M);

1133 }
1134
1135 max = div_u64((vm->total - size), alignment);
1136
1137 n = 0;
1138 for_each_engine(engine, i915, id) {
1139 if (!intel_engine_can_store_dword(engine)) {
1140 pr_info("store-dword-imm not supported on engine=%u\n",
1141 id);
1142 continue;
1143 }
1144 engines[n++] = engine;
1145 }
1146
1147 if (!n)
1148 return 0;
1149
1150 /*
1151 * To keep things interesting when alternating between engines in our
1152 * randomized order, lets also make feeding to the same engine a few
1153 * times in succession a possibility by enlarging the permutation array.
1154 */
1155 order = i915_random_order(n * I915_NUM_ENGINES, &prng);
1156 if (!order)
1157 return -ENOMEM;
1158
1159 /*
1160 * Try various offsets in an ascending/descending fashion until we
1161 * timeout -- we want to avoid issues hidden by effectively always using
1162 * offset = 0.
1163 */
1164 i = 0;
1165 for_each_prime_number_from(num, 0, max) {
1166 u64 offset_low = num * alignment;
1167 u64 offset_high = (max - num) * alignment;
1168 u32 dword = offset_in_page(num) / 4;
1169
1170 engine = engines[order[i] % n];
1171 i = (i + 1) % (n * I915_NUM_ENGINES);
1172
1173 err = __igt_write_huge(ctx, engine, obj, size, offset_low,
1174 dword, num + 1);
1175 if (err)
1176 break;
1177
1178 err = __igt_write_huge(ctx, engine, obj, size, offset_high,
1179 dword, num + 1);
1180 if (err)
1181 break;
1182
1183 if (igt_timeout(end_time,
1184 "%s timed out on engine=%u, offset_low=%llx offset_high=%llx, max_page_size=%lx\n",
1185 __func__, engine->id, offset_low, offset_high,
1186 rounddown_pow_of_two(obj->mm.page_sizes.sg)))
1187 break;
1188 }
1189
1190 kfree(order);
1191
1192 return err;
1193 }
1194

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

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

#7 lore raw
In reply to Matthew Auld
Thank you for the patch! Perhaps something to improve:

Hi Matthew,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on v4.19 next-20181030]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Matthew-Auld/drm-i915-selftest-fix-64K-alignment-in-igt_write_huge/20181030-034107
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: i386-allyesconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

In file included from drivers/gpu/drm/i915/i915_gem.c:6238:0:
drivers/gpu/drm/i915/selftests/huge_pages.c: In function 'igt_write_huge':

>> drivers/gpu/drm/i915/selftests/huge_pages.c:1132:72: warning: comparison of distinct pointer types lacks a cast
      alignment = max(alignment, I915_GTT_PAGE_SIZE_2M);
                                                                           ^ 

vim +1132 drivers/gpu/drm/i915/selftests/huge_pages.c

1106
1107 static int igt_write_huge(struct i915_gem_context *ctx,
1108 struct drm_i915_gem_object *obj)
1109 {
1110 struct drm_i915_private *i915 = to_i915(obj->base.dev);
1111 struct i915_address_space *vm =
1112 ctx->ppgtt ? &ctx->ppgtt->vm : &i915->ggtt.vm;
1113 static struct intel_engine_cs *engines[I915_NUM_ENGINES];
1114 struct intel_engine_cs *engine;
1115 I915_RND_STATE(prng);
1116 IGT_TIMEOUT(end_time);
1117 unsigned int id;
1118 u64 alignment;
1119 u64 max;
1120 u64 num;
1121 u64 size;
1122 int *order;
1123 int i, n;
1124 int err = 0;
1125
1126 GEM_BUG_ON(!i915_gem_object_has_pinned_pages(obj));
1127
1128 size = obj->base.size;
1129 alignment = rounddown_pow_of_two(obj->mm.page_sizes.sg);
1130 if (obj->mm.page_sizes.sg & I915_GTT_PAGE_SIZE_64K) {
1131 size = round_up(size, I915_GTT_PAGE_SIZE_2M);

> 1132			alignment = max(alignment, I915_GTT_PAGE_SIZE_2M);

1133 }
1134
1135 max = div_u64((vm->total - size), alignment);
1136
1137 n = 0;
1138 for_each_engine(engine, i915, id) {
1139 if (!intel_engine_can_store_dword(engine)) {
1140 pr_info("store-dword-imm not supported on engine=%u\n",
1141 id);
1142 continue;
1143 }
1144 engines[n++] = engine;
1145 }
1146
1147 if (!n)
1148 return 0;
1149
1150 /*
1151 * To keep things interesting when alternating between engines in our
1152 * randomized order, lets also make feeding to the same engine a few
1153 * times in succession a possibility by enlarging the permutation array.
1154 */
1155 order = i915_random_order(n * I915_NUM_ENGINES, &prng);
1156 if (!order)
1157 return -ENOMEM;
1158
1159 /*
1160 * Try various offsets in an ascending/descending fashion until we
1161 * timeout -- we want to avoid issues hidden by effectively always using
1162 * offset = 0.
1163 */
1164 i = 0;
1165 for_each_prime_number_from(num, 0, max) {
1166 u64 offset_low = num * alignment;
1167 u64 offset_high = (max - num) * alignment;
1168 u32 dword = offset_in_page(num) / 4;
1169
1170 engine = engines[order[i] % n];
1171 i = (i + 1) % (n * I915_NUM_ENGINES);
1172
1173 err = __igt_write_huge(ctx, engine, obj, size, offset_low,
1174 dword, num + 1);
1175 if (err)
1176 break;
1177
1178 err = __igt_write_huge(ctx, engine, obj, size, offset_high,
1179 dword, num + 1);
1180 if (err)
1181 break;
1182
1183 if (igt_timeout(end_time,
1184 "%s timed out on engine=%u, offset_low=%llx offset_high=%llx, max_page_size=%lx\n",
1185 __func__, engine->id, offset_low, offset_high,
1186 rounddown_pow_of_two(obj->mm.page_sizes.sg)))
1187 break;
1188 }
1189
1190 kfree(order);
1191
1192 return err;
1193 }
1194

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

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