mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-24 09:01:37 -04:00
Lets simplify and make clearer the fence lock cycling workaround in nouveau_cli_work(). The reason for the workaround is that the worker processes the list of pending work items (and so fence callbacks) opportunisticaly, while dma_fence_is_signaled() returns true as soon as a the fence is signaled. It is therefore not allowed for the opportunistic processing to free the work item, since the fence callback processing can still be in the process of dereferencing work->cb. This wasn't very clear in the code so clarify it with a nice comment. In the process we replace the somewhat interleaved and not very readable nouveau_cli_work_ready() helper with a direct dma_fence_is_signaled, which is even faster since it removes the lock cycling from the unsignaled fence path. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com> Cc: Philipp Stanner <phasta@kernel.org> Cc: Lyude Paul <lyude@redhat.com> Cc: Danilo Krummrich <dakr@kernel.org> Cc: nouveau@lists.freedesktop.org Link: https://patch.msgid.link/20260615092607.80917-1-tvrtko.ursulin@igalia.com Signed-off-by: Danilo Krummrich <dakr@kernel.org>