If evicting VRAM to system memory fails with -ENOMEM during runtime
suspend to D3cold, the error is returned to the runtime PM core.
Runtime PM treats any error other than -EAGAIN or -EBUSY from the
->runtime_suspend() callback as fatal, records it in
dev->power.runtime_error, and refuses further runtime PM operations
on the device until the error is cleared.
Memory shortage is a transient condition. Backup objects for pinned
BOs are already allocated with __GFP_RETRY_MAYFAIL, and a following
patch makes eviction of non-pinned BOs use it as well, which makes
-ENOMEM more likely to occur. Convert -ENOMEM from the eviction to
-EAGAIN so that the device stays active and runtime suspend is retried
at a later idle transition.
Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
Cc: Matthew Brost <[email protected]>
Cc: Rodrigo Vivi <[email protected]>
Cc: [email protected]
Cc: <[email protected]> # v6.8+
Reviewed-by: Rodrigo Vivi <[email protected]>
Signed-off-by: Thomas Hellström <[email protected]>
---
drivers/gpu/drm/xe/xe_pm.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/xe/xe_pm.c b/drivers/gpu/drm/xe/xe_pm.c
index 103290fd6445..f1dc97afb72a 100644
--- a/drivers/gpu/drm/xe/xe_pm.c
+++ b/drivers/gpu/drm/xe/xe_pm.c
@@ -581,8 +581,16 @@ int xe_pm_runtime_suspend(struct xe_device *xe)
if (xe->d3cold.allowed) {
err = xe_bo_evict_all(xe);
- if (err)
+ if (err) {
+ /*
+ * Runtime PM treats errors other than -EAGAIN and
+ * -EBUSY as fatal, so report memory shortage as
+ * transient to allow a later retry.
+ */
+ if (err == -ENOMEM)
+ err = -EAGAIN;
goto out_resume;
+ }
}
for_each_gt(gt, xe, id) {
--
2.56.1