Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] drm/xe: -EAGAIN in xe_pm_runtime_suspend() self-retriggers OOM retry storm --
commit 432d67d7cb644bed2d1d62b6cc14bc747772f450 Author: Thomas Hellström <[email protected]> drm/xe: Don't fail runtime suspend permanently on VRAM eviction -ENOMEM This commit converts -ENOMEM returned by xe_bo_evict_all() during D3cold runtime suspend into -EAGAIN so the runtime PM core does not record a permanent runtime error on the device. > diff --git a/drivers/gpu/drm/xe/xe_pm.c b/drivers/gpu/drm/xe/xe_pm.c > index 103290fd6445c..f1dc97afb72a2 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; > + } > } [Severity: Medium] Can returning -EAGAIN here trigger an unbounded runtime suspend retry loop while the GPU is idle under persistent memory pressure? During xe_bo_evict_all(), evicting a BO on xe->pinned.late.external or xe->pinned.late.kernel_bo_present submits a migration job via xe_sched_job_create(), which calls xe_pm_runtime_get_noresume(). If a later pinned BO hits -ENOMEM, xe_bo_evict_all_undo() discards all new backups. When that migration job finishes, drm_sched_free_job_work() runs on the scheduler submit_wq worker and calls xe_sched_job_destroy() -> xe_pm_runtime_put(). Because current is not xe->pm_callback_task, it calls pm_runtime_mark_last_busy() and pm_runtime_put() instead of the noidle path. Because -EAGAIN leaves dev->power.runtime_error clear, that off-thread put either refreshes last_busy before rpm_suspend() checks autosuspend expiration or drops usage_count to zero after RPM_ACTIVE is restored and queues RPM_REQ_IDLE. Either way, autosuspend re-arms every autosuspend_delay_ms. Each retry drives repeated __GFP_RETRY_MAYFAIL reclaim on a memory-starved host, submits GPU copies whose backups are immediately undone, and runs full display D3cold teardown and re-init via xe_display_disable_d3cold(). Falling back to D3hot on -ENOMEM would avoid this self-retriggering loop. -- Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
