* [PATCH] rust: DamFence: Remove warning about unsignaled drop
@ 2026-11-12 10:10 Philipp Stanner
2026-11-12 10:20 ` sashiko-bot
2026-11-12 10:29 ` Christian König
0 siblings, 2 replies; 3+ messages in thread
From: Philipp Stanner @ 2026-11-12 10:10 UTC (permalink / raw)
To: Sumit Semwal, Christian König, Philipp Stanner,
Danilo Krummrich, Alice Ryhl, Miguel Ojeda, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg,
Trevor Gross, Daniel Almeida, Tamir Duberstein, Alexandre Courbot,
Onur Özkan
Cc: linux-media, dri-devel, rust-for-linux, linux-kernel
DriverFence::drop() contains a pr_warn!() for when the fence drops
unsignaled. This warning gets into the way of canonical teardown in
Rust: when you drop a lock, it unlocks itself, when you drop a KBox, it
frees itself etc. Congruently, users should be able to tear down fences
they don't care about anymore with ECANCELED, which is already the
default error code.
Remove the warning.
Suggested-by: Danilo Krummrich <dakr@kernel.org>
Signed-off-by: Philipp Stanner <phasta@kernel.org>
---
rust/kernel/dma_buf/dma_fence.rs | 1 -
1 file changed, 1 deletion(-)
diff --git a/rust/kernel/dma_buf/dma_fence.rs b/rust/kernel/dma_buf/dma_fence.rs
index a1d851656562..2c8001cb9a59 100644
--- a/rust/kernel/dma_buf/dma_fence.rs
+++ b/rust/kernel/dma_buf/dma_fence.rs
@@ -942,7 +942,6 @@ fn drop(&mut self) {
// SAFETY: `guard` is valid until the `call_rcu()` below.
let signaled: bool = unsafe { bindings::dma_fence_test_signaled_flag(guard.as_raw()) };
if !signaled {
- pr_err!("DriverFence drops unsignaled. Danger of memory corruption!\n");
// SAFETY: `guard` is valid until the `call_rcu()` below. The fence
// must not have been signaled yet, which we check directly above.
unsafe { bindings::dma_fence_set_error(guard.as_raw(), ECANCELED.to_errno()) };
--
2.56.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] rust: DamFence: Remove warning about unsignaled drop
2026-11-12 10:10 [PATCH] rust: DamFence: Remove warning about unsignaled drop Philipp Stanner
@ 2026-11-12 10:20 ` sashiko-bot
2026-11-12 10:29 ` Christian König
1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-11-12 10:20 UTC (permalink / raw)
To: Philipp Stanner; +Cc: dri-devel, media-ci, ojeda, gary
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] rust: dma_fence: stale DriverFence rustdoc after warning removal
in drop()
--
commit 1fa69b16f405cf6ecb2511fccf990063ada22d3a
Author: Philipp Stanner <phasta@kernel.org>
rust: DamFence: Remove warning about unsignaled drop
This commit removes the error message printed when a DriverFence is dropped
before being signaled.
> diff --git a/rust/kernel/dma_buf/dma_fence.rs b/rust/kernel/dma_buf/dma_fence.rs
> index 18a43e1bb442f..a46b6a1f114f1 100644
> --- a/rust/kernel/dma_buf/dma_fence.rs
> +++ b/rust/kernel/dma_buf/dma_fence.rs
> @@ -934,7 +934,6 @@ fn drop(&mut self) {
> // SAFETY: `guard` is valid until the `call_rcu()` below.
> let signaled: bool = unsafe { bindings::dma_fence_test_signaled_flag(guard.as_raw()) };
> if !signaled {
> - pr_err!("DriverFence drops unsignaled. Danger of memory corruption!\n");
> // SAFETY: `guard` is valid until the `call_rcu()` below. The fence
> // must not have been signaled yet, which we check directly above.
> unsafe { bindings::dma_fence_set_error(guard.as_raw(), ECANCELED.to_errno()) };
[Severity: Low]
Should the rustdoc comment on struct DriverFence also be updated now that
dropping an unsignaled fence is canonical teardown and no longer logs a
message?
rust/kernel/dma_buf/dma_fence.rs:
/// As a last resort, a [`DriverFence`] will signal itself if it drops
/// unsignaled and print a warning.
pub struct DriverFence<'a, T: FenceContextOps> {
Also, the commit subject misspells the component as DamFence, and the
commit message refers to the removed pr_err!() call as pr_warn!().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261112101015.528127-2-phasta@kernel.org?part=1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] rust: DamFence: Remove warning about unsignaled drop
2026-11-12 10:10 [PATCH] rust: DamFence: Remove warning about unsignaled drop Philipp Stanner
2026-11-12 10:20 ` sashiko-bot
@ 2026-11-12 10:29 ` Christian König
1 sibling, 0 replies; 3+ messages in thread
From: Christian König @ 2026-11-12 10:29 UTC (permalink / raw)
To: Philipp Stanner, Sumit Semwal, Danilo Krummrich, Alice Ryhl,
Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Trevor Gross, Daniel Almeida,
Tamir Duberstein, Alexandre Courbot, Onur Özkan
Cc: linux-media, dri-devel, rust-for-linux, linux-kernel
On 11/12/26 11:10, Philipp Stanner wrote:
> DriverFence::drop() contains a pr_warn!() for when the fence drops
> unsignaled. This warning gets into the way of canonical teardown in
> Rust: when you drop a lock, it unlocks itself, when you drop a KBox, it
> frees itself etc. Congruently, users should be able to tear down fences
> they don't care about anymore with ECANCELED, which is already the
> default error code.
Well a dma_fence should never automatically signal when the last reference drops.
Leaving it unsignaled is the most defensive path we can go. That can lead to deadlocks but it can at least not lead to memory corruption.
Regards,
Christian.
>
> Remove the warning.
>
> Suggested-by: Danilo Krummrich <dakr@kernel.org>
> Signed-off-by: Philipp Stanner <phasta@kernel.org>
> ---
> rust/kernel/dma_buf/dma_fence.rs | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/rust/kernel/dma_buf/dma_fence.rs b/rust/kernel/dma_buf/dma_fence.rs
> index a1d851656562..2c8001cb9a59 100644
> --- a/rust/kernel/dma_buf/dma_fence.rs
> +++ b/rust/kernel/dma_buf/dma_fence.rs
> @@ -942,7 +942,6 @@ fn drop(&mut self) {
> // SAFETY: `guard` is valid until the `call_rcu()` below.
> let signaled: bool = unsafe { bindings::dma_fence_test_signaled_flag(guard.as_raw()) };
> if !signaled {
> - pr_err!("DriverFence drops unsignaled. Danger of memory corruption!\n");
> // SAFETY: `guard` is valid until the `call_rcu()` below. The fence
> // must not have been signaled yet, which we check directly above.
> unsafe { bindings::dma_fence_set_error(guard.as_raw(), ECANCELED.to_errno()) };
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-12 10:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-12 10:10 [PATCH] rust: DamFence: Remove warning about unsignaled drop Philipp Stanner
2026-11-12 10:20 ` sashiko-bot
2026-11-12 10:29 ` Christian König
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.