All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Eliot Courtney" <ecourtney@nvidia.com>
Cc: ojeda@kernel.org, "Danilo Krummrich" <dakr@kernel.org>,
	"Alexandre Courbot" <acourbot@nvidia.com>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v3 10/10] gpu: nova-core: mm: Add PRAMIN aperture self-tests
Date: Thu, 27 Aug 2026 09:07:49 +0000	[thread overview]
Message-ID: <20260827090750.2BEE21F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260827-pramin-split-v3-10-24b24d7afc52@nvidia.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The misalignment selftest for `u64` will fail on 32-bit architectures because `align_of::<u64>()` is 4, not 8.
- [Low] Compilation error when CONFIG_NOVA_CORE_SELFTESTS is enabled: calling `run_selftests` on an unpinned mutable reference.
--

commit 0fa1da2e573acbda3f74539dc8e29525a6f4dfba
Author: Joel Fernandes <joelagnelf@nvidia.com>

gpu: nova-core: mm: Add PRAMIN aperture self-tests

This commit adds self-tests for the PRAMIN aperture mechanism to verify
correct operation during GPU probe. The tests validate various alignment
requirements and corner cases, and are gated behind the
CONFIG_NOVA_CORE_SELFTESTS configuration.

> diff --git a/drivers/gpu/nova-core/driver.rs b/drivers/gpu/nova-core/driver.rs
> --- a/drivers/gpu/nova-core/driver.rs
> +++ b/drivers/gpu/nova-core/driver.rs
> @@ -85,6 +85,9 @@ fn probe<'bound>(
>                  // (try_pin_init!() initializes fields in declaration order), lives at a pinned
>                  // stable address, and is dropped after gpu (struct field drop order).
>                  gpu <- Gpu::new(pdev, unsafe { &*core::ptr::from_ref(bar) }),
> +                // Run optional GPU selftests.
> +                #[cfg(CONFIG_NOVA_CORE_SELFTESTS)]
> +                _: { gpu.run_selftests(pdev) },

[Severity: Low]
Will this cause a compilation error in the probe function when
CONFIG_NOVA_CORE_SELFTESTS is enabled?

The gpu field exposed within the try_pin_init closure is a standard mutable
reference, but the run_selftests method expects a pinned mutable reference.
Since these types do not automatically coerce, this looks like it will result
in a build failure during probe execution.

[ ... ]
> diff --git a/drivers/gpu/nova-core/mm/pramin.rs b/drivers/gpu/nova-core/mm/pramin.rs
> --- a/drivers/gpu/nova-core/mm/pramin.rs
> +++ b/drivers/gpu/nova-core/mm/pramin.rs
[ ... ]
> +    /// Test that misaligned accesses are rejected.
> +    fn test_misaligned_access(
> +        dev: &device::Device<device::Bound>,
> +        pramin: &mut Pramin<'_>,
> +        base: VramAddress,
> +    ) -> Result {
> +        // u16 at odd offset (not 2-byte aligned).
> +        selftest_assert!(dev, pramin.window_at::<u16>(base + 0x21).is_err());
> +
> +        // u32 at 2-byte-aligned (not 4-byte-aligned) offset.
> +        selftest_assert!(dev, pramin.window_at::<u32>(base + 2).is_err());
> +
> +        // u64 at a 4-byte-aligned (not 8-byte-aligned) address.
> +        selftest_assert!(dev, pramin.window_at::<u64>(base + 0x44).is_err());

[Severity: Medium]
Will this assertion in test_misaligned_access fail on 32-bit architectures?

On 32-bit systems, the memory alignment requirement for a u64 is typically 4
bytes rather than 8 bytes. Since the offset 0x44 is a multiple of 4, the
window_at call would succeed rather than returning an error, which seems
like it would cause a spurious selftest failure.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260827-pramin-split-v3-0-24b24d7afc52@nvidia.com?part=10

  reply	other threads:[~2026-08-27  9:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-27  8:51 [PATCH v3 00/10] gpu: nova-core: add PRAMIN window support Eliot Courtney
2026-08-27  8:51 ` [PATCH v3 01/10] gpu: nova-core: mm: Add VramAddress type Eliot Courtney
2026-08-27  8:51 ` [PATCH v3 02/10] gpu: nova-core: mm: Implement Alignable and Debug for VramAddress Eliot Courtney
2026-08-27  8:51 ` [PATCH v3 03/10] gpu: nova-core: mm: Add PRAMIN window registers Eliot Courtney
2026-08-27  8:51 ` [PATCH v3 04/10] gpu: nova-core: mm: Add the memory management HAL Eliot Courtney
2026-08-27  8:51 ` [PATCH v3 05/10] rust: io: add static `cast()` method for views Eliot Courtney
2026-09-06 15:27   ` Alexandre Courbot
2026-08-27  8:51 ` [PATCH v3 06/10] gpu: nova-core: mm: Add support to use PRAMIN windows to write to VRAM Eliot Courtney
2026-08-27  9:09   ` sashiko-bot
2026-08-27  8:51 ` [PATCH v3 07/10] docs: gpu: nova-core: Document the PRAMIN aperture mechanism Eliot Courtney
2026-08-27  8:51 ` [PATCH v3 08/10] gpu: nova-core: mm: Add GpuMm centralized memory manager Eliot Courtney
2026-08-27  8:51 ` [PATCH v3 09/10] gpu: nova-core: Add self-test assertion macros and config option Eliot Courtney
2026-08-27  8:51 ` [PATCH v3 10/10] gpu: nova-core: mm: Add PRAMIN aperture self-tests Eliot Courtney
2026-08-27  9:07   ` sashiko-bot [this message]
2026-09-02  8:46 ` [PATCH v3 00/10] gpu: nova-core: add PRAMIN window support Eliot Courtney
2026-09-06 15:29 ` Danilo Krummrich
2026-09-07  3:21 ` 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=20260827090750.2BEE21F000E9@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.