From: sashiko-bot@kernel.org
To: "Arisa Snowbell" <arisa.snowbell@gmail.com>,
intel-xe@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org, media-ci@linuxtv.org
Subject: Re: [PATCH 4/5] drm/xe: hold video decode work and HuC queries for a pending DG2 HuC load
Date: Thu, 26 Nov 2026 21:12:31 +0000 [thread overview]
Message-ID: <sashiko-outbox-236214@kernel.org> (raw)
In-Reply-To: <20261126205758.49845-5-arisa.snowbell@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] drm/xe: race in query_uc_fw_version() during GT reset returns
-ENODEV
- [Medium] drm/xe: video decode jobs miss post-reset HuC load fence in
xe_exec_ioctl()
--
commit 5dc281ce1c152eb029eef3dac3ecc0b42e37b1fb
Author: Arisa Snowbell <arisa.snowbell@gmail.com>
drm/xe: hold video decode work and HuC queries for a pending DG2 HuC load
This commit adds a dependency on the pending DG2 HuC MEI load fence for
video decode jobs in xe_exec_ioctl() and waits for that fence in
query_uc_fw_version() before reporting the HuC firmware version.
> diff --git a/drivers/gpu/drm/xe/xe_exec.c b/drivers/gpu/drm/xe/xe_exec.c
> index 0e6a197a8e85e..020dc78948910 100644
> --- a/drivers/gpu/drm/xe/xe_exec.c
> +++ b/drivers/gpu/drm/xe/xe_exec.c
[ ... ]
> @@ -334,6 +336,17 @@ int xe_exec_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
> if (err)
> goto err_put_job;
>
> + /* as on i915, video decode must not run before a pending HuC load */
> + if (q->class == XE_ENGINE_CLASS_VIDEO_DECODE) {
> + struct dma_fence *huc_load = xe_huc_mei_load_fence(&q->gt->uc.huc);
> +
> + if (huc_load) {
> + err = drm_sched_job_add_dependency(&job->drm, huc_load);
> + if (err)
> + goto err_put_job;
> + }
> + }
> +
> if (!xe_vm_in_lr_mode(vm)) {
> err = xe_svm_notifier_lock_interruptible(vm);
> if (err)
[Severity: Medium]
Can video decode jobs still run before the post-reset HuC load finishes if
a GT reset occurs?
CPU0 (gt_reset_worker) CPU1
xe_uc_stop_prepare()
xe_huc_mei_stop()
huc_mei_go_down()
huc_mei_settle_locked()
mei->state = XE_HUC_MEI_DOWN
mei->load = NULL
xe_uc_stop()
do_gt_reset()
do_gt_restart()
xe_exec_ioctl()
xe_huc_mei_load_fence() -> NULL
xe_sched_job_push(job)
xe_uc_load_hw()
xe_huc_auth()
xe_huc_mei_start()
mei->state = XE_HUC_MEI_LOADING
queue_work(..., &mei->auth)
xe_uc_start()
...
guc_exec_queue_start() <-- job runs before mei->auth finishes
At the start of a GT reset, huc_mei_go_down() signals any pre-reset
mei->load fence and sets mei->state to XE_HUC_MEI_DOWN until
xe_huc_mei_start() runs at the end of xe_uc_load_hw(). During that window
xe_huc_mei_load_fence() returns NULL, so jobs submitted in xe_exec_ioctl()
acquire no fence dependency, and jobs already queued in q->entity or
replayed from sched->pending_list had their pre-reset fence signaled.
When xe_uc_start() restarts the queue schedulers immediately after
xe_huc_mei_start(), those video decode jobs are submitted to the GuC
before the asynchronous HuC load completes.
> diff --git a/drivers/gpu/drm/xe/xe_query.c b/drivers/gpu/drm/xe/xe_query.c
> index 9cc35fc83954f..696bae5eea3b3 100644
> --- a/drivers/gpu/drm/xe/xe_query.c
> +++ b/drivers/gpu/drm/xe/xe_query.c
[ ... ]
> @@ -619,6 +621,9 @@ query_uc_fw_version(struct xe_device *xe, struct drm_xe_device_query *query)
> break;
>
> huc = &media_gt->uc.huc;
> + ret = xe_huc_mei_wait(huc);
> + if (ret)
> + return ret;
> if (huc->fw.status == XE_UC_FIRMWARE_RUNNING)
> version = &huc->fw.versions.found[XE_UC_FW_VER_RELEASE];
> break;
[Severity: Medium]
Can query_uc_fw_version() still return -ENODEV during a GT reset instead
of waiting for the post-reset HuC load?
CPU0 (gt_reset_worker) CPU1
xe_uc_stop_prepare()
xe_huc_mei_stop()
huc_mei_go_down()
huc_mei_settle_locked()
mei->state = XE_HUC_MEI_DOWN
mei->load = NULL
...
do_gt_restart()
xe_uc_sanitize_reset()
...
huc->fw.status = XE_UC_FIRMWARE_LOADABLE
query_uc_fw_version()
xe_huc_mei_wait()
xe_huc_mei_load_fence() -> NULL
huc->fw.status != XE_UC_FIRMWARE_RUNNING
return -ENODEV
xe_uc_load_hw()
xe_huc_auth()
xe_huc_mei_start()
Between xe_huc_mei_stop() and xe_huc_mei_start(), mei->state is
XE_HUC_MEI_DOWN and xe_huc_mei_load_fence() returns NULL:
drivers/gpu/drm/xe/xe_huc_mei.c:xe_huc_mei_load_fence() {
guard(spinlock_irqsave)(&mei->state_lock);
if (mei->state != XE_HUC_MEI_LOADING || !mei->load)
return NULL;
return dma_fence_get(mei->load);
}
Meanwhile xe_uc_sanitize_reset() resets huc->fw.status to
XE_UC_FIRMWARE_LOADABLE before xe_uc_load_hw() uploads GuC firmware and
calls xe_huc_mei_start(). A query running in that window (or woken early
when huc_mei_go_down() signals a pre-reset load fence) returns 0 from
xe_huc_mei_wait(), sees huc->fw.status != XE_UC_FIRMWARE_RUNNING, and
returns -ENODEV to userspace.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261126205758.49845-2-arisa.snowbell@gmail.com?part=4
next prev parent reply other threads:[~2026-11-26 21:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 20:57 [PATCH 0/5] drm/xe: load the DG2 HuC through the GSC via mei_pxp Arisa Snowbell
2026-11-26 20:57 ` [PATCH 1/5] drm/xe/heci: expose the DG2 HECI1 interface to mei Arisa Snowbell
2026-11-26 20:57 ` [PATCH 2/5] mei: gsc: bind the xe HECI1 device Arisa Snowbell
2026-11-26 20:57 ` [PATCH 3/5] drm/xe/huc: load the DG2 HuC through the GSC via mei_pxp Arisa Snowbell
2026-11-26 21:23 ` sashiko-bot
2026-12-02 1:38 ` Ceraolo Spurio, Daniele
2026-11-26 20:57 ` [PATCH 4/5] drm/xe: hold video decode work and HuC queries for a pending DG2 HuC load Arisa Snowbell
2026-11-26 21:12 ` sashiko-bot [this message]
2026-11-26 20:57 ` [PATCH 5/5] drm/xe/uc_fw: select the DG2 HuC blob for a load by the GSC Arisa Snowbell
2026-11-30 15:51 ` ✗ LGCI.VerificationFailed: failure for drm/xe: load the DG2 HuC through the GSC via mei_pxp 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=sashiko-outbox-236214@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=arisa.snowbell@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=media-ci@linuxtv.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.