From: sashiko-bot@kernel.org
To: "Anoop, Vijay" <anoop.c.vijay@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v4 2/4] drm/xe/sysctrl: Add sysctrl debugfs infrastructure and loopback test interface
Date: Thu, 03 Sep 2026 14:13:56 +0000 [thread overview]
Message-ID: <20260903141356.6F5811F00AC4@smtp.kernel.org> (raw)
In-Reply-To: <20260903140340.83500-8-anoop.c.vijay@intel.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Concurrent reads and writes to the loopback debugfs entry cause data races and expose inconsistent state.
--
commit b7da09a9e8ead758b95d7f60c29e7f7b90c922ce
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 which sends an
arbitrary byte payload 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..2144d9d43fba5
> --- /dev/null
> +++ b/drivers/gpu/drm/xe/xe_sysctrl_debugfs.c
> @@ -0,0 +1,157 @@
[ ... ]
> +static ssize_t xe_sysctrl_loopback_write(struct file *file, const char __user *ubuf,
> + size_t len, loff_t *offp)
> +{
[ ... ]
> + xe_sysctrl_create_command(&cmd, entry->group, entry->command,
> + input, input_len, entry->response_buf, input_len);
> +
> + guard(xe_pm_runtime)(xe);
> + entry->status = xe_sysctrl_send_command(entry->sc, &cmd, &out_len);
> + entry->response_len = entry->status ? 0 : out_len;
[Severity: Medium]
Does this code leave the shared debugfs entry fields vulnerable to data races
if multiple userspace processes write to the loopback file concurrently?
It appears that entry->status, entry->response_len, and entry->response_buf
are modified here directly without any synchronization protecting the entry
structure itself, as sc->cmd_lock inside xe_sysctrl_send_command() only
serializes the hardware mailbox sequence.
> +
> + return entry->status ? entry->status : len;
> +}
> +
> +static int xe_sysctrl_loopback_show(struct seq_file *m, void *data)
> +{
> + struct xe_sysctrl_debugfs_entry *entry = m->private;
> + size_t i;
> +
> + seq_printf(m, "Command: group=0x%02x cmd=0x%02x\n", entry->group, entry->command);
> + seq_printf(m, "Status: %d (%s)\n", entry->status, entry->status ? "FAILED" : "SUCCESS");
> + seq_printf(m, "Response: %zu bytes\n", entry->response_len);
> +
> + if (entry->response_len) {
> + seq_puts(m, "Response data:\n");
> + for (i = 0; i < entry->response_len; i++) {
> + if (i && (i % 16) == 0)
> + seq_putc(m, '\n');
> + seq_printf(m, "%02x ", entry->response_buf[i]);
[Severity: Medium]
Can a concurrent write to the loopback file cause torn reads or inconsistent
state to be returned here?
Since the entry fields are read locklessly, it seems possible to observe a new
buffer's contents alongside an old buffer's length, or a mismatched status,
returning garbage diagnostic output to userspace.
> + }
> + seq_putc(m, '\n');
> + }
> +
> + return 0;
> +}
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260903140340.83500-6-anoop.c.vijay@intel.com?part=2
next prev parent reply other threads:[~2026-09-03 14:13 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 14:03 [PATCH v4 0/4] drm/xe/sysctrl: Add System Controller debugfs Anoop, Vijay
2026-09-03 14:03 ` [PATCH v4 1/4] drm/xe/sysctrl: Add System Controller get application status Anoop, Vijay
2026-09-03 14:16 ` sashiko-bot
2026-09-03 19:17 ` Umesh Nerlige Ramappa
2026-09-03 20:12 ` Anoop Vijay
2026-09-03 20:42 ` Ruhl, Michael J
2026-09-04 3:13 ` Anoop Vijay
2026-09-03 14:03 ` [PATCH v4 2/4] drm/xe/sysctrl: Add sysctrl debugfs infrastructure and loopback test interface Anoop, Vijay
2026-09-03 14:13 ` sashiko-bot [this message]
2026-09-03 14:03 ` [PATCH v4 3/4] drm/xe/sysctrl: Add RAS error injection debugfs interface Anoop, Vijay
2026-09-03 14:13 ` sashiko-bot
2026-09-03 14:03 ` [PATCH v4 4/4] drm/xe/sysctrl: Add generic mailbox passthrough debugfs entry Anoop, Vijay
2026-09-03 14:12 ` sashiko-bot
2026-09-03 14:10 ` ✗ CI.checkpatch: warning for drm/xe/sysctrl: Add System Controller debugfs (rev4) Patchwork
2026-09-03 14:12 ` ✓ CI.KUnit: success " Patchwork
2026-09-03 15:02 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-04 1:27 ` ✓ Xe.CI.FULL: " 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=20260903141356.6F5811F00AC4@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.