On Fri, 2026-11-20 at 10:33 +0100, Christian König wrote: > On 11/19/26 14:18, Philipp Stanner wrote: > > dma_fence_timestamp() tests two fence flags with test_bit(), not > > providing any ordering. > > > > The while loop + cpu_relax() seem to satisfy the desire to avoid > > locking, effectively rebuilding a locks spinning behavior in the rare > > case that a fence is signaling right now. Contrary to proper locking, > > however, correct memory ordering is not guaranteed. > > > > Ensure correct ordering with locking. > > My words when I tried to clean that up the first time: "Another > alternative would be to grab the spinlock when that happens."
:) > > I don't remember the story why the busy loop was used and can't see > any reasons why it wasn't done this way in the first place. I reached a point where I don't even want to know the story. Whatever the reason is, it will be something insane <.< > > But my suggestion is to completely drop the > DMA_FENCE_FLAG_TIMESTAMP_BIT as well. As far as I can tell that was > only added as indicator that the timestamp is set, but we do that now > for all fences anyway. Agreed, but the API has been ossified by amdgpu who again violates layering with drm_sched and by i915, who does something extremely weird in intel_breadcrumbs.c. They seem to have built their own fence there. amdgpu should be portable though. P.
