On 11/19/26 16:34, Danilo Krummrich wrote: > On Thu Nov 19, 2026 at 11:47 AM CET, Christian König wrote: >> A dma_fence should *NEVER* signal because you waited for something. Instead >> the dma_fence is what is waited on. > > In the end, despite doing it on behalf of the hardware, the driver is the > producer of the fence. And there are cases where it can't wait on its own > fence, > because no one is going to signal it other than the driver itself. > > Assume you have an execution context that is torn down, and also assume the > hardware supports preemption. Then some of the jobs in the queue might still > signal, but some jobs are not processed anymore and hence are not signaled. > > For those jobs that did not execute anymore, the fence still has to be > signaled. > So the driver has to signal them after it waited on the preemption and > execution > context teardown is complete and no more operations are in flight.
Oh well that comment made me smile because it confirmed what I wrote :) How do you wait for the "preemption and execution context teardown is complete and no more operations are in flight" ? That waiting for DMA context teardown must be done through a dma-fence. That is the whole concept of dma-fences in the first place. I wish I could enforce that in C somehow but we missed that opportunity when we originally designed the dma-fence and now it is to late because of the fallout and complexity required for such a change. See the discussion here as well https://lists.freedesktop.org/archives/dri-devel/2025-August/520640.html I think we are at the point where I need to make clear that practices like signaling fences from a destructor or other IOCTL initiated teardown is a NAK from my side as DMA-buf maintainer. When you want to push forward with this anyway I think we need to raise this with Dave/Linus to get an answer if such an approach is ok or not. Cheers, Christian. > The same is true for job fences that are in a software queue and never hit the > queue of the hardware execution context.
