All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Philipp Stanner" <phasta@kernel.org>
Cc: dri-devel@lists.freedesktop.org, media-ci@linuxtv.org,
	ojeda@kernel.org, gary@garyguo.net
Subject: Re: [RFC PATCH v7 5/8] rust: DmaFence: Replace is_signaled() with status()
Date: Tue, 03 Nov 2026 15:45:58 +0000	[thread overview]
Message-ID: <sashiko-outbox-195649@kernel.org> (raw)
In-Reply-To: <20261103153138.1087330-7-phasta@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] rust: dma_fence: unstable assert_matches in doctest breaks KUnit build
--

commit 1a1a7bd301271b4681c7504f6e6f60ca7abd6bb7
Author: Philipp Stanner <phasta@kernel.org>

rust: DmaFence: Replace is_signaled() with status()

This commit replaces Fence::is_signaled() with Fence::status() returning a
FenceStatus enum so callers must check whether a signaled fence completed with
an error while holding the fence lock.

> diff --git a/rust/kernel/dma_buf/dma_fence.rs b/rust/kernel/dma_buf/dma_fence.rs
> index fbbc6ab202eca..9cef604f17ea9 100644
> --- a/rust/kernel/dma_buf/dma_fence.rs
> +++ b/rust/kernel/dma_buf/dma_fence.rs

[ ... ]

> @@ -650,11 +658,15 @@ struct DriverFenceData<'a, T: Send + Sync + FenceContextOps> {
>  ///         FenceContextOps,
>  ///         FenceCallback,
>  ///         FenceCallbackRegistration,
> +///         FenceStatus, //
>  ///     },
>  ///     str::CString,
>  ///     sync::aref::ARef, //
>  /// };
> -/// use core::fmt::Display;
> +/// use core::{
> +///     assert_matches,
> +///     fmt::Display, //
> +/// };
>  ///
>  /// struct CallbackData { }
>  ///
> @@ -700,9 +712,9 @@ struct DriverFenceData<'a, T: Send + Sync + FenceContextOps> {
>  /// let cb_reg = KBox::pin_init(cb_reg, GFP_KERNEL)?;
>  ///
>  /// // TODO signalling guards
> -/// assert_eq!(waiting_fence.is_signaled(), false);
> +/// assert_matches!(waiting_fence.status(), FenceStatus::Unsignaled);
>  /// fence.signal(Ok(()));
> -/// assert_eq!(waiting_fence.is_signaled(), true);
> +/// assert_matches!(waiting_fence.status(), FenceStatus::Signaled(Ok(())));

[Severity: Low]
Does using core::assert_matches in the DriverFence doctest break the build when
CONFIG_RUST_KERNEL_DOCTESTS=y and CONFIG_DMA_SHARED_BUFFER=y are enabled?

When CONFIG_RUST_KERNEL_DOCTESTS=y is set, scripts/rustdoc_test_gen extracts
this doctest into rust/doctests_kernel_generated.rs, which is compiled using
rust_common_cmd in scripts/Makefile.build:

    rust_allowed_features := arbitrary_self_types,asm_goto,generic_arg_infer,used_with_arg

Because assert_matches is an unstable library feature in core that is not in
rust_allowed_features and feature(assert_matches) is not enabled for the
doctest crate, compiling rust/doctests_kernel_generated.o fails with
error[E0658].

Would it work to use assert!(matches!(...)) instead, or derive PartialEq and Eq
on FenceStatus so assert_eq! can be used with the KUnit doctest assertion
macros?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261103153138.1087330-2-phasta@kernel.org?part=5

  reply	other threads:[~2026-11-03 15:46 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03 15:31 [RFC PATCH v7 0/8] rust: Add drm::JobQueue Philipp Stanner
2026-11-03 15:31 ` [RFC PATCH v7 1/8] rust: DmaFence: Implement Deref for FenceContext Philipp Stanner
2026-11-03 15:31 ` [RFC PATCH v7 2/8] rust: DmaFence: Add ID accessor for fctx Philipp Stanner
2026-11-03 15:31 ` [RFC PATCH v7 3/8] rust: DmaFence: Don't drop on signal Philipp Stanner
2026-11-03 15:31 ` [RFC PATCH v7 4/8] rust: DmaFence: Replace call_rcu() with synchronize_rcu() Philipp Stanner
2026-11-03 15:44   ` sashiko-bot
2026-11-03 15:31 ` [RFC PATCH v7 5/8] rust: DmaFence: Replace is_signaled() with status() Philipp Stanner
2026-11-03 15:45   ` sashiko-bot [this message]
2026-11-03 15:31 ` [RFC PATCH v7 6/8] rust: DmaFence: Tell results in signaling callbacks Philipp Stanner
2026-11-03 15:52   ` sashiko-bot
2026-11-03 15:31 ` [RFC PATCH v7 7/8] rust: drm: Add JobQueue Philipp Stanner
2026-11-03 16:08   ` sashiko-bot
2026-11-03 15:31 ` [RFC PATCH v7 8/8] samples: rust: Add JobQueue Tester Philipp Stanner
2026-11-03 16:07   ` sashiko-bot
2026-11-03 22:27   ` Younes Akhouayri
2026-11-04  8:41     ` Philipp Stanner

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-195649@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gary@garyguo.net \
    --cc=media-ci@linuxtv.org \
    --cc=ojeda@kernel.org \
    --cc=phasta@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.