From: sashiko-bot@kernel.org
To: "Umesh Nerlige Ramappa" <umesh.nerlige.ramappa@intel.com>,
intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v8 1/8] drm/xe/oa: Ignore a HW tail pointer outside the OA buffer
Date: Thu, 19 Nov 2026 00:39:47 +0000 [thread overview]
Message-ID: <sashiko-outbox-222253@kernel.org> (raw)
In-Reply-To: <20261119002737.3899877-11-umesh.nerlige.ramappa@intel.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] drm/xe/oa: early false return in
xe_oa_buffer_check_unlocked() desyncs pollin
- [Low] drm/xe/oa: Fixes trailer cites 3a1fc394ba85 instead of
cffd77865f47
--
commit 42d5de4e7078897659a5043b18ec1b877eb0c6b7
Author: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
> drm/xe/oa: Ignore a HW tail pointer outside the OA buffer
>
> A device that stopped responding, e.g. during PCI error recovery or
> after a surprise removal, returns all ones for the OA tail pointer, and
> a reset device returns 0. Subtracting the GGTT address of the OA buffer
> then leaves a tail offset way past the end of the OA buffer.
>
> Since xe_oa_circ_diff() replaced the masked OA_TAKEN(), nothing brings
> such an offset back into the OA buffer. xe_oa_buffer_check_unlocked()
> walks backward from it, reading report ids and timestamps out of bounds
> of the OA buffer mapping, from the poll hrtimer in hardirq context and
> with the OA buffer lock held.
>
> Ignore a HW tail outside the OA buffer, as if no new reports landed.
>
> Fixes: 3a1fc394ba85 ("drm/xe/oa: Changes to OA_TAKEN")
> Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
[Severity: Low]
Should the Fixes: tag point to cffd77865f47 ("drm/xe/oa: Enable Xe2+
overrun mode") instead?
Commit 3a1fc394ba85 ("drm/xe/oa: Changes to OA_TAKEN") only renamed
OA_TAKEN() to xe_oa_circ_diff() while keeping the (XE_OA_BUFFER_SIZE - 1)
mask. Commit cffd77865f47 ("drm/xe/oa: Enable Xe2+ overrun mode")
removed that mask and added stream->oa_buffer.circ_size.
> diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c
> index 838802482adaf..fdd2d11ce4e7a 100644
> --- a/drivers/gpu/drm/xe/xe_oa.c
> +++ b/drivers/gpu/drm/xe/xe_oa.c
> @@ -270,6 +270,15 @@ static bool xe_oa_buffer_check_unlocked(struct xe_oa_stream *stream)
> hw_tail = xe_oa_hw_tail_read(stream);
> hw_tail -= gtt_offset;
>
> + /*
> + * A device that stopped responding, or was reset, returns a tail outside the OA
> + * buffer. Don't walk the buffer from there.
> + */
> + if (hw_tail >= stream->oa_buffer.circ_size) {
> + spin_unlock_irqrestore(&stream->oa_buffer.ptr_lock, flags);
> + return false;
> + }
[Severity: Medium]
Should this return stream->pollin (or recompute it from the unread data
between stream->oa_buffer.head and stream->oa_buffer.tail) instead of
false?
If reports had already landed and set stream->pollin = true before a
reset or PCI error makes hw_tail out of bounds, xe_oa_poll_locked() will
still report EPOLLIN via stream->pollin, while a blocking read in
xe_oa_wait_unlocked() will wait in wait_event_interruptible() for
xe_oa_buffer_check_unlocked(stream) and stall instead of draining the
buffered reports.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261119002737.3899877-10-umesh.nerlige.ramappa@intel.com?part=1
next prev parent reply other threads:[~2026-11-19 0:39 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 0:27 [PATCH v8 0/8] Cleanup OA stream on PCI unbind/remove Umesh Nerlige Ramappa
2026-11-19 0:27 ` [PATCH v8 1/8] drm/xe/oa: Ignore a HW tail pointer outside the OA buffer Umesh Nerlige Ramappa
2026-11-19 0:39 ` sashiko-bot [this message]
2026-11-19 0:27 ` [PATCH v8 2/8] drm/xe/oa: Use the drm device address_space for the OA stream fd Umesh Nerlige Ramappa
2026-11-19 0:39 ` sashiko-bot
2026-11-19 0:27 ` [PATCH v8 3/8] drm/xe/oa: Wait for in-flight OA batches before stream HW teardown Umesh Nerlige Ramappa
2026-11-19 0:27 ` [PATCH v8 4/8] drm/xe: Reject vm_ops->access on BO mappings of an unplugged device Umesh Nerlige Ramappa
2026-11-19 0:39 ` sashiko-bot
2026-11-19 0:27 ` [PATCH v8 5/8] drm/xe/oa: Fence OA ioctls and mmap against device unplug and wedging Umesh Nerlige Ramappa
2026-11-19 0:27 ` [PATCH v8 6/8] drm/xe/oa: Take the runtime PM reference in xe_oa_destroy_locked() Umesh Nerlige Ramappa
2026-11-19 0:27 ` [PATCH v8 7/8] drm/xe/oa: Free the OA buffer and the stream after the stream destroy Umesh Nerlige Ramappa
2026-11-19 0:48 ` sashiko-bot
2026-11-19 0:27 ` [PATCH v8 8/8] drm/xe/oa: Quiesce OA streams on driver unbind and PCI reset Umesh Nerlige Ramappa
2026-11-19 1:11 ` sashiko-bot
2026-11-19 6:05 ` ✓ CI.KUnit: success for Cleanup OA stream on PCI unbind/remove (rev8) Patchwork
2026-11-19 6:46 ` ✓ 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-222253@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