[PATCH 2/2] rust: dma_buf: dma_fence: require a SignallingSection in signal()

From: Daniel Almeida

Date: Fri Nov 27 2026 - 13:32:07 EST


DriverFence::signal() is where a fence's signalling path ends. The
dma-fence rules require the whole path, from the point where the fence
becomes visible to other threads up to the signal, to run in a
signalling section. A caller of signal() has most likely been running
on that path before the call.

Make DriverFence::signal() take a &SignallingSection, so that callers
have to open a section. This does not ensure that the section covers
the whole signalling path, as drivers can simply do:

fence.signal(res, &SignallingSection::begin());

But at least it nudges drivers in the right direction and forces them
to consider signalling sections instead of ignoring them.

Update the DriverFence example accordingly.

Signed-off-by: Daniel Almeida <daniel.almeida@xxxxxxxxxxxxx>
---
rust/kernel/dma_buf/dma_fence.rs | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/rust/kernel/dma_buf/dma_fence.rs b/rust/kernel/dma_buf/dma_fence.rs
index 7ee87935d3be..39f9bb9d1be3 100644
--- a/rust/kernel/dma_buf/dma_fence.rs
+++ b/rust/kernel/dma_buf/dma_fence.rs
@@ -773,7 +773,7 @@ struct DriverFenceData<'a, T: Send + Sync + FenceContextOps> {
///
/// let section = SignallingSection::begin();
/// assert_eq!(waiting_fence.is_signaled(), false);
-/// fence.signal(Ok(()));
+/// fence.signal(Ok(()), &section);
/// drop(section);
/// assert_eq!(waiting_fence.is_signaled(), true);
///
@@ -873,7 +873,10 @@ pub fn as_fence(&self) -> &Fence {
}

/// Signal the fence. This will invoke all registered callbacks.
- pub fn signal(self, res: Result) {
+ ///
+ /// Takes a [`SignallingSection`] because all code needed to signal the
+ /// fence must run in one.
+ pub fn signal(self, res: Result, _section: &SignallingSection) {
let fence = self.as_fence().lock();

// SAFETY: `fence` is valid because `self` is valid. The lock must be

--
2.56.0