From: "Christian König" <christian.koenig@amd.com>
To: "Philipp Stanner" <phasta@kernel.org>,
"Sumit Semwal" <sumit.semwal@linaro.org>,
"Danilo Krummrich" <dakr@kernel.org>,
"Alice Ryhl" <aliceryhl@google.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>,
"Daniel Almeida" <daniel.almeida@collabora.com>,
"Tamir Duberstein" <tamird@kernel.org>,
"Alexandre Courbot" <acourbot@nvidia.com>,
"Onur Özkan" <work@onurozkan.dev>
Cc: linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org,
rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rust: DamFence: Remove warning about unsignaled drop
Date: Thu, 12 Nov 2026 11:29:42 +0100 [thread overview]
Message-ID: <5d466f7c-2e70-4011-be04-9ffdf877b915@amd.com> (raw)
In-Reply-To: <20261112101015.528127-2-phasta@kernel.org>
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()) };
prev parent reply other threads:[~2026-11-12 10:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 10:10 [PATCH] rust: DamFence: Remove warning about unsignaled drop Philipp Stanner
2026-11-12 10:29 ` Christian König [this message]
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=5d466f7c-2e70-4011-be04-9ffdf877b915@amd.com \
--to=christian.koenig@amd.com \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=gary@garyguo.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=ojeda@kernel.org \
--cc=phasta@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=sumit.semwal@linaro.org \
--cc=tamird@kernel.org \
--cc=tmgross@umich.edu \
--cc=work@onurozkan.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox