Hi Philipp, On Wed, 9 Apr 2025 14:06:37 +0200 Philipp Stanner <pha...@kernel.org> wrote:
> dma_fence_is_signaled()'s name strongly reads as if this function were > intended for checking whether a fence is already signaled. Also the > boolean it returns hints at that. > > The function's behavior, however, is more complex: it can check with a > driver callback whether the hardware's sequence number indicates that > the fence can already be treated as signaled, although the hardware's / > driver's interrupt handler has not signaled it yet. If that's the case, > the function also signals the fence. > > (Presumably) this has caused a bug in Nouveau (unknown commit), where > nouveau_fence_done() uses the function to check a fence, which causes a > race. > > Give the function a more obvious name. This is just my personal view on this, but I find the new name just as confusing as the old one. It sounds like something is checked, but it's clear what, and then the fence is forcibly signaled like it would be if you call drm_fence_signal(). Of course, this clarified by the doc, but given the goal was to make the function name clearly reflect what it does, I'm not convinced it's significantly better. Maybe dma_fence_check_hw_state_and_propagate(), though it might be too long of name. Oh well, feel free to ignore this comments if a majority is fine with the new name. Regards, Boris