Skip to contentSkip to conversation

drm/i915/dpt: Restrict shrinker to DPT objects not mapped

PATCH In review Vidya Srinivas 3 participants 7 messages Nov 22, 2024 – Nov 23, 2024

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

PATCH 1/1 drm/i915/dpt: Restrict shrinker to DPT objects not mapped

Restricting all DPT objects as unshrinkable was causing some chromebooks to run out of memory causing
DMA remap failures. Thanks to Brian Geffon for the pointers on debug and suggesting usage of !obj->mm.mapping

Fixes 43e2b37e2ab6 ("drm/i915/dpt: Make DPT object unshrinkable")

Credits-to: Brian Geffon <[email protected]>

---
 drivers/gpu/drm/i915/gem/i915_gem_object.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/gem/i915_gem_object.h +1 -1
index 3dc61cbd2e11..b155f0139d4e 100644
@@ -285,7 +285,7 @@ i915_gem_object_is_shrinkable(const struct drm_i915_gem_object *obj)
 {
 	/* TODO: make DPT shrinkable when it has no bound vmas */
 	return i915_gem_object_type_has(obj, I915_GEM_OBJECT_IS_SHRINKABLE) &&
-		!obj->is_dpt;
+		!(obj->is_dpt && obj->mm.mapping);
 }
 
 static inline bool
Signature · 1 line
2.34.1
#1 lore raw

✗ Fi.CI.SPARSE: warning for drm/i915/dpt: Restrict shrinker to DPT objects not mapped

== Series Details ==

== Series Details ==

Series: drm/i915/dpt: Restrict shrinker to DPT objects not mapped
URL : https://patchwork.freedesktop.org/series/141695/
State : warning

== Summary ==

Error: dim sparse failed
Sparse version: v0.6.2
Fast mode used, each commit won't be checked separately.

#2 lore raw

✗ i915.CI.BAT: failure for drm/i915/dpt: Restrict shrinker to DPT objects not mapped

In reply to Vidya Srinivas
== Series Details ==

== Series Details ==

Series: drm/i915/dpt: Restrict shrinker to DPT objects not mapped
URL : https://patchwork.freedesktop.org/series/141695/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_15731 -> Patchwork_141695v1
====================================================

Summary
-------

**FAILURE**

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

If you think the reported changes have nothing to do with the changes
introduced in Patchwork_141695v1, please notify your bug team ([email protected]) 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_141695v1/index.html

Participating hosts (45 -> 43)
------------------------------

Missing (2): bat-adlp-11 fi-snb-2520m

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

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

### IGT changes ###

#### Possible regressions ####

* igt@i915_selftest@live:
- bat-mtlp-6: [PASS][1] -> [ABORT][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15731/bat-mtlp-6/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_141695v1/bat-mtlp-6/igt@[email protected]

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

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

### IGT changes ###

#### Issues hit ####

* igt@i915_selftest@live@workarounds:
- bat-arls-5: [PASS][3] -> [ABORT][4] ([i915#12061]) +1 other test abort
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15731/bat-arls-5/igt@i915_selftest@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_141695v1/bat-arls-5/igt@i915_selftest@[email protected]
- bat-mtlp-6: [PASS][5] -> [ABORT][6] ([i915#12061])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15731/bat-mtlp-6/igt@i915_selftest@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_141695v1/bat-mtlp-6/igt@i915_selftest@[email protected]

* igt@kms_chamelium_frames@dp-crc-fast:
- bat-dg2-13: [PASS][7] -> [FAIL][8] ([i915#12440])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15731/bat-dg2-13/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_141695v1/bat-dg2-13/igt@[email protected]

#### Possible fixes ####

* igt@i915_pm_rpm@module-reload:
- bat-dg1-7: [FAIL][9] ([i915#12903]) -> [PASS][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15731/bat-dg1-7/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_141695v1/bat-dg1-7/igt@[email protected]

#### Warnings ####

* igt@kms_cursor_legacy@basic-flip-before-cursor-atomic:
- fi-cfl-8109u: [DMESG-WARN][11] ([i915#11621] / [i915#1982]) -> [DMESG-WARN][12] ([i915#11621])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15731/fi-cfl-8109u/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_141695v1/fi-cfl-8109u/igt@[email protected]

[i915#11621]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/11621
[i915#12061]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/12061
[i915#12440]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/12440
[i915#12903]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/12903
[i915#1982]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/1982

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

* Linux: CI_DRM_15731 -> Patchwork_141695v1

CI-20190529: 20190529
CI_DRM_15731: a381faddbfc974e7bd57efe953a738415afccd6a @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_8122: 8122
Patchwork_141695v1: a381faddbfc974e7bd57efe953a738415afccd6a @ git://anongit.freedesktop.org/gfx-ci/linux

== Logs ==

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

#3 lore raw
In reply to Vidya Srinivas
Quoted 19 lines · Vidya Srinivas

Restricting all DPT objects as unshrinkable was causing some chromebooks to run out of memory causing
DMA remap failures. Thanks to Brian Geffon for the pointers on debug and suggesting usage of !obj->mm.mapping

Fixes 43e2b37e2ab6 ("drm/i915/dpt: Make DPT object unshrinkable")

Credits-to: Brian Geffon <[email protected]>

---
 drivers/gpu/drm/i915/gem/i915_gem_object.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/gem/i915_gem_object.h +0 -0
index 3dc61cbd2e11..b155f0139d4e 100644

drivers/gpu/drm/i915/gem/i915_gem_object.h i915_gem_object_is_shrinkable(const struct drm_i915_gem_object *obj) · line 288

Quoted 5 lines
drivers/gpu/drm/i915/gem/i915_gem_object.h +1 -1
@@ -285,7 +285,7 @@ i915_gem_object_is_shrinkable(const struct drm_i915_gem_object *obj)
 {
 	/* TODO: make DPT shrinkable when it has no bound vmas */
 	return i915_gem_object_type_has(obj, I915_GEM_OBJECT_IS_SHRINKABLE) &&
-		!obj->is_dpt;
+		!(obj->is_dpt && obj->mm.mapping);

AFAICS the mapping could only become NULL if the DPT got evicted from the GGTT, but if that can happen then I think the current code must still be busted wrt. suspend/resume even with the unshrinkable DPT obj.

Looking at the vma suspend stuff I think the only way something could still be bound in the DPT during resume is if it was pinned during suspend. But we should be unpinning all FBs during suspend, so that's a bit weird in itself. Hmm, we do the unpinning from the cleanup_work so maybe that's still pending when we suspend and thus something is still pinned in the DPT. And indeed there is no flush_work()/etc. for that. So perhaps if we add that we could just revert the unshrinkable DPT patch.

Did we have a good way to reproduce the resume explosion? If not, I suppose we could try to confirm the lack of flush_work() as the culprit by simply sticking some kind of sleep() into the cleanup function to make sure it doesn't get a chance to run during suspend.

I also had this:
https://patchwork.freedesktop.org/patch/503398/?series=108669&rev=1
which would be good to have so that we can actully do the obvious flush_work(cleanup_work) instead of playing confusing tricks with the the commit_work.

Quoted 5 lines
drivers/gpu/drm/i915/gem/i915_gem_object.h +0 -0
 }
 
 static inline bool
Signature · 1 line
2.34.1
Signature · 2 lines
Ville Syrjälä
Intel
#4 lore raw
Quoted 43 lines

-----Original Message-----
From: Ville Syrjälä <[email protected]>
Sent: 23 November 2024 04:18
To: Srinivas, Vidya <[email protected]>
Cc: [email protected]; Syrjala, Ville <[email protected]>; [email protected]; Lee, Shawn C <[email protected]>
Subject: Re: [PATCH] drm/i915/dpt: Restrict shrinker to DPT objects not mapped

Quoted 20 lines · Vidya Srinivas

Restricting all DPT objects as unshrinkable was causing some chromebooks to run out of memory causing DMA remap failures. Thanks to Brian Geffon for the pointers on debug and suggesting usage of !obj->mm.mapping

Fixes 43e2b37e2ab6 ("drm/i915/dpt: Make DPT object unshrinkable")

Credits-to: Brian Geffon <[email protected]>

---
 drivers/gpu/drm/i915/gem/i915_gem_object.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/gem/i915_gem_object.h +0 -0
index 3dc61cbd2e11..b155f0139d4e 100644

drivers/gpu/drm/i915/gem/i915_gem_object.h i915_gem_object_is_shrinkable(const struct · line 287

Quoted 3 lines
drivers/gpu/drm/i915/gem/i915_gem_object.h +0 -0
@@ -285,7 +285,7 @@ i915_gem_object_is_shrinkable(const struct
 drm_i915_gem_object *obj)  {
 	/* TODO: make DPT shrinkable when it has no bound vmas */
 	return i915_gem_object_type_has(obj,

I915_GEM_OBJECT_IS_SHRINKABLE) &&

drivers/gpu/drm/i915/gem/i915_gem_object.h i915_gem_object_is_shrinkable(const struct drm_i915_gem_object *obj) · line 288

Quoted 2 lines
drivers/gpu/drm/i915/gem/i915_gem_object.h +1 -1
-		!obj->is_dpt;
+		!(obj->is_dpt && obj->mm.mapping);

AFAICS the mapping could only become NULL if the DPT got evicted from the GGTT, but if that can happen then I think the current code must still be busted wrt. suspend/resume even with the unshrinkable DPT obj.

Quoted 8 lines

Looking at the vma suspend stuff I think the only way something could still be bound in the DPT during resume is if it was pinned during suspend. But we should be unpinning all FBs during suspend, so that's a bit weird in itself. Hmm, we do the unpinning from the cleanup_work so maybe that's still pending when we suspend and thus something is still pinned in the DPT. And indeed there is no flush_work()/etc. for that. So perhaps if we add that we could just revert the unshrinkable DPT patch.

Hello Ville,
Thank you so much. Yes, Google team also insist on that as they worry the DPT patch might just be a workaround for the real memory corruption.

Quoted 4 lines

Did we have a good way to reproduce the resume explosion? If not, I suppose we could try to confirm the lack of flush_work() as the culprit by simply sticking some kind of sleep() into the cleanup function to make sure it doesn't get a chance to run during suspend.

We can reproduce the original issue where during the suspend/resume, the meteorlake chromebook goes for a reboot and we have the crash captured from console-ramoops.

Quoted 7 lines

I also had this:
https://patchwork.freedesktop.org/patch/503398/?series=108669&rev=1
which would be good to have so that we can actully do the obvious flush_work(cleanup_work) instead of playing confusing tricks with the the commit_work.

Thank you so much. Will try this patch as well and update.

Regards
Vidya

Quoted 9 lines
Quoted 5 lines
drivers/gpu/drm/i915/gem/i915_gem_object.h +0 -1
 }
 
 static inline bool
--

2.34.1

--
Ville Syrjälä
Intel

#5 lore raw
Quoted 62 lines

-----Original Message-----
From: Srinivas, Vidya
Sent: 23 November 2024 09:39
To: Ville Syrjälä <[email protected]>
Cc: [email protected]; Syrjala, Ville <[email protected]>; [email protected]; Lee, Shawn C <[email protected]>
Subject: RE: [PATCH] drm/i915/dpt: Restrict shrinker to DPT objects not mapped

Quoted 42 lines

-----Original Message-----
From: Ville Syrjälä <[email protected]>
Sent: 23 November 2024 04:18
To: Srinivas, Vidya <[email protected]>
Cc: [email protected]; Syrjala, Ville <[email protected]>; [email protected]; Lee, Shawn C <[email protected]>
Subject: Re: [PATCH] drm/i915/dpt: Restrict shrinker to DPT objects not mapped

Quoted 20 lines · Vidya Srinivas

Restricting all DPT objects as unshrinkable was causing some chromebooks to run out of memory causing DMA remap failures. Thanks to Brian Geffon for the pointers on debug and suggesting usage of !obj->mm.mapping

Fixes 43e2b37e2ab6 ("drm/i915/dpt: Make DPT object unshrinkable")

Credits-to: Brian Geffon <[email protected]>

---
 drivers/gpu/drm/i915/gem/i915_gem_object.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/gem/i915_gem_object.h +0 -0
index 3dc61cbd2e11..b155f0139d4e 100644

drivers/gpu/drm/i915/gem/i915_gem_object.h i915_gem_object_is_shrinkable(const struct · line 287

Quoted 3 lines
drivers/gpu/drm/i915/gem/i915_gem_object.h +0 -0
@@ -285,7 +285,7 @@ i915_gem_object_is_shrinkable(const struct
 drm_i915_gem_object *obj)  {
 	/* TODO: make DPT shrinkable when it has no bound vmas */
 	return i915_gem_object_type_has(obj,

I915_GEM_OBJECT_IS_SHRINKABLE) &&

drivers/gpu/drm/i915/gem/i915_gem_object.h i915_gem_object_is_shrinkable(const struct drm_i915_gem_object *obj) · line 288

Quoted 2 lines
drivers/gpu/drm/i915/gem/i915_gem_object.h +1 -1
-		!obj->is_dpt;
+		!(obj->is_dpt && obj->mm.mapping);

AFAICS the mapping could only become NULL if the DPT got evicted from the GGTT, but if that can happen then I think the current code must still be busted wrt. suspend/resume even with the unshrinkable DPT obj.

Quoted 7 lines

Looking at the vma suspend stuff I think the only way something could still be bound in the DPT during resume is if it was pinned during suspend. But we should be unpinning all FBs during suspend, so that's a bit weird in itself. Hmm, we do the unpinning from the cleanup_work so maybe that's still pending when we suspend and thus something is still pinned in the DPT. And indeed there is no flush_work()/etc. for that. So perhaps if we add that we could just revert the unshrinkable DPT

Quoted 5 lines

patch.

Quoted 1 line

Hello Ville,
Thank you so much. Yes, Google team also insist on that as they worry the DPT patch might just be a workaround for the real memory corruption.

Sorry, just to be clear. With the DPT patch (43e2b37e2ab6 "drm/i915/dpt: Make DPT object unshrinkable"), Maybe its not that mapping became NULL. But since all DPT objs are unshrinkable, they are hitting low memory which is probably causing DMA remap failure when memory is trying to be cleared.
"i915 0000:00:02.0: Failed to DMA remap 147457 pages"

BUG: Bad page state in process chrome  pfn:14200
page dumped because: non-NULL mapping

So their suggestion initially was to try and use !obj->is_dpt || !obj->mm.mapping as well so that shrinker could clear some more.
However as you mentioned, if we could do something and revert the DPT patch entirely, it would be really very helpful

Quoted 8 lines
Quoted 5 lines

Did we have a good way to reproduce the resume explosion? If not, I suppose we could try to confirm the lack of flush_work() as the culprit by simply sticking some kind of sleep() into the cleanup function to make sure it doesn't get a chance to run during suspend.

We can reproduce the original issue where during the suspend/resume, the meteorlake chromebook goes for a reboot and we have the crash captured from console-ramoops.

For this, I meant we have a reproduction WITHOUT the DPT patch 43e2b37e2ab6. But, we don't have reproduction at Intel for the "DMA remap failed case"while having the unshrinkable DPT 43e2b37e2ab6 "drm/i915/dpt: Make DPT object unshrinkable" So, we could try reproducing the original issue and try with the pointers you have provided.

Quoted 22 lines
Quoted 8 lines

I also had this:
https://patchwork.freedesktop.org/patch/503398/?series=108669&rev=1
which would be good to have so that we can actully do the obvious flush_work(cleanup_work) instead of playing confusing tricks with the the commit_work.

Thank you so much. Will try this patch as well and update.

Regards
Vidya

Quoted 9 lines
Quoted 5 lines
drivers/gpu/drm/i915/gem/i915_gem_object.h +0 -1
 }
 
 static inline bool
--

2.34.1

--
Ville Syrjälä
Intel

#6 lore raw
Quoted 102 lines

-----Original Message-----
From: Srinivas, Vidya
Sent: 23 November 2024 10:14
To: Ville Syrjälä <[email protected]>
Cc: [email protected]; Syrjala, Ville <[email protected]>; [email protected]; Lee, Shawn C <[email protected]>
Subject: RE: [PATCH] drm/i915/dpt: Restrict shrinker to DPT objects not mapped

Quoted 53 lines

-----Original Message-----
From: Srinivas, Vidya
Sent: 23 November 2024 09:39
To: Ville Syrjälä <[email protected]>
Cc: [email protected]; Syrjala, Ville <[email protected]>; [email protected]; Lee, Shawn C <[email protected]>
Subject: RE: [PATCH] drm/i915/dpt: Restrict shrinker to DPT objects not mapped

Quoted 41 lines

-----Original Message-----
From: Ville Syrjälä <[email protected]>
Sent: 23 November 2024 04:18
To: Srinivas, Vidya <[email protected]>
Cc: [email protected]; Syrjala, Ville <[email protected]>; [email protected]; Lee, Shawn C <[email protected]>
Subject: Re: [PATCH] drm/i915/dpt: Restrict shrinker to DPT objects not mapped

Quoted 20 lines · Vidya Srinivas

Restricting all DPT objects as unshrinkable was causing some chromebooks to run out of memory causing DMA remap failures. Thanks to Brian Geffon for the pointers on debug and suggesting usage of !obj->mm.mapping

Fixes 43e2b37e2ab6 ("drm/i915/dpt: Make DPT object unshrinkable")

Credits-to: Brian Geffon <[email protected]>

---
 drivers/gpu/drm/i915/gem/i915_gem_object.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/gem/i915_gem_object.h +0 -0
index 3dc61cbd2e11..b155f0139d4e 100644

drivers/gpu/drm/i915/gem/i915_gem_object.h i915_gem_object_is_shrinkable(const struct · line 287

Quoted 3 lines
drivers/gpu/drm/i915/gem/i915_gem_object.h +0 -0
@@ -285,7 +285,7 @@ i915_gem_object_is_shrinkable(const struct
 drm_i915_gem_object *obj)  {
 	/* TODO: make DPT shrinkable when it has no bound vmas */
 	return i915_gem_object_type_has(obj,

I915_GEM_OBJECT_IS_SHRINKABLE) &&

drivers/gpu/drm/i915/gem/i915_gem_object.h i915_gem_object_is_shrinkable(const struct drm_i915_gem_object *obj) · line 288

Quoted 2 lines
drivers/gpu/drm/i915/gem/i915_gem_object.h +1 -1
-		!obj->is_dpt;
+		!(obj->is_dpt && obj->mm.mapping);

AFAICS the mapping could only become NULL if the DPT got evicted from the GGTT, but if that can happen then I think the current code must still be busted wrt. suspend/resume even with the unshrinkable DPT

obj.

Quoted 9 lines
Quoted 9 lines

Looking at the vma suspend stuff I think the only way something could still be bound in the DPT during resume is if it was pinned during suspend. But we should be unpinning all FBs during suspend, so that's a bit weird in itself. Hmm, we do the unpinning from the cleanup_work so maybe that's still pending when we suspend and thus something is still pinned in the DPT. And indeed there is no flush_work()/etc. for that. So perhaps if we add that we could just revert the unshrinkable DPT

Quoted 5 lines

patch.

Quoted 1 line

Hello Ville,
Thank you so much. Yes, Google team also insist on that as they worry the DPT patch might just be a workaround for the real memory corruption.

Sorry, just to be clear. With the DPT patch (43e2b37e2ab6 "drm/i915/dpt: Make DPT object unshrinkable"), Maybe its not that mapping became NULL. But since all DPT objs are unshrinkable, they are hitting low memory which is probably causing DMA remap failure when memory is trying to be cleared. "i915 0000:00:02.0: Failed to DMA remap 147457 pages"

BUG: Bad page state in process chrome  pfn:14200 page dumped because: non-

NULL mapping

So their suggestion initially was to try and use !obj->is_dpt || !obj-

Quoted 1 line

mm.mapping as well so that shrinker could clear some more.

However as you mentioned, if we could do something and revert the DPT patch entirely, it would be really very helpful

Quoted 8 lines
Quoted 5 lines

Did we have a good way to reproduce the resume explosion? If not, I suppose we could try to confirm the lack of flush_work() as the culprit by simply sticking some kind of sleep() into the cleanup function to make sure it doesn't get a chance to run during suspend.

We can reproduce the original issue where during the suspend/resume, the meteorlake chromebook goes for a reboot and we have the crash captured from console-ramoops.

Quoted 16 lines

For this, I meant we have a reproduction WITHOUT the DPT patch 43e2b37e2ab6.
But, we don't have reproduction at Intel for the "DMA remap failed case"while having the unshrinkable DPT 43e2b37e2ab6 "drm/i915/dpt: Make DPT object unshrinkable"
So, we could try reproducing the original issue and try with the pointers you have provided.

Quoted 9 lines
Quoted 8 lines

I also had this:
https://patchwork.freedesktop.org/patch/503398/?series=108669&rev=1
which would be good to have so that we can actully do the obvious flush_work(cleanup_work) instead of playing confusing tricks with the the commit_work.

Thank you so much. Will try this patch as well and update.

Hello Ville,
Tried your patch https://patchwork.freedesktop.org/patch/503398/?series=108669&rev=1
with reverted DPT patch but the original suspend/resume issue was still seen.

Just tried to check a bit more on the i915_ggtt_suspend_vm
If the VMA is bound (i915_vma_is_bound), it wasn't hitting __i915_vma_evict Could that be any reason? Have pushed a RFC patch just to seek your opinion
https://patchwork.freedesktop.org/patch/625967/
Somehow with this patch, couldn't reproduce the suspend/resume issue (yet). However, am not very sure of the consequences of these changes. Could you kindly have a check and suggest please? Thank you so much.

Regards
Vidya

Quoted 13 lines
Quoted 13 lines

Regards
Vidya

Quoted 9 lines
Quoted 5 lines
drivers/gpu/drm/i915/gem/i915_gem_object.h +0 -1
 }
 
 static inline bool
--

2.34.1

--
Ville Syrjälä
Intel