From: sashiko-bot@kernel.org
To: "Eliot Courtney" <ecourtney@nvidia.com>,
"Alice Ryhl" <aliceryhl@google.com>,
"Burak Emir" <burak.emir@gmail.com>,
"Yury Norov" <yury.norov@gmail.com>,
"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>,
"Danilo Krummrich" <dakr@kernel.org>,
"Daniel Almeida" <daniel.almeida@collabora.com>,
"Tamir Duberstein" <tamird@kernel.org>,
"Alexandre Courbot" <acourbot@nvidia.com>,
"Onur Özkan" <work@onurozkan.dev>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"John Hubbard" <jhubbard@nvidia.com>,
"Alistair Popple" <apopple@nvidia.com>,
"Timur Tabi" <ttabi@nvidia.com>, "Zhi Wang" <zhiw@nvidia.com>,
nova-gpu@lists.linux.dev, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v10 1/3] rust: use Alignment size constants
Date: Mon, 19 Oct 2026 04:41:35 +0000 [thread overview]
Message-ID: <sashiko-outbox-176646@kernel.org> (raw)
In-Reply-To: <20261019-chid-v10-1-67de9180b4ed@nvidia.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] rust: missing SizeConstants implementation and sub-1K constants for Alignment
--
commit 2a0eb77a4c0fef593fa5a986d45a2a3fe50ca233
Author: Eliot Courtney <ecourtney@nvidia.com>
rust: use Alignment size constants
This commit replaces Alignment::new::<...>() calls with SizeConstants
associated constants on Alignment across rust/kernel/ and
drivers/gpu/nova-core/.
> diff --git a/drivers/gpu/nova-core/mm.rs b/drivers/gpu/nova-core/mm.rs
> index 8a934c55169fd..f53886f9ed91e 100644
> --- a/drivers/gpu/nova-core/mm.rs
> +++ b/drivers/gpu/nova-core/mm.rs
> @@ -317,7 +317,7 @@ pub(crate) fn run(
>
> let base = usable_fb_regions.iter().find_map(|region| {
> // Tests rely on this being 8 byte aligned for checking misalignment handling.
> - let base = region.start.align_up(Alignment::new::<8>())?;
> + let base = region.start.align_up(Alignment::SZ_8)?;
> (base.checked_add(SELFTEST_SPAN)? <= region.end).then_some(base)
> });
> let Some(base) = base else {
> diff --git a/drivers/gpu/nova-core/vbios.rs b/drivers/gpu/nova-core/vbios.rs
> index 9c214b9f4dd9d..a2d2d170b5014 100644
> --- a/drivers/gpu/nova-core/vbios.rs
> +++ b/drivers/gpu/nova-core/vbios.rs
[ ... ]
> @@ -291,7 +294,7 @@ fn next(&mut self) -> Option<Self::Item> {
>
> // Advance to next image (aligned to 512 bytes).
> self.current_offset += image_size;
> - self.current_offset = self.current_offset.align_up(Alignment::new::<512>())?;
> + self.current_offset = self.current_offset.align_up(Alignment::SZ_512)?;
>
> Some(Ok(full_image))
> }
> diff --git a/rust/kernel/io.rs b/rust/kernel/io.rs
> index de8ef8e2aec41..5712478a54616 100644
> --- a/rust/kernel/io.rs
> +++ b/rust/kernel/io.rs
> @@ -19,7 +19,8 @@
> ptr::{
> Alignment,
> KnownSize, //
> - }, //
> + },
> + sizes::SizeConstants, //
> };
>
> #[cfg(CONFIG_HAS_IOMEM)]
> @@ -90,7 +91,7 @@ pub fn ptr_try_from_raw_parts_mut(base: *mut u8, size: usize) -> Result<*mut Sel
> impl<const SIZE: usize> KnownSize for Region<SIZE> {
> const MIN_SIZE: usize = SIZE;
> // Alignment of 4 is the most common; different base types can be added once required.
> - const MIN_ALIGN: Alignment = Alignment::new::<4>();
> + const MIN_ALIGN: Alignment = Alignment::SZ_4;
>
> #[inline(always)]
> fn size(p: *const Self) -> usize {
[Severity: Low]
Is this patch missing a prerequisite commit that implements SizeConstants for
Alignment and adds the sub-1K size constants?
Currently in rust/kernel/sizes.rs, define_sizes! is only invoked for integer
types:
define_sizes!(u32, u64, usize);
and define_sizes! only defines constants from SZ_1K through SZ_2G. There is no
SizeConstants implementation for Alignment in rust/kernel/sizes.rs or
rust/kernel/ptr.rs, and sub-1K constants such as SZ_4 (used in
Region::MIN_ALIGN in rust/kernel/io.rs), SZ_8 (used in selftest::run in
drivers/gpu/nova-core/mm.rs under CONFIG_NOVA_CORE_SELFTESTS), and SZ_512 (used
in PciRomImageIterator::next in drivers/gpu/nova-core/vbios.rs) are not defined
in SizeConstants.
Without that prerequisite change, will building the kernel Rust crate,
rust/kernel/gpu/buddy.rs doctests, and drivers/gpu/nova-core/ fail?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261019-chid-v10-0-67de9180b4ed@nvidia.com?part=1
next prev parent reply other threads:[~2026-10-19 4:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-19 4:29 [PATCH v10 0/3] rust: Add support for reserving of ranges of IDs Eliot Courtney
2026-10-19 4:29 ` [PATCH v10 1/3] rust: use Alignment size constants Eliot Courtney
2026-10-19 4:41 ` sashiko-bot [this message]
2026-10-19 4:29 ` [PATCH v10 2/3] rust: id_pool: do not round capacity up to BitmapVec::MAX_INLINE_LEN Eliot Courtney
2026-10-19 4:37 ` sashiko-bot
2026-10-19 4:29 ` [PATCH v10 3/3] gpu: nova-core: add ChannelIdPool Eliot Courtney
2026-10-19 4:37 ` 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=sashiko-outbox-176646@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=airlied@gmail.com \
--cc=aliceryhl@google.com \
--cc=apopple@nvidia.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=burak.emir@gmail.com \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=ecourtney@nvidia.com \
--cc=gary@garyguo.net \
--cc=gregkh@linuxfoundation.org \
--cc=jhubbard@nvidia.com \
--cc=lossin@kernel.org \
--cc=nova-gpu@lists.linux.dev \
--cc=ojeda@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=simona@ffwll.ch \
--cc=tamird@kernel.org \
--cc=tmgross@umich.edu \
--cc=ttabi@nvidia.com \
--cc=work@onurozkan.dev \
--cc=yury.norov@gmail.com \
--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