Skip to contentSkip to conversation

drm/i915: consider min_page_size when migrating

PATCH In review Matthew Auld 3 participants 4 messages Apr 7, 2022

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

PATCH 1/2 drm/i915: consider min_page_size when migrating

We can only force migrate an object if the existing object size is compatible with the new destinations min_page_size for the region. Currently we blow up with something like:

[ 2857.497462] kernel BUG at drivers/gpu/drm/i915/gt/intel_migrate.c:431!
[ 2857.497497] invalid opcode: 0000 [#1] PREEMPT SMP NOPTI
[ 2857.497502] CPU: 1 PID: 8921 Comm: i915_selftest Tainted: G     U  W         5.18.0-rc1-drm-tip+ #27
[ 2857.497513] RIP: 0010:emit_pte.cold+0x11a/0x17e [i915]
[ 2857.497646] Code: 00 48 c7 c2 f0 cd c1 a0 48 c7 c7 e9 99 bd a0 e8 d2 77 5d e0 bf 01 00 00 00 e8 08 47 5d e0 31 f6 bf 09 00 00 00 e8 3c 7b 4d e0 <0f> 0b 48 c7 c1 e0 2a c5 a0 ba 34 00 00 00 48 c7 c6 00 ce c1 a0 48
[ 2857.497654] RSP: 0018:ffffc900000f7748 EFLAGS: 00010246
[ 2857.497658] RAX: 0000000000000000 RBX: ffffc900000f77c8 RCX: 0000000000000006
[ 2857.497662] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000009
[ 2857.497665] RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000001
[ 2857.497668] R10: 0000000000022302 R11: ffff88846dea08f0 R12: 0000000000010000
[ 2857.497672] R13: 0000000001880000 R14: 000000000000081b R15: ffff888106b7c040
[ 2857.497675] FS:  00007f0d4c4e0600(0000) GS:ffff88845da80000(0000) knlGS:0000000000000000
[ 2857.497679] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 2857.497682] CR2: 00007f113966c088 CR3: 0000000211e60003 CR4: 00000000003706e0
[ 2857.497686] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 2857.497689] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 2857.497692] Call Trace:
[ 2857.497694]  <TASK>
[ 2857.497697]  intel_context_migrate_copy+0x1e5/0x4f0 [i915]
---
 drivers/gpu/drm/i915/gem/i915_gem_object.c            | 3 +++
 drivers/gpu/drm/i915/gem/selftests/i915_gem_migrate.c | 4 +++-
 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/gem/i915_gem_object.c +3 -0
index c1c3b510b9e2..07e816ddfb3d 100644
@@ -606,6 +606,9 @@ bool i915_gem_object_can_migrate(struct drm_i915_gem_object *obj,
 	if (!mr)
 		return false;
 
+	if (!IS_ALIGNED(obj->base.size, mr->min_page_size))
+		return false;
+
 	if (obj->mm.region == mr)
 		return true;
 
drivers/gpu/drm/i915/gem/selftests/i915_gem_migrate.c +3 -1
index 9922ac91ec71..6f98adb3a103 100644
@@ -47,14 +47,16 @@ static int igt_create_migrate(struct intel_gt *gt, enum intel_region_id src,
 {
 	struct drm_i915_private *i915 = gt->i915;
 	struct intel_memory_region *src_mr = i915->mm.regions[src];
+	struct intel_memory_region *dst_mr = i915->mm.regions[dst];
 	struct drm_i915_gem_object *obj;
 	struct i915_gem_ww_ctx ww;
 	int err = 0;
 
 	GEM_BUG_ON(!src_mr);
+	GEM_BUG_ON(!dst_mr);
 
 	/* Switch object backing-store on create */
-	obj = i915_gem_object_create_region(src_mr, PAGE_SIZE, 0, 0);
+	obj = i915_gem_object_create_region(src_mr, dst_mr->min_page_size, 0, 0);
 	if (IS_ERR(obj))
 		return PTR_ERR(obj);
 
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/2 drm/i915/buddy: sanity check the size

Ensure we check that the size is compatible with the requested page_size. For tiny objects that are automatically annotated with TTM_PL_FLAG_CONTIGUOUS(since they fit within a single page), we currently end up silently overriding the min_page_size, which ends up hiding bugs elsewhere.

Cc Thomas Hellström <[email protected]>
Cc Nirmoy Das <[email protected]>
---
 drivers/gpu/drm/i915/i915_ttm_buddy_manager.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/i915_ttm_buddy_manager.c +1 -0
index 8e4e3f72c1ef..a5109548abc0 100644
@@ -70,6 +70,7 @@ static int i915_ttm_buddy_man_alloc(struct ttm_resource_manager *man,
 		min_page_size = bo->page_alignment << PAGE_SHIFT;
 
 	GEM_BUG_ON(min_page_size < mm->chunk_size);
+	GEM_BUG_ON(!IS_ALIGNED(size, min_page_size));
 
 	if (place->fpfn + bman_res->base.num_pages != place->lpfn &&
 	    place->flags & TTM_PL_FLAG_CONTIGUOUS) {
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH 2/2] drm/i915/buddy: sanity check the size

|Reviewed-by: Nirmoy Das <[email protected]>|

Quoted 25 lines · Matthew Auld

Ensure we check that the size is compatible with the requested page_size. For tiny objects that are automatically annotated with TTM_PL_FLAG_CONTIGUOUS(since they fit within a single page), we currently end up silently overriding the min_page_size, which ends up hiding bugs elsewhere.

Cc Thomas Hellström<[email protected]>
Cc Nirmoy Das<[email protected]>
---
  drivers/gpu/drm/i915/i915_ttm_buddy_manager.c | 1 +
  1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/i915_ttm_buddy_manager.c +1 -0
index 8e4e3f72c1ef..a5109548abc0 100644
@@ -70,6 +70,7 @@ static int i915_ttm_buddy_man_alloc(struct ttm_resource_manager *man,
  		min_page_size = bo->page_alignment << PAGE_SHIFT;
 
  	GEM_BUG_ON(min_page_size < mm->chunk_size);
+	GEM_BUG_ON(!IS_ALIGNED(size, min_page_size));
 
  	if (place->fpfn + bman_res->base.num_pages != place->lpfn &&
  	    place->flags & TTM_PL_FLAG_CONTIGUOUS) {
#3 lore raw

[Intel-gfx] ✗ Fi.CI.BAT: failure for series starting with [1/2] drm/i915: consider min_page_size when migrating

In reply to Matthew Auld
== Series Details ==

== Series Details ==

Series: series starting with [1/2] drm/i915: consider min_page_size when migrating
URL : https://patchwork.freedesktop.org/series/102333/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_11472 -> Patchwork_22811
====================================================

Summary
-------

**FAILURE**

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

If you think the reported changes have nothing to do with the changes introduced in Patchwork_22811, 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/Patchwork_22811/index.html

Participating hosts (47 -> 37)
------------------------------

Additional (2): fi-bwr-2160 fi-pnv-d510
Missing (12): shard-tglu bat-adls-5 bat-dg1-6 bat-dg1-5 bat-dg2-8 bat-dg2-9 fi-bsw-cyan bat-adlp-6 bat-rpls-1 fi-bdw-samus bat-jsl-2 bat-jsl-1

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

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

### CI changes ###

#### Possible regressions ####

* boot:
- fi-pnv-d510: NOTRUN -> [FAIL][1]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22811/fi-pnv-d510/boot.html
- fi-bwr-2160: NOTRUN -> [FAIL][2]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22811/fi-bwr-2160/boot.html

### IGT changes ###

#### Possible regressions ####

* igt@gem_lmem_swapping@basic:
- fi-cfl-8109u: NOTRUN -> [FAIL][3]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22811/fi-cfl-8109u/igt@[email protected]

* igt@gem_lmem_swapping@parallel-random-engines:
- fi-bsw-nick: NOTRUN -> [FAIL][4]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22811/fi-bsw-nick/igt@[email protected]

#### Warnings ####

* igt@runner@aborted:
- fi-bdw-5557u: [FAIL][5] ([i915#4312]) -> [FAIL][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11472/fi-bdw-5557u/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22811/fi-bdw-5557u/igt@[email protected]
- fi-kbl-7567u: [FAIL][7] ([i915#4312]) -> [FAIL][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11472/fi-kbl-7567u/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22811/fi-kbl-7567u/igt@[email protected]

#### Suppressed ####

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

* igt@gem_lmem_swapping@basic:
- {fi-tgl-dsi}: NOTRUN -> [SKIP][9] +2 similar issues
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22811/fi-tgl-dsi/igt@[email protected]
- {fi-jsl-1}: [FAIL][10] -> [SKIP][11]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11472/fi-jsl-1/igt@[email protected]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22811/fi-jsl-1/igt@[email protected]

* igt@gem_lmem_swapping@parallel-random-engines:
- {fi-jsl-1}: NOTRUN -> [FAIL][12]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22811/fi-jsl-1/igt@[email protected]

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

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

### IGT changes ###

#### Issues hit ####

* igt@core_auth@basic-auth:
- fi-kbl-8809g: NOTRUN -> [SKIP][13] ([fdo#109271]) +1 similar issue
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22811/fi-kbl-8809g/igt@[email protected]

* igt@fbdev@eof:
- fi-kbl-8809g: NOTRUN -> [INCOMPLETE][14] ([i915#5557])
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22811/fi-kbl-8809g/igt@[email protected]

* igt@gem_exec_fence@basic-await:
- fi-bsw-nick: NOTRUN -> [SKIP][15] ([fdo#109271]) +151 similar issues
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22811/fi-bsw-nick/igt@[email protected]

* igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-b:
- fi-cfl-8109u: NOTRUN -> [SKIP][16] ([fdo#109271]) +145 similar issues
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22811/fi-cfl-8109u/igt@[email protected]

* igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-c:
- fi-cfl-8109u: NOTRUN -> [SKIP][17] ([fdo#109271] / [i915#5341])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22811/fi-cfl-8109u/igt@[email protected]
- fi-bsw-nick: NOTRUN -> [SKIP][18] ([fdo#109271] / [i915#5341])
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22811/fi-bsw-nick/igt@[email protected]

#### Warnings ####

* igt@runner@aborted:
- fi-bsw-kefka: [FAIL][19] ([i915#4312]) -> [FAIL][20] ([i915#3690])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11472/fi-bsw-kefka/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22811/fi-bsw-kefka/igt@[email protected]
- fi-cfl-8109u: [FAIL][21] -> [FAIL][22] ([i915#4312])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11472/fi-cfl-8109u/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22811/fi-cfl-8109u/igt@[email protected]
- fi-bsw-nick: [FAIL][23] ([i915#3690]) -> [FAIL][24] ([i915#4312])
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11472/fi-bsw-nick/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22811/fi-bsw-nick/igt@[email protected]
- fi-kbl-8809g: [FAIL][25] -> [FAIL][26] ([i915#2722])
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11472/fi-kbl-8809g/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22811/fi-kbl-8809g/igt@[email protected]
- fi-hsw-4770: [FAIL][27] ([i915#4312]) -> [FAIL][28] ([i915#4312] / [i915#5594])
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11472/fi-hsw-4770/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22811/fi-hsw-4770/igt@[email protected]
- fi-kbl-guc: [FAIL][29] ([i915#4312] / [i915#5257]) -> [FAIL][30] ([i915#4312])
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11472/fi-kbl-guc/igt@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22811/fi-kbl-guc/igt@[email protected]
- fi-tgl-1115g4: [FAIL][31] ([i915#4312] / [i915#5257]) -> [FAIL][32] ([i915#3690])
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11472/fi-tgl-1115g4/igt@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22811/fi-tgl-1115g4/igt@[email protected]
- fi-cfl-guc: [FAIL][33] ([i915#4312]) -> [FAIL][34] ([i915#4312] / [i915#5257])
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11472/fi-cfl-guc/igt@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22811/fi-cfl-guc/igt@[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#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
[fdo#111615]: https://bugs.freedesktop.org/show_bug.cgi?id=111615
[i915#2575]: https://gitlab.freedesktop.org/drm/intel/issues/2575
[i915#2722]: https://gitlab.freedesktop.org/drm/intel/issues/2722
[i915#3690]: https://gitlab.freedesktop.org/drm/intel/issues/3690
[i915#4312]: https://gitlab.freedesktop.org/drm/intel/issues/4312
[i915#5257]: https://gitlab.freedesktop.org/drm/intel/issues/5257
[i915#5341]: https://gitlab.freedesktop.org/drm/intel/issues/5341
[i915#5557]: https://gitlab.freedesktop.org/drm/intel/issues/5557
[i915#5594]: https://gitlab.freedesktop.org/drm/intel/issues/5594

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

* Linux: CI_DRM_11472 -> Patchwork_22811

CI-20190529: 20190529
CI_DRM_11472: 85882df13168c5f46b41401b96975de857e3ccac @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_6415: c3b690bd5f7fb1fb7ed786ab0f3b815930a6a55f @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_22811: 07096a893ef20e5fa25c76d7aba66fc01f504b82 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

07096a893ef2 drm/i915/buddy: sanity check the size 0a6057c62aa5 drm/i915: consider min_page_size when migrating

== Logs ==

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