* [PATCH v2] rust: DamFence: Remove warning about unsignaled drop
@ 2026-11-18 12:08 Philipp Stanner
2026-11-18 12:22 ` Daniel Almeida
0 siblings, 1 reply; 2+ messages in thread
From: Philipp Stanner @ 2026-11-18 12:08 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>
---
Changes in v2:
- Also update the documentation accordingly.
---
rust/kernel/dma_buf/dma_fence.rs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/rust/kernel/dma_buf/dma_fence.rs b/rust/kernel/dma_buf/dma_fence.rs
index a1d851656562..01a7ae807273 100644
--- a/rust/kernel/dma_buf/dma_fence.rs
+++ b/rust/kernel/dma_buf/dma_fence.rs
@@ -631,8 +631,9 @@ struct DriverFenceData<'a, T: Send + Sync + FenceContextOps> {
/// It is crucial that a [`DriverFence`] always correctly represents the state
/// of the associated job on the hardware. Especially, it is strictly necessary
/// that the owner ensures that all [`DriverFence`]s eventually get signaled.
-/// As a last resort, a [`DriverFence`] will signal itself if it drops
-/// unsignaled and print a warning.
+///
+/// A [`DriverFence`] that drops unsignaled will signal itself with the error
+/// code ECANCELED.
///
/// This design intends to implement the [`bindings::dma_fence_ops`] in such a
/// way that the driver-data necessary to implement the callback's functionality
@@ -942,7 +943,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 [flat|nested] 2+ messages in thread* Re: [PATCH v2] rust: DamFence: Remove warning about unsignaled drop
2026-11-18 12:08 [PATCH v2] rust: DamFence: Remove warning about unsignaled drop Philipp Stanner
@ 2026-11-18 12:22 ` Daniel Almeida
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Almeida @ 2026-11-18 12:22 UTC (permalink / raw)
To: Philipp Stanner
Cc: Sumit Semwal, Christian König, Danilo Krummrich, Alice Ryhl,
Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Trevor Gross, Tamir Duberstein,
Alexandre Courbot, Onur Özkan, linux-media, dri-devel,
rust-for-linux, linux-kernel
Hi Philipp,
Just pointing out that the same typo from v1 remains, i.e.: DamFence
— Daniel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-18 12:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-18 12:08 [PATCH v2] rust: DamFence: Remove warning about unsignaled drop Philipp Stanner
2026-11-18 12:22 ` Daniel Almeida
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®