From: sashiko-bot@kernel.org
To: "Riana Tauro" <riana.tauro@intel.com>, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v3] drm/xe/sysctrl: Drain page offline queue on queue-full event
Date: Tue, 24 Nov 2026 14:04:05 +0000 [thread overview]
Message-ID: <sashiko-outbox-231296@kernel.org> (raw)
In-Reply-To: <20261124134323.1529876-2-riana.tauro@intel.com>
Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Medium] drm/xe/ras: ignored handle_page_offline() error in
process_offline_pages()
- [Medium] drm/xe/sysctrl: xa_node leak in xe_ras_get_offline_queue() on
teardown
- [Medium] drm/xe/ras: race in handle_page_offline() between sysctrl and
hw_error workers
--
commit 0742a26c8b6bd03e3b9869cb12c67ca9f93c1626
Author: Riana Tauro <riana.tauro@intel.com>
drm/xe/sysctrl: Drain page offline queue on queue-full event
This commit exposes xe_ras_get_offline_queue() and invokes it when the
System Controller reports XE_SYSCTRL_EVENT_PAGE_OFFLINE_QUEUE_FULL so the
driver drains the firmware page offline queue at runtime.
> diff --git a/drivers/gpu/drm/xe/xe_ras.c b/drivers/gpu/drm/xe/xe_ras.c
> index b35c77caeaae4..4014945b47bae 100644
> --- a/drivers/gpu/drm/xe/xe_ras.c
> +++ b/drivers/gpu/drm/xe/xe_ras.c
> @@ -483,11 +483,13 @@ static void process_offline_pages(struct xe_device *xe, u32 cmd, void *req, size
> } while (common->additional_data);
> }
>
> -/*
> - * Retrieve firmware queued pages from warm-retained SRAM during probe. Handle and soft-offline
> - * each page as required.
> +/**
> + * xe_ras_get_offline_queue() - Drain page offline queue
> + * @xe: xe device instance
> + *
> + * Retrieve firmware queued pages from warm-retained SRAM and process each page as required.
> */
> -static void get_offline_queue(struct xe_device *xe)
> +void xe_ras_get_offline_queue(struct xe_device *xe)
[Severity: Medium]
Should process_offline_pages() check the return value of
handle_page_offline() and wedge the device on failure?
Previously get_offline_queue() only ran during xe_ras_init() at probe time,
before VRAM BOs were allocated. Calling xe_ras_get_offline_queue() at
runtime means a queued address can belong to an active kernel BO or pinned
user BO, causing handle_page_offline() to return -EIO before notifying
firmware:
drivers/gpu/drm/xe/xe_ras.c:process_offline_pages() {
...
for (i = 0; i < common->pages_returned && i < XE_RAS_NUM_PAGES; i++) {
handle_page_offline(xe, common->page_addresses[i], notify_fw);
...
}
Unlike handle_device_memory_errors(), which calls
xe_wedge_declare(xe, DRM_WEDGE_RECOVERY_BUS_RESET) when
handle_page_offline() fails, process_offline_pages() drops the error and
leaves the device running with a poisoned BO while the page remains in the
firmware queue.
[ ... ]
> diff --git a/drivers/gpu/drm/xe/xe_sysctrl_event.c b/drivers/gpu/drm/xe/xe_sysctrl_event.c
> index 3239c110a66a7..fed85e4fee6d0 100644
> --- a/drivers/gpu/drm/xe/xe_sysctrl_event.c
> +++ b/drivers/gpu/drm/xe/xe_sysctrl_event.c
> @@ -37,11 +37,17 @@ static void get_pending_event(struct xe_sysctrl *sc, struct xe_sysctrl_mailbox_c
> return;
> }
>
> - if (response->event == XE_SYSCTRL_EVENT_THRESHOLD_CROSSED)
> + switch (response->event) {
> + case XE_SYSCTRL_EVENT_THRESHOLD_CROSSED:
> xe_ras_counter_threshold_crossed(xe, response);
> - else
> + break;
> + case XE_SYSCTRL_EVENT_PAGE_OFFLINE_QUEUE_FULL:
> + xe_ras_get_offline_queue(xe);
> + break;
[Severity: Medium]
Can xe_ras_get_offline_queue() leak XArray nodes in
xe->ras.state.offlined_pages during device teardown?
In xe_device_probe(), xe_sysctrl_init() registers sysctrl_fini() before
xe_ras_init() registers ras_fini(), so devres teardown runs ras_fini()
before sysctrl_fini() disables sc->work:
CPU0 (devres release) CPU1 (sc->work)
irq_uninstall()
ras_fini()
xa_destroy(&state->offlined_pages)
xe_sysctrl_work()
...
xe_ras_get_offline_queue()
...
send_page_offline_cmd()
xa_store(&state->offlined_pages, ...)
<-- allocates into destroyed XArray
sysctrl_fini()
disable_work_sync(&sc->work)
Any XArray nodes allocated by xa_store() in that window are leaked because
ras_fini() has already completed.
[Severity: Medium]
What serializes handle_page_offline() when sc->work and tile->hw_error_work
process the same page address concurrently?
get_pending_event() runs from sc->work under sc->event_lock, while
tile->hw_error_work calls xe_ras_process_errors() ->
handle_device_memory_errors() -> handle_page_offline() without holding
sc->event_lock or any RAS page-offlining lock:
CPU0 (sc->work) CPU1 (tile->hw_error_work)
xe_ras_get_offline_queue() handle_device_memory_errors()
... handle_page_offline(xe, addr, true)
handle_page_offline(xe, addr, true)
xe_ttm_vram_handle_addr_fault()
-> -EEXIST
xe_ttm_vram_handle_addr_fault()
-> -EEXIST
xa_load(&state->offlined_pages)
-> NULL
xa_load(&state->offlined_pages)
-> NULL
send_page_offline_cmd(..., OFFLINE)
send_page_offline_cmd(..., OFFLINE)
<-- duplicate OFFLINE command
Because xe_ttm_vram_handle_addr_fault() drops vram_mgr->lock before
handle_page_offline() checks state->offlined_pages and send_page_offline_cmd()
only records XE_RAS_PAGE_OFFLINED after the mailbox command completes, both
workers can send XE_RAS_PAGE_ACTION_OFFLINE for the same page (or a second
occurrence can send XE_RAS_PAGE_ACTION_OFFLINE before the first occurrence
finishes xe_ttm_vram_purge_page() and sends XE_RAS_PAGE_ACTION_REMOVE). If
firmware rejects the duplicate or out-of-order command,
handle_device_memory_errors() wedges the device with
DRM_WEDGE_RECOVERY_BUS_RESET.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261124134323.1529876-2-riana.tauro@intel.com?part=1
prev parent reply other threads:[~2026-11-24 14:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 13:43 [PATCH v3] drm/xe/sysctrl: Drain page offline queue on queue-full event Riana Tauro
2026-11-24 14:04 ` sashiko-bot [this message]
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-231296@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=riana.tauro@intel.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox