From: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
To: intel-xe@lists.freedesktop.org
Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
"Matthew Brost" <matthew.brost@intel.com>,
"Francois Dugast" <francois.dugast@intel.com>,
"Matthew Auld" <matthew.auld@intel.com>,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>
Subject: [PATCH 3/4] drm/xe: Restore userspace LRC BOs early on resume
Date: Thu, 21 May 2026 16:48:36 +0200 [thread overview]
Message-ID: <20260521144837.7363-4-thomas.hellstrom@linux.intel.com> (raw)
In-Reply-To: <20260521144837.7363-1-thomas.hellstrom@linux.intel.com>
When GuC registers a context (REGISTER_CONTEXT G2H action), the LRC
buffer object must already be present in VRAM with valid content.
Userspace LRC BOs currently carry XE_BO_FLAG_PINNED_LATE_RESTORE, which
defers their restore to xe_bo_restore_late() — a blitter copy that runs
after xe_gt_resume(). However, xe_gt_resume() itself calls
xe_guc_submit_start(), which drives guc_exec_queue_start() ->
xe_sched_resubmit_jobs() -> guc_exec_queue_run_job() ->
register_exec_queue(), all before xe_bo_restore_late() has had a chance
to repopulate the BO. The result is that GuC reads LRC state from
uninitialised VRAM and raises an exception.
Fix this by dropping XE_BO_FLAG_PINNED_LATE_RESTORE from the userspace
LRC BO flags. Without that flag, the BO lands in the
pinned.early.kernel_bo_present list and is restored by
xe_bo_restore_early() via CPU/BAR copy before xe_gt_resume() is entered.
By the time any context registration fires the LRC VRAM is valid.
xe_bo_create_pin_map_novm() already adds XE_BO_FLAG_NEEDS_CPU_ACCESS and
XE_BO_FLAG_PINNED, satisfying the requirements of the CPU copy path.
Dropping XE_BO_FLAG_PINNED_LATE_RESTORE also makes force_contiguous()
return true for these BOs (PINNED without LATE_RESTORE), which is already
required for the GGTT mapping they carry.
Assisted-by: GitHub_Copilot:claude-sonnet-4.6
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
---
drivers/gpu/drm/xe/xe_lrc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/xe/xe_lrc.c b/drivers/gpu/drm/xe/xe_lrc.c
index a4292a11391d..c9ea5a3e5365 100644
--- a/drivers/gpu/drm/xe/xe_lrc.c
+++ b/drivers/gpu/drm/xe/xe_lrc.c
@@ -1661,7 +1661,7 @@ static int xe_lrc_init(struct xe_lrc *lrc, struct xe_hw_engine *hwe, struct xe_v
XE_BO_FLAG_GGTT_INVALIDATE;
if ((vm && vm->xef) || init_flags & XE_LRC_CREATE_USER_CTX) /* userspace */
- bo_flags |= XE_BO_FLAG_PINNED_LATE_RESTORE | XE_BO_FLAG_FORCE_USER_VRAM;
+ bo_flags |= XE_BO_FLAG_FORCE_USER_VRAM;
bo = xe_bo_create_pin_map_novm(xe, tile, bo_size,
ttm_bo_type_kernel,
--
2.54.0
next prev parent reply other threads:[~2026-05-21 14:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-21 14:48 [PATCH 0/4] drm/xe: Fix LR exec queue suspend/resume for S3/S4 Thomas Hellström
2026-05-21 14:48 ` [PATCH 1/4] drm/xe/guc: Add suspend refcount to exec queue ops Thomas Hellström
2026-05-21 14:48 ` [PATCH 2/4] drm/xe/guc: Don't ban LR VM exec queues on PM suspend Thomas Hellström
2026-05-21 14:48 ` Thomas Hellström [this message]
2026-05-21 16:09 ` [PATCH 3/4] drm/xe: Restore userspace LRC BOs early on resume Matthew Auld
2026-05-21 16:31 ` Thomas Hellström
2026-05-22 9:51 ` Thomas Hellström
2026-05-22 10:05 ` Matthew Auld
2026-05-21 14:48 ` [PATCH 4/4] drm/xe: Suspend fault-mode LR jobs before VRAM eviction on S3/S4 Thomas Hellström
2026-05-21 14:56 ` ✓ CI.KUnit: success for drm/xe: Fix LR exec queue suspend/resume for S3/S4 Patchwork
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=20260521144837.7363-4-thomas.hellstrom@linux.intel.com \
--to=thomas.hellstrom@linux.intel.com \
--cc=francois.dugast@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=matthew.auld@intel.com \
--cc=matthew.brost@intel.com \
--cc=rodrigo.vivi@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