Re: [PATCH 0/2] rust: dma_buf: add dma-fence signalling sections
From: Gary Guo
Date: Fri Nov 27 2026 - 13:59:54 EST
On Fri Nov 27, 2026 at 6:30 PM GMT, Daniel Almeida wrote:
> dma_fence_begin_signalling() and dma_fence_end_signalling() mark the
> code that the completion of a dma-fence depends on, so that lockdep can
> check it against the dma-fence rules. However, up until now, it was not
> possible to use the signalling tokens from Rust. Thus, add support for
> it.
>
> Patch 1 adds SignallingSection, a guard that begins a section when it
> is created and ends it when it is dropped. Patch 2 makes
> DriverFence::signal() take a &SignallingSection, so that its callers
> have to be in one.
Do you need it being a guard? You can do things like
let a = SignallingSection::begin();
let b = SignallingSection::begin();
drop(a);
drop(b);
to break nesting. A closure-based approach wouldn't have this issue.
Best,
Gary
>
> Patch 5 of the JobQueue series [1] changes the same signature to
> signal(&self, res). I will rebase on top of it once it lands and add
> the section to its callers then.
>
> A follow-up series adds a workqueue whose work items run in a
> signalling section. Tyr will use both.
>
> This is based on drm-rust-next.
>
> [1] https://lore.kernel.org/r/20261124122951.878199-2-phasta@xxxxxxxxxx
>
> ---
> Daniel Almeida (2):
> rust: dma_buf: dma_fence: add SignallingSection
> rust: dma_buf: dma_fence: require a SignallingSection in signal()
>
> rust/kernel/dma_buf/dma_fence.rs | 77 ++++++++++++++++++++++++++++++++++++++--
> rust/kernel/dma_buf/mod.rs | 3 +-
> 2 files changed, 76 insertions(+), 4 deletions(-)
> ---
> base-commit: abfb640b2374e26de8ff81d488c39d8254db538e
> change-id: 20261127-dma-fence-signalling-cae3def9aa97
>
> Best regards,
> --
> Daniel Almeida <daniel.almeida@xxxxxxxxxxxxx>