From: sashiko-bot@kernel.org
To: "Agustín Pereira" <agustin.pereira.ro@gmail.com>,
"Danilo Krummrich" <dakr@kernel.org>,
"Alexandre Courbot" <acourbot@nvidia.com>,
"Alice Ryhl" <aliceryhl@google.com>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>
Cc: nova-gpu@lists.linux.dev, dri-devel@lists.freedesktop.org,
ojeda@kernel.org, gary@garyguo.net
Subject: Re: [RFC PATCH] gpu: nova-core: gsp: add RM alloc/control/free RPCs and client/device API
Date: Wed, 02 Dec 2026 02:22:09 +0000 [thread overview]
Message-ID: <sashiko-outbox-244625@kernel.org> (raw)
In-Reply-To: <20261202015357.153058-1-agustin.pereira.ro@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] gpu: nova-core: gsp: unchecked rpc_result and wrong reply
type in RmFreeReply
- [Low] gpu: nova-core: RmControlReply::read() drains sbuffer after
read_exact()
--
commit c67e31312d3a98810c1881e3bd0e412db7ac2488
Author: Agustín Pereira <agustin.pereira.ro@gmail.com>
gpu: nova-core: gsp: add RM alloc/control/free RPCs and client/device API
This commit implements the GSP-RM object alloc, control, and free RPCs
along with RAII handle wrappers for RM clients, devices, subdevices, and
child objects.
> diff --git a/drivers/gpu/nova-core/gsp/commands.rs b/drivers/gpu/nova-core/gsp/commands.rs
> index cdbb13674f082..80b8da1ad672c 100644
> --- a/drivers/gpu/nova-core/gsp/commands.rs
> +++ b/drivers/gpu/nova-core/gsp/commands.rs
[ ... ]
> @@ -329,3 +330,185 @@ fn read(
[ ... ]
> +impl<P: AsBytes + FromBytes + Zeroable> MessageFromGsp for RmControlReply<P> {
> + const FUNCTION: MsgFunction = MsgFunction::GspRmControl;
> + type InitError = Error;
> + type Message = fw::commands::GspRmControlHeader;
> +
> + fn read(
> + msg: &Self::Message,
> + sbuffer: &mut SBufferIter<array::IntoIter<&[u8], 2>>,
> + ) -> Result<Self, Self::InitError> {
> + msg.status().into_result()?;
> +
> + let mut params = P::zeroed();
> + sbuffer.read_exact(params.as_bytes_mut())?;
> + while sbuffer.next().is_some() {}
> +
> + Ok(Self { params })
> + }
> +}
[Severity: Low]
Why does RmControlReply::read() drain sbuffer after read_exact()?
sbuffer.read_exact(params.as_bytes_mut()) already consumes the full
size_of::<P>() reply payload. Draining any remaining bytes afterwards
silently suppresses the "has unprocessed data" warning in
CmdqInner::receive_msg() when a GSP_RM_CONTROL reply payload is larger
than P.
[ ... ]
> +/// The reply from the GSP to [`RmFree`].
> +pub(super) struct RmFreeReply;
> +
> +impl MessageFromGsp for RmFreeReply {
> + const FUNCTION: MsgFunction = MsgFunction::Free;
> + type InitError = Error;
> + type Message = fw::commands::GspRmFree;
> +
> + fn read(
> + msg: &Self::Message,
> + _sbuffer: &mut SBufferIter<array::IntoIter<&[u8], 2>>,
> + ) -> Result<Self, Self::InitError> {
> + msg.status().into_result()?;
> + Ok(RmFreeReply)
> + }
> +}
[Severity: Medium]
Does GSP-RM report NV_VGPU_MSG_FUNCTION_FREE completion status in
rpc_free_v03_00.params.status or in the outer rpc_message_header_v
rpc_result field?
Unlike GSP_RM_ALLOC and GSP_RM_CONTROL, nouveau's r535_gsp_rpc_rm_free()
requests a zero-payload reply for FREE and checks rpc->rpc_result in the
outer RPC header. In nova-core, CmdqInner::receive_msg() does not check
header.inner.rpc.rpc_result, while RmFreeReply requires a 16-byte
GspRmFree payload and checks params.status (which GspRmFree::new()
initializes to 0):
drivers/gpu/nova-core/gsp/cmdq.rs:CmdqInner::receive_msg() {
...
// An early return here would leave the read pointer on this message.
let result = if matches!(function, Ok(f) if f == M::FUNCTION) {
let (cmd, contents_1) = M::Message::from_bytes_prefix(message.contents.0).ok_or(EIO)?;
...
}
As a result, RPC errors reported in rpc_result are missed, and if GSP-RM
returns an empty reply payload for FREE (like UnloadingGuestDriverReply,
which uses type Message = ()), GspRmFree::from_bytes_prefix() returns
Err(EIO) before advance_cpu_read_ptr() is reached, leaving the command
queue read pointer stuck on the unconsumed message.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261202015357.153058-1-agustin.pereira.ro@gmail.com?part=1
prev parent reply other threads:[~2026-12-02 2:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 1:53 [RFC PATCH] gpu: nova-core: gsp: add RM alloc/control/free RPCs and client/device API Agustín Pereira
2026-12-02 2:22 ` sashiko-bot [this message]
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-244625@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=acourbot@nvidia.com \
--cc=agustin.pereira.ro@gmail.com \
--cc=airlied@gmail.com \
--cc=aliceryhl@google.com \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=gary@garyguo.net \
--cc=nova-gpu@lists.linux.dev \
--cc=ojeda@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=simona@ffwll.ch \
/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