From: sashiko-bot@kernel.org
To: "Umesh Nerlige Ramappa" <umesh.nerlige.ramappa@intel.com>,
intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v7 4/7] drm/xe/oa: Skip OA HW teardown on a wedged device
Date: Wed, 18 Nov 2026 03:25:33 +0000 [thread overview]
Message-ID: <sashiko-outbox-220010@kernel.org> (raw)
In-Reply-To: <20261118025140.3782678-13-umesh.nerlige.ramappa@intel.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/xe/oa: DMA to freed OA buffer when xe_oa_destroy_locked()
skips disable
--
commit 075f191997c0893af49f78ce642bd67df0a344cb
Author: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
drm/xe/oa: Skip OA HW teardown on a wedged device
This commit skips disabling the OA stream and performing OA hardware
teardown when the device is wedged, while unconditionally canceling the
poll check timer during stream destruction.
> diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c
> index 3ddccc7e6f90c..8ed427ad67b48 100644
> --- a/drivers/gpu/drm/xe/xe_oa.c
> +++ b/drivers/gpu/drm/xe/xe_oa.c
> @@ -43,6 +43,7 @@
> #include "xe_sriov.h"
> #include "xe_sync.h"
> #include "xe_wa.h"
> +#include "xe_wedge.h"
>
> #define DEFAULT_POLL_FREQUENCY_HZ 200
> #define DEFAULT_POLL_PERIOD_NS (NSEC_PER_SEC / DEFAULT_POLL_FREQUENCY_HZ)
> @@ -905,7 +906,12 @@ static void xe_oa_stream_destroy(struct xe_oa_stream *stream)
>
> mutex_destroy(&stream->stream_lock);
>
> - xe_oa_stream_hw_teardown(stream);
> + /* The poll timer may still be armed if the OA disable was skipped */
> + hrtimer_cancel(&stream->poll_check_timer);
> +
> + if (!xe_wedged(stream->oa->xe))
> + xe_oa_stream_hw_teardown(stream);
> +
> xe_oa_free_oa_buffer(stream);
> xe_oa_stream_free_resources(stream);
> }
> @@ -1704,7 +1710,8 @@ static void xe_oa_destroy_locked(struct xe_oa_stream *stream)
> {
> xe_pm_runtime_get(gt_to_xe(stream->gt));
>
> - if (stream->enabled)
> + /* A wedged device may be unresponsive, skip HW access */
> + if (stream->enabled && !xe_wedged(gt_to_xe(stream->gt)))
> xe_oa_disable_locked(stream);
>
> xe_oa_stream_destroy(stream);
[Severity: Medium]
Can skipping xe_oa_disable_locked() and xe_oa_stream_hw_teardown() while
still calling xe_oa_free_oa_buffer() leave the OA unit writing reports via
DMA into freed memory?
xe_wedge_declare() marks the device wedged without resetting the GT that
owns the active OA unit in several paths, such as when another GT on a
multi-GT device fails reset in gt_reset_worker(), when a kernel queue job
times out in guc_exec_queue_timedout_job(), or when wedged_mode is 2. In
those cases gt_wedge_worker() only stops GuC CT and sends
XE_GUC_ACTION_CLIENT_SOFT_RESET, which does not stop the fixed-function OA
hardware timer.
When userspace closes the OA stream fd before driver unbind or PCI reset,
OAG_OACONTROL_OA_COUNTER_ENABLE remains set and OA_TLB_INV_CR is not
written, while xe_oa_free_oa_buffer() -> xe_bo_unpin_map_no_vm() unpins
and frees stream->oa_buffer.bo (and send_tlb_inval_ggtt() returns
-ECANCELED when wedged), allowing ongoing OA report writes to corrupt
reallocated backing pages or recycled GGTT ranges.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261118025140.3782678-9-umesh.nerlige.ramappa@intel.com?part=4
next prev parent reply other threads:[~2026-11-18 3:25 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 2:51 [PATCH v7 0/7] Cleanup OA stream on PCI unbind/remove Umesh Nerlige Ramappa
2026-11-18 2:51 ` [PATCH v7 1/7] drm/xe/oa: Use the drm device address_space for the OA stream fd Umesh Nerlige Ramappa
2026-11-18 3:14 ` sashiko-bot
2026-11-18 2:51 ` [PATCH v7 2/7] drm/xe/oa: Split OA stream destroy into HW teardown and resource release Umesh Nerlige Ramappa
2026-11-18 2:51 ` [PATCH v7 3/7] drm/xe/oa: Take the runtime PM reference in xe_oa_destroy_locked() Umesh Nerlige Ramappa
2026-11-18 2:51 ` [PATCH v7 4/7] drm/xe/oa: Skip OA HW teardown on a wedged device Umesh Nerlige Ramappa
2026-11-18 3:25 ` sashiko-bot [this message]
2026-11-18 2:51 ` [PATCH v7 5/7] drm/xe/oa: Wait for in-flight OA batches before stream HW teardown Umesh Nerlige Ramappa
2026-11-18 2:51 ` [PATCH v7 6/7] drm/xe: Reject vm_ops->access on BO mappings of an unplugged device Umesh Nerlige Ramappa
2026-11-18 3:05 ` sashiko-bot
2026-11-18 2:51 ` [PATCH v7 7/7] drm/xe/oa: Quiesce OA streams on driver unbind and PCI reset Umesh Nerlige Ramappa
2026-11-18 3:51 ` sashiko-bot
2026-11-18 3:01 ` ✓ CI.KUnit: success for Cleanup OA stream on PCI unbind/remove (rev7) Patchwork
2026-11-18 3:37 ` ✓ Xe.CI.BAT: " 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-220010@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=umesh.nerlige.ramappa@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