Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Anoop, Vijay" <anoop.c.vijay@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v8 1/3] drm/xe/sysctrl: Add sysctrl debugfs infrastructure and loopback test interface
Date: Wed, 30 Sep 2026 13:44:54 +0000	[thread overview]
Message-ID: <20260930134454.DEA591F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260930133451.667270-6-anoop.c.vijay@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] drm/xe/sysctrl: mailbox hang due to truncated loopback response
--

commit ab3eed44be77711e6bb0819ac8607e94eabdf3d2
Author: Anoop Vijay <anoop.c.vijay@intel.com>
Subject: drm/xe/sysctrl: Add sysctrl debugfs infrastructure and loopback test interface

This commit adds debugfs support for exercising the System Controller mailbox
interface from userspace. It introduces the "sc/loopback" entry to send
arbitrary byte payloads to the Core group's inverted-loopback command.

> diff --git a/drivers/gpu/drm/xe/xe_sysctrl_debugfs.c b/drivers/gpu/drm/xe/xe_sysctrl_debugfs.c
> new file mode 100644
> index 0000000000000..0620a010198c5
> --- /dev/null
> +++ b/drivers/gpu/drm/xe/xe_sysctrl_debugfs.c

[ ... ]

> +static ssize_t xe_sysctrl_loopback_write(struct file *file, const char __user *ubuf,
> +					 size_t len, loff_t *offp)
> +{

[ ... ]

> +	if (input_len == 0) {
> +		xe_err(xe, "sysctrl: no loopback payload given\n");
> +		return -EINVAL;
> +	}
> +
> +	xe_sysctrl_create_command(&cmd, entry->group, entry->command,
> +				  input, input_len, entry->response_buf, input_len);

[Severity: Medium]
Could passing input_len as the response_len cause a permanent mailbox hang?

If the firmware pads the loopback response such that it occupies more
16-byte frames than expected (e.g., input_len is 12, but the firmware
responds with a 16-byte payload requiring an additional frame), the
low-level mailbox routines might prematurely terminate the read loop.

In sysctrl_receive_frames(), if the hardware sends more frames than
input_len covers, the loop could exit early, leaving unread frames in
the mailbox with SYSCTRL_MB_CTRL_RUN_BUSY_OUT set. This would
permanently stall the state machine and cause all subsequent
communication to fail with -EBUSY.

Would it be safer to pass XE_SYSCTRL_MB_MAX_DATA_SIZE as the response
buffer length to safely drain any firmware response?

> +
> +	scoped_guard(mutex, &entry->lock) {
> +		guard(xe_pm_runtime)(xe);
> +		entry->status = xe_sysctrl_send_command(entry->sc, &cmd, &out_len);
> +		entry->response_len = entry->status ? 0 : out_len;
> +		status = entry->status;
> +	}
> +
> +	return status ? status : len;
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260930133451.667270-5-anoop.c.vijay@intel.com?part=1

  reply	other threads:[~2026-09-30 13:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-30 13:34 [PATCH v8 0/3] drm/xe/sysctrl: Add System Controller debugfs Anoop, Vijay
2026-09-30 13:34 ` [PATCH v8 1/3] drm/xe/sysctrl: Add sysctrl debugfs infrastructure and loopback test interface Anoop, Vijay
2026-09-30 13:44   ` sashiko-bot [this message]
2026-09-30 13:34 ` [PATCH v8 2/3] drm/xe/sysctrl: Add RAS error injection debugfs interface Anoop, Vijay
2026-09-30 13:34 ` [PATCH v8 3/3] drm/xe/sysctrl: Add generic mailbox passthrough debugfs entry Anoop, Vijay
2026-10-05 13:34   ` Rodrigo Vivi
2026-09-30 14:02 ` ✗ CI.checkpatch: warning for drm/xe/sysctrl: Add System Controller debugfs (rev8) Patchwork
2026-09-30 14:04 ` ✓ CI.KUnit: success " Patchwork
2026-09-30 15:43 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-30 18:50 ` ✗ Xe.CI.FULL: failure " 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=20260930134454.DEA591F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=anoop.c.vijay@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