[PATCH] drm/xe/pm: do not warn about missing runtime PM protection after hot-unplug

Nitin Gote <[email protected]> Thu, 30 Jul 2026 11:06:36 +0530
Newsgroups org.freedesktop.lists.intel-xe
Message-ID <[email protected]>
After hot-unplug, device_del() disables runtime PM. A deferred fd close
can still run later during process exit and destroy remaining exec queues,
which may call xe_pm_runtime_get_noresume().

At this point pm_runtime_get_if_in_use() fails because runtime PM has
already been disabled, so xe_pm_runtime_get_noresume() warns with
"Missing outer runtime PM protection". This is expected after hot-unplug
and does not indicate a missing outer runtime PM guard from the caller.

Skip the warning when the DRM device is already unplugged.

Observed with new IGT core_hotunplug subtests:
  igt@core_hotunplug@hotreplug-with-load
  igt@core_hotunplug@hotunplug-rescan-with-load

v2: Drop the drm_dev_is_unplugged() bypass from guc_exec_queue_destroy()
    and instead exclude hot-unplug from the WARN in
    xe_pm_runtime_get_noresume(). (Matthew Brost)

Link: https://patchwork.freedesktop.org/patch/725773/?series=166744&rev=4
Cc: Matthew Brost <[email protected]>
Cc: Matthew Auld <[email protected]>
Assisted-by: GitHub-Copilot:claude-sonnet-4.6
Signed-off-by: Nitin Gote <[email protected]>
---
 drivers/gpu/drm/xe/xe_pm.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/xe_pm.c b/drivers/gpu/drm/xe/xe_pm.c
index a5289a9df8d2..a038687d5b2c 100644
--- a/drivers/gpu/drm/xe/xe_pm.c
+++ b/drivers/gpu/drm/xe/xe_pm.c
@@ -10,6 +10,7 @@
 #include <linux/suspend.h>
 #include <linux/dmi.h>
 
+#include <drm/drm_drv.h>
 #include <drm/drm_managed.h>
 #include <drm/ttm/ttm_placement.h>
 
@@ -914,7 +915,9 @@ void xe_pm_runtime_get_noresume(struct xe_device *xe)
 
 	if (!ref) {
 		pm_runtime_get_noresume(xe->drm.dev);
-		drm_WARN(&xe->drm, !xe_pm_suspending_or_resuming(xe),
+		drm_WARN(&xe->drm,
+			 !drm_dev_is_unplugged(&xe->drm) &&
+			 !xe_pm_suspending_or_resuming(xe),
 			 "Missing outer runtime PM protection\n");
 	}
 }
-- 
2.50.1