All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Eliot Courtney" <ecourtney@nvidia.com>
Cc: dri-devel@lists.freedesktop.org,
	"Alexandre Courbot" <acourbot@nvidia.com>,
	"Danilo Krummrich" <dakr@kernel.org>,
	ojeda@kernel.org
Subject: Re: [PATCH v2 3/8] rust: alloc: add ArrayVec
Date: Thu, 27 Aug 2026 14:33:20 +0000	[thread overview]
Message-ID: <20260827143320.EA3301F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260827-b4-nvkv-v2-3-0de9d5c8658c@nvidia.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Small abstraction functions are missing the `#[inline]` attribute.
--

commit 04be610d7cb2829e10f7bdcdb68a4d11695975ca
Author: Eliot Courtney <ecourtney@nvidia.com>

rust: alloc: add ArrayVec

Add a fixed capacity vector backed by an uninitialized array. The ArrayVec
is initializable with a closure to avoid stack construction. It provides
a way to avoid heap allocations for small but varying size arrays stored
on the stack.

> diff --git a/rust/kernel/alloc/arrayvec.rs b/rust/kernel/alloc/arrayvec.rs
> new file mode 100644
> index 0000000000000..4172a982e4775
> --- /dev/null
> +++ b/rust/kernel/alloc/arrayvec.rs
[ ... ]
> +    /// Appends an element to the back of the [`ArrayVec`].
> +    ///
> +    /// Fails when the [`ArrayVec`] is full, handing the element back in [`PushError`].
> +    pub fn push(&mut self, v: T) -> Result<(), PushError<T>> {

[Severity: Low]
Should ArrayVec::push in rust/kernel/alloc/arrayvec.rs include an #[inline]
attribute?

> +        self.try_push_init(v)
> +            .map_err(|PushInitError::Full(v)| PushError(v))
> +    }
> +
> +    /// Appends an element to the back of the [`ArrayVec`] by initializing it in place.
> +    ///
> +    /// Fails with [`FullError`] when the [`ArrayVec`] is full.
> +    pub fn push_init(&mut self, init: impl Init<T>) -> Result<(), FullError> {

[Severity: Low]
Would it be appropriate to add #[inline] to ArrayVec::push_init as well,
given that it purely forwards to try_push_init?

> +        self.try_push_init(init)
> +            .map_err(|PushInitError::Full(_)| FullError)
> +    }
[ ... ]
> +    /// Returns a slice of `MaybeUninit<T>` for the remaining spare capacity of the [`ArrayVec`].
> +    fn spare_capacity_mut(&mut self) -> &mut [MaybeUninit<T>] {

[Severity: Low]
Is the short helper function ArrayVec::spare_capacity_mut missing an #[inline]
attribute?

> +        // PANIC: `len` never exceeds `N` by the type invariants.
> +        &mut self.data[self.len..]
> +    }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260827-b4-nvkv-v2-0-0de9d5c8658c@nvidia.com?part=3

  reply	other threads:[~2026-08-27 14:33 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-27 14:12 [PATCH v2 0/8] gpu: nova-core: add NVKV codec Eliot Courtney
2026-08-27 14:12 ` [PATCH v2 1/8] rust: alloc: add Vec::try_push_init Eliot Courtney
2026-08-27 14:12 ` [PATCH v2 2/8] rust: alloc: add Vec::push_init Eliot Courtney
2026-08-27 14:30   ` sashiko-bot
2026-08-27 14:12 ` [PATCH v2 3/8] rust: alloc: add ArrayVec Eliot Courtney
2026-08-27 14:33   ` sashiko-bot [this message]
2026-08-27 14:12 ` [PATCH v2 4/8] gpu: nova-core: add NVKV encoder Eliot Courtney
2026-08-27 14:35   ` sashiko-bot
2026-09-07 15:07   ` Alexandre Courbot
2026-08-27 14:12 ` [PATCH v2 5/8] gpu: nova-core: add NVKV decoder Eliot Courtney
2026-08-27 14:36   ` sashiko-bot
2026-09-09  0:51   ` Alexandre Courbot
2026-09-09  1:13     ` Eliot Courtney
2026-09-09  4:48       ` Alexandre Courbot
2026-09-10  7:47   ` Alexandre Courbot
2026-08-27 14:12 ` [PATCH v2 6/8] gpu: nova-core: add NVKV typed encoding Eliot Courtney
2026-09-10  8:10   ` Alexandre Courbot
2026-09-11  5:17     ` Alexandre Courbot
2026-09-11  5:28       ` Eliot Courtney
2026-09-11 11:18         ` Alexandre Courbot
2026-08-27 14:12 ` [PATCH v2 7/8] gpu: nova-core: add NVKV typed decoding Eliot Courtney
2026-08-27 14:12 ` [PATCH v2 8/8] gpu: nova-core: add NVKV GSP_INIT schemas Eliot Courtney
2026-08-27 14:34   ` sashiko-bot

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=20260827143320.EA3301F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=dakr@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ecourtney@nvidia.com \
    --cc=ojeda@kernel.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.