mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Alexandre Courbot" <acourbot@nvidia.com>
To: "Eliot Courtney" <ecourtney@nvidia.com>
Cc: "Danilo Krummrich" <dakr@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Trevor Gross" <tmgross@umich.edu>,
	nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org,
	"Zhi Wang" <zhiw@nvidia.com>
Subject: Re: [PATCH v3 9/9] gpu: nova-core: gsp: add tests for SplitState
Date: Fri, 27 Feb 2026 20:32:33 +0900	[thread overview]
Message-ID: <DGPPM80YS5P8.3UOZ42Q2O8U3G@nvidia.com> (raw)
In-Reply-To: <20260226-cmdq-continuation-v3-9-572ab9916766@nvidia.com>

On Thu Feb 26, 2026 at 8:45 PM JST, Eliot Courtney wrote:
> Add tests for SplitState. They cover boundary conditions at the split
> points to make sure the right number of continuation records are made.
> They also check that the data concatenated is correct.
>
> Tested-by: Zhi Wang <zhiw@nvidia.com>
> Signed-off-by: Eliot Courtney <ecourtney@nvidia.com>
> ---
>  drivers/gpu/nova-core/gsp/commands.rs | 114 ++++++++++++++++++++++++++++++++++
>  1 file changed, 114 insertions(+)
>
> diff --git a/drivers/gpu/nova-core/gsp/commands.rs b/drivers/gpu/nova-core/gsp/commands.rs
> index 6ffd0b9cbf05..74f875755e53 100644
> --- a/drivers/gpu/nova-core/gsp/commands.rs
> +++ b/drivers/gpu/nova-core/gsp/commands.rs
> @@ -384,3 +384,117 @@ fn init_variable_payload(
>          }
>      }
>  }
> +
> +#[kunit_tests(nova_core_gsp_commands)]
> +mod tests {
> +    use super::*;
> +
> +    struct TestPayload {
> +        data: KVVec<u8>,
> +    }
> +
> +    impl TestPayload {
> +        fn generate_pattern(len: usize) -> Result<KVVec<u8>> {
> +            let mut data = KVVec::with_capacity(len, GFP_KERNEL)?;
> +            for i in 0..len {
> +                data.push(i as u8, GFP_KERNEL)?;
> +            }
> +            Ok(data)
> +        }
> +
> +        fn new(len: usize) -> Result<Self> {
> +            Ok(Self {
> +                data: Self::generate_pattern(len)?,
> +            })
> +        }
> +    }
> +
> +    impl CommandToGsp for TestPayload {
> +        const FUNCTION: MsgFunction = MsgFunction::Nop;
> +        type Command = ();

Since we are testing the size of the data written on the command queue,
can you make the command itself larger than 0 bytes? Otherwise there is
a potential for missing errors.

I'm saying that because it actually happened to me, I used
`MAX_CMD_SIZE` instead of `MAX_CMD_SIZE - size_of::<C::Command>()`
somewhere, and despite it being broken the tests were passing.

  reply	other threads:[~2026-02-27 11:32 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-26 11:45 [PATCH v3 0/9] gpu: nova-core: gsp: add continuation record support Eliot Courtney
2026-02-26 11:45 ` [PATCH v3 1/9] gpu: nova-core: gsp: sort MsgFunction variants alphabetically Eliot Courtney
2026-02-26 11:45 ` [PATCH v3 2/9] gpu: nova-core: gsp: add mechanism to wait for space on command queue Eliot Courtney
2026-02-26 11:45 ` [PATCH v3 3/9] rust: add EMSGSIZE error code Eliot Courtney
2026-02-26 14:04   ` Miguel Ojeda
2026-02-26 11:45 ` [PATCH v3 4/9] gpu: nova-core: gsp: add checking oversized commands Eliot Courtney
2026-02-26 11:45 ` [PATCH v3 5/9] gpu: nova-core: gsp: clarify invariant on command queue Eliot Courtney
2026-02-26 11:45 ` [PATCH v3 6/9] gpu: nova-core: gsp: unconditionally call variable payload handling Eliot Courtney
2026-02-26 11:45 ` [PATCH v3 7/9] gpu: nova-core: gsp: add command_size helper Eliot Courtney
2026-02-26 11:45 ` [PATCH v3 8/9] gpu: nova-core: gsp: support large RPCs via continuation record Eliot Courtney
2026-02-27 11:28   ` Alexandre Courbot
2026-03-02  4:46     ` Eliot Courtney
2026-02-26 11:45 ` [PATCH v3 9/9] gpu: nova-core: gsp: add tests for SplitState Eliot Courtney
2026-02-27 11:32   ` Alexandre Courbot [this message]
2026-03-02  4:44     ` Eliot Courtney
2026-02-27 11:40   ` Alexandre Courbot

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=DGPPM80YS5P8.3UOZ42Q2O8U3G@nvidia.com \
    --to=acourbot@nvidia.com \
    --cc=a.hindborg@kernel.org \
    --cc=airlied@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ecourtney@nvidia.com \
    --cc=gary@garyguo.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=nouveau@lists.freedesktop.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tmgross@umich.edu \
    --cc=zhiw@nvidia.com \
    /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

all inboxes | Powered by JetHome®