Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Badal Nilawar" <badal.nilawar@intel.com>,
	intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v8 2/3] drm/xe/xe_ras: Add support to retrieve info queue data
Date: Fri, 20 Nov 2026 04:42:00 +0000	[thread overview]
Message-ID: <sashiko-outbox-224467@kernel.org> (raw)
In-Reply-To: <20261120043303.107183-7-badal.nilawar@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/xe/ras: assertion and 0-byte fetch in
  get_remaining_chunks() when full
--

commit 6c6fff86d117ac6d5e465e2c1c62372c93a7e520
Author: Badal Nilawar <badal.nilawar@intel.com>

drm/xe/xe_ras: Add support to retrieve info queue data

This commit adds helpers and mailbox structures to retrieve RAS info queue
data in chunks and assemble it into a flat buffer.

> diff --git a/drivers/gpu/drm/xe/xe_ras.c b/drivers/gpu/drm/xe/xe_ras.c
> index e8984c966876a..46542852e0552 100644
> --- a/drivers/gpu/drm/xe/xe_ras.c
> +++ b/drivers/gpu/drm/xe/xe_ras.c
> @@ -1123,6 +1123,192 @@ int xe_ras_set_threshold(struct xe_device *xe, u8 severity, u8 component, u32 th

[ ... ]

> +static u32 get_remaining_chunks(struct xe_device *xe,
> +				const struct xe_ras_get_counter_response *counter_resp,
> +				u8 *dest_buf, u32 dest_size, u32 offset, u32 flags)
> +{
> +	u32 requests_left = XE_SYSCTRL_FLOOD_LIMIT * 2;
> +	int ret;
> +
> +	while (flags & XE_RAS_INFO_QUEUE_FLAG_MORE_DATA) {
> +		struct xe_ras_info_queue_data_request *qdata_req;
> +		struct xe_ras_get_info_queue_response response = {};
> +		struct xe_ras_get_info_queue_request request = {};
> +		struct xe_ras_info_queue_header *hdr;
> +
> +		xe_assert(xe, offset < dest_size);
> +
> +		qdata_req = &request.qdata_req;
> +		qdata_req->offset = offset;
> +		qdata_req->size = min_t(u32, XE_RAS_INFO_QUEUE_MAX_CHUNK_SIZE, dest_size - offset);
> +		qdata_req->session_id = counter_resp->counter;
> +
> +		ret = get_info_queue(xe, &request, &response);
> +		if (ret) {
> +			xe_err(xe, "[RAS]: info queue drain aborted: fetch at offset=%u, ret = %d\n",
> +			       offset, ret);
> +			return offset;
> +		}
> +
> +		hdr = &response.qdata_resp.header;
> +
> +		if (!chunk_is_valid(hdr, offset, counter_resp->first.header.total_size,
> +				    dest_size)) {
> +			xe_warn(xe, "[RAS]: invalid info queue chunk (total=%u offset=%u size=%u, expected offset=%u)\n",
> +				hdr->total_size, hdr->chunk_offset, hdr->chunk_size, offset);
> +			return offset;
> +		}
> +
> +		memcpy(dest_buf + offset, response.qdata_resp.data, hdr->chunk_size);
> +		offset += hdr->chunk_size;
> +		flags = hdr->flags;
> +
> +		if (!--requests_left) {
> +			xe_warn(xe, "[RAS]: info queue flooding, aborted at offset=%u\n", offset);
> +			break;
> +		}
> +	}

[Severity: Medium]
Can get_remaining_chunks() trip xe_assert(xe, offset < dest_size) and issue
a 0-byte GET_INFO_QUEUE request when dest_buf fills up while
XE_RAS_INFO_QUEUE_FLAG_MORE_DATA is still set?

When firmware reports total_size > XE_RAS_INFO_QUEUE_MAX_TOTAL_SIZE (5120),
xe_ras_get_info_queue_size() truncates the buffer size to 5120 bytes.
Filling dest_buf to 5120 bytes takes 26 chunks (the initial chunk plus 25
requests, leaving requests_left at 7), and firmware keeps
XE_RAS_INFO_QUEUE_FLAG_MORE_DATA set on the chunk that reaches offset ==
dest_size because data remains beyond offset 5120.  Without a check like
offset < dest_size in the loop condition (or breaking when offset ==
dest_size), the next iteration asserts and sends a request with
qdata_req->size = 0.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261120043303.107183-5-badal.nilawar@intel.com?part=2

  reply	other threads:[~2026-11-20  4:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20  4:33 [PATCH v8 0/3] Extend CPER records with RAS info queue data Badal Nilawar
2026-11-20  4:33 ` [PATCH v8 1/3] drm/xe/cper: Drop redundant counter argument Badal Nilawar
2026-11-20  4:33 ` [PATCH v8 2/3] drm/xe/xe_ras: Add support to retrieve info queue data Badal Nilawar
2026-11-20  4:42   ` sashiko-bot [this message]
2026-11-20  4:33 ` [PATCH v8 3/3] drm/xe/cper: Prepare Intel CPER info records Badal Nilawar

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-224467@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=badal.nilawar@intel.com \
    --cc=intel-xe@lists.freedesktop.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox