<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/include/linux/dma-fence.h, branch linux-rolling-lts</title>
<subtitle>Hosts the 0x221E linux distro kernel.</subtitle>
<id>https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-rolling-lts</id>
<link rel='self' href='https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-rolling-lts'/>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/'/>
<updated>2025-06-13T07:26:49Z</updated>
<entry>
<title>dma-fence: Add safe access helpers and document the rules</title>
<updated>2025-06-13T07:26:49Z</updated>
<author>
<name>Tvrtko Ursulin</name>
<email>tvrtko.ursulin@igalia.com</email>
</author>
<published>2025-06-10T16:42:25Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=506aa8b02a8d6898c64cc095d233fbae1cef8b8a'/>
<id>urn:sha1:506aa8b02a8d6898c64cc095d233fbae1cef8b8a</id>
<content type='text'>
Dma-fence objects currently suffer from a potential use after free problem
where fences exported to userspace and other drivers can outlive the
exporting driver, or the associated data structures.

The discussion on how to address this concluded that adding reference
counting to all the involved objects is not desirable, since it would need
to be very wide reaching and could cause unloadable drivers if another
entity would be holding onto a signaled fence reference potentially
indefinitely.

This patch enables the safe access by introducing and documenting a
contract between fence exporters and users. It documents a set of
contraints and adds helpers which a) drivers with potential to suffer from
the use after free must use and b) users of the dma-fence API must use as
well.

Premise of the design has multiple sides:

1. Drivers (fence exporters) MUST ensure a RCU grace period between
signalling a fence and freeing the driver private data associated with it.

The grace period does not have to follow the signalling immediately but
HAS to happen before data is freed.

2. Users of the dma-fence API marked with such requirement MUST contain
the complete access to the data within a single code block guarded by
rcu_read_lock() and rcu_read_unlock().

The combination of the two ensures that whoever sees the
DMA_FENCE_FLAG_SIGNALED_BIT not set is guaranteed to have access to a
valid fence-&gt;lock and valid data potentially accessed by the fence-&gt;ops
virtual functions, until the call to rcu_read_unlock().

3. Module unload (fence-&gt;ops) disappearing is for now explicitly not
handled. That would required a more complex protection, possibly needing
SRCU instead of RCU to handle callers such as dma_fence_release() and
dma_fence_wait_timeout(), where race between
dma_fence_enable_sw_signaling, signalling, and dereference of
fence-&gt;ops-&gt;wait() would need a sleeping SRCU context.

Signed-off-by: Tvrtko Ursulin &lt;tvrtko.ursulin@igalia.com&gt;
Reviewed-by: Christian König &lt;christian.koenig@amd.com&gt;
Signed-off-by: Tvrtko Ursulin &lt;tursulin@ursulin.net&gt;
Link: https://lore.kernel.org/r/20250610164226.10817-4-tvrtko.ursulin@igalia.com
</content>
</entry>
<entry>
<title>dma-fence: Add helpers for accessing driver and timeline name</title>
<updated>2025-06-03T16:38:22Z</updated>
<author>
<name>Tvrtko Ursulin</name>
<email>tvrtko.ursulin@igalia.com</email>
</author>
<published>2025-05-15T09:49:58Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=ecec875a6c3379017af57e3c7ba51de0501fe750'/>
<id>urn:sha1:ecec875a6c3379017af57e3c7ba51de0501fe750</id>
<content type='text'>
Add some helpers in order to enable preventing dma-fence users accessing
the implementation details directly and make the implementation itself use
them.

This will also enable later adding some asserts to a consolidated
location.

Signed-off-by: Tvrtko Ursulin &lt;tvrtko.ursulin@igalia.com&gt;
Reviewed-by: Christian König &lt;christian.koenig@amd.com&gt;
Signed-off-by: Tvrtko Ursulin &lt;tursulin@ursulin.net&gt;
Link: https://lore.kernel.org/r/20250515095004.28318-4-tvrtko.ursulin@igalia.com
</content>
</entry>
<entry>
<title>dma-fence: Use a flag for 64-bit seqnos</title>
<updated>2025-06-03T16:38:04Z</updated>
<author>
<name>Tvrtko Ursulin</name>
<email>tvrtko.ursulin@igalia.com</email>
</author>
<published>2025-05-15T09:49:57Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=bf33a0003d9e3b0546f2d7e91bebfd67af59f275'/>
<id>urn:sha1:bf33a0003d9e3b0546f2d7e91bebfd67af59f275</id>
<content type='text'>
With the goal of reducing the need for drivers to touch (and dereference)
fence-&gt;ops, we move the 64-bit seqnos flag from struct dma_fence_ops to
the fence-&gt;flags.

Drivers which were setting this flag are changed to use new
dma_fence_init64() instead of dma_fence_init().

v2:
 * Streamlined init and added kerneldoc.
 * Rebase for amdgpu userq which landed since.

Signed-off-by: Tvrtko Ursulin &lt;tvrtko.ursulin@igalia.com&gt;
Reviewed-by: Christian König &lt;christian.koenig@amd.com&gt; # v1
Signed-off-by: Tvrtko Ursulin &lt;tursulin@ursulin.net&gt;
Link: https://lore.kernel.org/r/20250515095004.28318-3-tvrtko.ursulin@igalia.com
</content>
</entry>
<entry>
<title>dma-buf: Add forward declaration of struct seq_file in dma-fence.h</title>
<updated>2025-06-02T12:31:51Z</updated>
<author>
<name>Herbert Xu</name>
<email>herbert@gondor.apana.org.au</email>
</author>
<published>2025-05-30T08:40:05Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=db5f4ec4aa14c8051fcc4af65534f4e47a58f436'/>
<id>urn:sha1:db5f4ec4aa14c8051fcc4af65534f4e47a58f436</id>
<content type='text'>
Add forward declaration of struct seq_file before using it in
function prototype.

Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Reviewed-by: Christian König &lt;christian.koenig@amd.com&gt;
Signed-off-by: Christian König &lt;christian.koenig@amd.com&gt;
Link: https://lore.kernel.org/r/aDlu5TGyA1WuMsvw@gondor.apana.org.au
</content>
</entry>
<entry>
<title>dma-fence: Change signature of __dma_fence_is_later</title>
<updated>2025-05-15T13:05:29Z</updated>
<author>
<name>Tvrtko Ursulin</name>
<email>tvrtko.ursulin@igalia.com</email>
</author>
<published>2025-05-15T09:49:56Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=549810e918155cc00d65d44ed3e7d2bd0aa89df9'/>
<id>urn:sha1:549810e918155cc00d65d44ed3e7d2bd0aa89df9</id>
<content type='text'>
With the goal of reducing the need for drivers to touch (and dereference)
fence-&gt;ops, we change the prototype of __dma_fence_is_later() to take
fence instead of fence-&gt;ops.

Signed-off-by: Tvrtko Ursulin &lt;tvrtko.ursulin@igalia.com&gt;
Reviewed-by: Christian König &lt;christian.koenig@amd.com&gt;
Link: https://lore.kernel.org/r/20250515095004.28318-2-tvrtko.ursulin@igalia.com
Signed-off-by: Christian König &lt;christian.koenig@amd.com&gt;
</content>
</entry>
<entry>
<title>dma-buf/dma-fence: remove unnecessary callbacks</title>
<updated>2025-03-06T14:20:53Z</updated>
<author>
<name>Christian König</name>
<email>christian.koenig@amd.com</email>
</author>
<published>2024-09-18T06:16:57Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=2ce07fea3cc8b866f7955a7ce1d62b0cc1f74819'/>
<id>urn:sha1:2ce07fea3cc8b866f7955a7ce1d62b0cc1f74819</id>
<content type='text'>
The fence_value_str and timeline_value_str callbacks were just an
unnecessary abstraction in the SW sync implementation.

The only caller of those callbacks already knew that the fence in
questions is a timeline_fence. So print the values directly instead
of using a redirection.

Additional to that remove the implementations from virtgpu and vgem.
As far as I can see those were never used in the first place.

Signed-off-by: Christian König &lt;christian.koenig@amd.com&gt;
Reviewed-by: Simona Vetter &lt;simona.vetter@ffwll.ch&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20250211163109.12200-3-christian.koenig@amd.com
</content>
</entry>
<entry>
<title>dma-buf: fix incorrect dma-fence documentation v2</title>
<updated>2025-03-06T14:20:43Z</updated>
<author>
<name>Christian König</name>
<email>christian.koenig@amd.com</email>
</author>
<published>2024-12-10T09:08:42Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=2b2d7ca7ce25fbec8389e7d85e57742caa47c97d'/>
<id>urn:sha1:2b2d7ca7ce25fbec8389e7d85e57742caa47c97d</id>
<content type='text'>
There isn't much worse than documentation giving an incorrect advise.
Grabbing a spinlock while interrupts are disabled usually means that you
must also disable interrupts for all other uses of this spinlock.

Otherwise really hard to debug issues can occur. So fix that invalid
documentation.

v2: use Dmitry's suggestion on the documentation

Signed-off-by: Christian König &lt;christian.koenig@amd.com&gt;
Reviewed-by: Simona Vetter &lt;simona.vetter@ffwll.ch&gt; (v1)
Link: https://patchwork.freedesktop.org/patch/msgid/20250211163109.12200-2-christian.koenig@amd.com
</content>
</entry>
<entry>
<title>dma-buf: give examples of error codes to use</title>
<updated>2024-09-06T16:05:58Z</updated>
<author>
<name>Christian König</name>
<email>ckoenig.leichtzumerken@gmail.com</email>
</author>
<published>2024-08-26T12:25:39Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=a401bd1264b400f96a4cf61ed3fc144008e97a4e'/>
<id>urn:sha1:a401bd1264b400f96a4cf61ed3fc144008e97a4e</id>
<content type='text'>
The dma_fence_set_error() function allows to set an error code on a
dma_fence object before it is signaled.

Document some of the potential error codes drivers should use and
especially what they mean.

Signed-off-by: Christian König &lt;christian.koenig@amd.com&gt;
Acked-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Reviewed-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20240826122541.85663-2-christian.koenig@amd.com
</content>
</entry>
<entry>
<title>Reapply "drm/qxl: simplify qxl_fence_wait"</title>
<updated>2024-05-06T20:28:59Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2024-05-06T20:28:59Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=3628e0383dd349f02f882e612ab6184e4bb3dc10'/>
<id>urn:sha1:3628e0383dd349f02f882e612ab6184e4bb3dc10</id>
<content type='text'>
This reverts commit 07ed11afb68d94eadd4ffc082b97c2331307c5ea.

Stephen Rostedt reports:
 "I went to run my tests on my VMs and the tests hung on boot up.
  Unfortunately, the most I ever got out was:

  [   93.607888] Testing event system initcall: OK
  [   93.667730] Running tests on all trace events:
  [   93.669757] Testing all events: OK
  [   95.631064] ------------[ cut here ]------------
  Timed out after 60 seconds"

and further debugging points to a possible circular locking dependency
between the console_owner locking and the worker pool locking.

Reverting the commit allows Steve's VM to boot to completion again.

[ This may obviously result in the "[TTM] Buffer eviction failed"
  messages again, which was the reason for that original revert. But at
  this point this seems preferable to a non-booting system... ]

Reported-and-bisected-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Link: https://lore.kernel.org/all/20240502081641.457aa25f@gandalf.local.home/
Acked-by: Maxime Ripard &lt;mripard@kernel.org&gt;
Cc: Alex Constantino &lt;dreaming.about.electric.sheep@gmail.com&gt;
Cc: Maxime Ripard &lt;mripard@kernel.org&gt;
Cc: Timo Lindfors &lt;timo.lindfors@iki.fi&gt;
Cc: Dave Airlie &lt;airlied@redhat.com&gt;
Cc: Gerd Hoffmann &lt;kraxel@redhat.com&gt;
Cc: Maarten Lankhorst &lt;maarten.lankhorst@linux.intel.com&gt;
Cc: Thomas Zimmermann &lt;tzimmermann@suse.de&gt;
Cc: Daniel Vetter &lt;daniel@ffwll.ch&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>Revert "drm/qxl: simplify qxl_fence_wait"</title>
<updated>2024-04-05T13:10:31Z</updated>
<author>
<name>Alex Constantino</name>
<email>dreaming.about.electric.sheep@gmail.com</email>
</author>
<published>2024-04-04T18:14:48Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=07ed11afb68d94eadd4ffc082b97c2331307c5ea'/>
<id>urn:sha1:07ed11afb68d94eadd4ffc082b97c2331307c5ea</id>
<content type='text'>
This reverts commit 5a838e5d5825c85556011478abde708251cc0776.

Changes from commit 5a838e5d5825 ("drm/qxl: simplify qxl_fence_wait") would
result in a '[TTM] Buffer eviction failed' exception whenever it reached a
timeout.
Due to a dependency to DMA_FENCE_WARN this also restores some code deleted
by commit d72277b6c37d ("dma-buf: nuke DMA_FENCE_TRACE macros v2").

Fixes: 5a838e5d5825 ("drm/qxl: simplify qxl_fence_wait")
Link: https://lore.kernel.org/regressions/ZTgydqRlK6WX_b29@eldamar.lan/
Reported-by: Timo Lindfors &lt;timo.lindfors@iki.fi&gt;
Closes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1054514
Signed-off-by: Alex Constantino &lt;dreaming.about.electric.sheep@gmail.com&gt;
Signed-off-by: Maxime Ripard &lt;mripard@kernel.org&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20240404181448.1643-2-dreaming.about.electric.sheep@gmail.com
</content>
</entry>
</feed>
