All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Mallesh Koujalagi" <mallesh.koujalagi@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v5 2/7] drm/xe/sysctrl: Return error codes from sysctrl_wait_bit_set()
Date: Tue, 25 Aug 2026 11:24:22 +0000	[thread overview]
Message-ID: <20260825112422.7CFA51F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260825110542.1359776-11-mallesh.koujalagi@intel.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

New issues:
- [Low] The patch introduces usage of an undefined macro `xe_log_err`, a missing header `xe_log.h`, and an undeclared identifier `SYSCTRL`, resulting in immediate compilation failure.

Pre-existing issues:
- [High] Failure to drain the firmware mailbox on truncated reads hangs the hardware sysctrl mailbox, leading to state machine desynchronization and a permanent Denial of Service (DoS) for the sysctrl subsystem.
--

--- Patch [2]: [PATCH v5 2/7] drm/xe/sysctrl: Return error codes from sysctrl_wait_bit_set() ---
commit a0d9dbca39d7d03a2a03ce09604444ffe68818bd
Author: Mallesh Koujalagi <mallesh.koujalagi@intel.com>

drm/xe/sysctrl: Return error codes from sysctrl_wait_bit_set()

This patch modifies sysctrl_wait_bit_set() to return an error code instead
of a bool, and updates the caller in sysctrl_process_frame() to propagate
the error using xe_log_err().

> diff --git a/drivers/gpu/drm/xe/xe_sysctrl_mailbox.c b/drivers/gpu/drm/xe/xe_sysctrl_mailbox.c
> index f97dec375efe8..b5412ca42bb81 100644
> --- a/drivers/gpu/drm/xe/xe_sysctrl_mailbox.c
> +++ b/drivers/gpu/drm/xe/xe_sysctrl_mailbox.c

[ ... ]

> @@ -193,9 +189,10 @@ static int sysctrl_process_frame(struct xe_sysctrl *sc, void *out,
>  	struct xe_device *xe = sc_to_xe(sc);
>  	int ret;
>  
> -	if (!sysctrl_wait_bit_set(sc, SYSCTRL_MB_CTRL_RUN_BUSY_OUT, timeout_ms)) {
> -		xe_err(xe, "sysctrl: Response frame timeout\n");
> -		return -ETIMEDOUT;
> +	ret = sysctrl_wait_bit_set(sc, SYSCTRL_MB_CTRL_RUN_BUSY_OUT, timeout_ms);
> +	if (ret) {
> +		xe_log_err(xe, SYSCTRL, ret, "Response frame timeout\n");

[Severity: Low]
Is xe_log_err defined here? It appears this patch introduces usage of an
undefined macro xe_log_err and an undeclared identifier SYSCTRL, resulting
in an immediate compilation failure. Could there be a missing prerequisite
patch in this series that adds the xe_log infrastructure?

> +		return ret;
>  	}
>  
>  	ctrl_reg = xe_mmio_read32(sc->mmio, SYSCTRL_MB_CTRL);

[Severity: High]
This isn't a bug introduced by this patch, but looking at the caller of
sysctrl_process_frame():

sysctrl_receive_frames() {
    ...
    while (!done && remain) {
        frame_size = min_t(size_t, remain, XE_SYSCTRL_MB_FRAME_SIZE);
        ret = sysctrl_process_frame(sc, out, frame_size, timeout_ms,
                                    &done);
        if (ret)
            return ret;
        remain -= frame_size;
        out += frame_size;
    }
    ...
}

If the firmware sends a response payload larger than the data provided by
the caller, remain will reach 0 before done is true.

Doesn't this cause the while loop to exit early without draining the
remaining frames from the hardware mailbox?

If the SYSCTRL_MB_CTRL_RUN_BUSY_OUT bit isn't cleared, won't this leave the
hardware state machine stuck and cause a permanent DoS of the system
controller interface for subsequent commands?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260825110542.1359776-9-mallesh.koujalagi@intel.com?part=2

  reply	other threads:[~2026-08-25 11:24 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-25 11:05 [PATCH v5 0/7] drm/xe/sysctrl: Clean up error handling in Mallesh Koujalagi
2026-08-25 11:05 ` [PATCH v5 1/7] drm/xe/sysctrl: Return error codes from sysctrl_wait_bit_clear() Mallesh Koujalagi
2026-08-25 11:24   ` sashiko-bot
2026-08-25 11:05 ` [PATCH v5 2/7] drm/xe/sysctrl: Return error codes from sysctrl_wait_bit_set() Mallesh Koujalagi
2026-08-25 11:24   ` sashiko-bot [this message]
2026-08-25 11:05 ` [PATCH v5 3/7] drm/xe/sysctrl: Make sysctrl_write_frame() void Mallesh Koujalagi
2026-08-25 11:05 ` [PATCH v5 4/7] drm/xe/sysctrl: Use xe_assert() for payload size validation Mallesh Koujalagi
2026-08-25 11:05 ` [PATCH v5 5/7] drm/xe/sysctrl: Improve firmware response error logging Mallesh Koujalagi
2026-08-25 11:22   ` sashiko-bot
2026-08-27 10:57   ` Michal Wajdeczko
2026-08-27 12:50     ` Mallesh, Koujalagi
2026-08-27 14:40       ` Michal Wajdeczko
2026-08-25 11:05 ` [PATCH v5 6/7] drm/xe/sysctrl: Log group and command ID on mailbox failure Mallesh Koujalagi
2026-08-25 11:21   ` sashiko-bot
2026-08-27 11:01   ` Michal Wajdeczko
2026-08-25 11:05 ` [PATCH v5 7/7] drm/xe/sysctrl: Report 'System Controller event' error using SIGID Mallesh Koujalagi
2026-08-25 11:18   ` sashiko-bot
2026-08-27 11:06   ` Michal Wajdeczko
2026-08-25 11:13 ` ✓ CI.KUnit: success for drm/xe/sysctrl: Clean up error handling in (rev2) Patchwork
2026-08-25 11:50 ` ✓ Xe.CI.BAT: " Patchwork
2026-08-25 16:29 ` ✗ 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=20260825112422.7CFA51F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=mallesh.koujalagi@intel.com \
    --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.