Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Nitin Gote <nitin.r.gote@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: Nitin Gote <nitin.r.gote@intel.com>,
	Matthew Auld <matthew.auld@intel.com>
Subject: [PATCH] drm/xe/guc: skip CLEANUP message when device is hot-unplugged
Date: Tue, 28 Jul 2026 20:54:53 +0530	[thread overview]
Message-ID: <20260728152452.1129581-2-nitin.r.gote@intel.com> (raw)

When a device is hot-unplugged while a DRM fd with active exec queues is
still open, the fd close path runs during process exit and calls
guc_exec_queue_destroy(). This queues a CLEANUP message via
guc_exec_queue_add_msg(), which internally calls
xe_pm_runtime_get_noresume().

After hot-unplug, pm_runtime_disable() has already been called, so
xe_pm_runtime_get_noresume() warns with "Missing outer runtime PM
protection".

GuC communication is no longer valid after unplug, so skip the CLEANUP
message and destroy the exec queue locally via __guc_exec_queue_destroy().

Observed with new IGT core_hotunplug subtests:

  igt@core_hotunplug@hotreplug-with-load
  igt@core_hotunplug@hotunplug-rescan-with-load

Link: https://patchwork.freedesktop.org/series/166744/
Cc: Matthew Auld <matthew.auld@intel.com>
Assisted-by: GitHub-Copilot:claude-sonnet-4.6
Signed-off-by: Nitin Gote <nitin.r.gote@intel.com>
---
 drivers/gpu/drm/xe/xe_guc_submit.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_guc_submit.c b/drivers/gpu/drm/xe/xe_guc_submit.c
index 8aaed4fd13ea..b5035c19d7b0 100644
--- a/drivers/gpu/drm/xe/xe_guc_submit.c
+++ b/drivers/gpu/drm/xe/xe_guc_submit.c
@@ -2131,12 +2131,15 @@ static bool guc_exec_queue_try_add_msg(struct xe_exec_queue *q,
 #define STATIC_MSG_RESUME	2
 static void guc_exec_queue_destroy(struct xe_exec_queue *q)
 {
+	struct xe_guc *guc = exec_queue_to_guc(q);
 	struct xe_sched_msg *msg = q->guc->static_msgs + STATIC_MSG_CLEANUP;
 
-	if (!(q->flags & EXEC_QUEUE_FLAG_PERMANENT) && !exec_queue_wedged(q))
+	/* If the device has been hot-unplugged the GuC is already gone. */
+	if (!(q->flags & EXEC_QUEUE_FLAG_PERMANENT) && !exec_queue_wedged(q) &&
+	    !drm_dev_is_unplugged(&guc_to_xe(guc)->drm))
 		guc_exec_queue_add_msg(q, msg, CLEANUP);
 	else
-		__guc_exec_queue_destroy(exec_queue_to_guc(q), q);
+		__guc_exec_queue_destroy(guc, q);
 }
 
 static int guc_exec_queue_set_priority(struct xe_exec_queue *q,
-- 
2.50.1


             reply	other threads:[~2026-07-28 14:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-28 15:24 Nitin Gote [this message]
2026-07-28 14:54 ` ✓ CI.KUnit: success for drm/xe/guc: skip CLEANUP message when device is hot-unplugged Patchwork
2026-07-28 15:32 ` ✓ Xe.CI.BAT: " Patchwork
2026-07-28 18:48 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-07-28 20:20 ` [PATCH] " Matthew Brost
2026-07-29 11:05   ` Gote, Nitin R

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260728152452.1129581-2-nitin.r.gote@intel.com \
    --to=nitin.r.gote@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.auld@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox