<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/include/linux/dma-fence.h, branch linux-7.0.y</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=linux-7.0.y</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=linux-7.0.y'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2025-12-04T14:03:40+00:00</updated>
<entry>
<title>dma-buf/dma-fence: Remove return code of signaling-functions</title>
<updated>2025-12-04T14:03:40+00:00</updated>
<author>
<name>Philipp Stanner</name>
<email>phasta@kernel.org</email>
</author>
<published>2025-12-01T10:50:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=88e721ab978a86426aa08da520de77430fa7bb84'/>
<id>urn:sha1:88e721ab978a86426aa08da520de77430fa7bb84</id>
<content type='text'>
All functions used for signaling a fence return an error code whose sole
purpose is to tell whether a fence was already signaled.

This is racy and has been used by almost no party in the kernel, and the
few users have been removed in preceding cleanup commits.

Turn all signaling-functions into void-functions.

Suggested-by: Christian König &lt;christian.koenig@amd.com&gt;
Reviewed-by: Christian König &lt;christian.koenig@amd.com&gt;
Signed-off-by: Philipp Stanner &lt;phasta@kernel.org&gt;
Link: https://patch.msgid.link/20251201105011.19386-9-phasta@kernel.org
</content>
</entry>
<entry>
<title>dma-buf/dma-fence: Add dma_fence_check_and_signal()</title>
<updated>2025-12-04T14:03:40+00:00</updated>
<author>
<name>Philipp Stanner</name>
<email>phasta@kernel.org</email>
</author>
<published>2025-12-01T10:50:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c891b99d25ddbb6b8167f9bdb904d4abc5a53b6b'/>
<id>urn:sha1:c891b99d25ddbb6b8167f9bdb904d4abc5a53b6b</id>
<content type='text'>
The overwhelming majority of users of dma_fence signaling functions
don't care about whether the fence had already been signaled by someone
else. Therefore, the return code shall be removed from those functions.

For the few users who rely on the check, a new, specialized function
shall be provided.

Add dma_fence_check_and_signal(), which signals a fence if it had not
yet been signaled, and informs the user about that.

Add a counter part, dma_fence_check_and_signal_locked(), which doesn't
take the spinlock.

Reviewed-by: Christian König &lt;christian.koenig@amd.com&gt;
Signed-off-by: Philipp Stanner &lt;phasta@kernel.org&gt;
Link: https://patch.msgid.link/20251201105011.19386-4-phasta@kernel.org
</content>
</entry>
<entry>
<title>dma-buf/dma-fence: Add dma_fence_test_signaled_flag()</title>
<updated>2025-12-04T14:03:39+00:00</updated>
<author>
<name>Philipp Stanner</name>
<email>phasta@kernel.org</email>
</author>
<published>2025-12-01T10:50:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e58b4dea9054c85688c8f639ebdfc8115261dae2'/>
<id>urn:sha1:e58b4dea9054c85688c8f639ebdfc8115261dae2</id>
<content type='text'>
The dma_fence framework checks at many places whether the signaled flag
of a fence is already set. The code can be simplified and made more
readable by providing a helper function for that.

Add dma_fence_test_signaled_flag(), which only checks whether a fence is
signaled. Use it internally.

Suggested-by: Tvrtko Ursulin &lt;tvrtko.ursulin@igalia.com&gt;
Reviewed-by: Christian König &lt;christian.koenig@amd.com&gt;
Signed-off-by: Philipp Stanner &lt;phasta@kernel.org&gt;
Link: https://patch.msgid.link/20251201105011.19386-3-phasta@kernel.org
</content>
</entry>
<entry>
<title>dma-fence: Add safe access helpers and document the rules</title>
<updated>2025-06-13T07:26:49+00:00</updated>
<author>
<name>Tvrtko Ursulin</name>
<email>tvrtko.ursulin@igalia.com</email>
</author>
<published>2025-06-10T16:42:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/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:22+00:00</updated>
<author>
<name>Tvrtko Ursulin</name>
<email>tvrtko.ursulin@igalia.com</email>
</author>
<published>2025-05-15T09:49:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/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:04+00:00</updated>
<author>
<name>Tvrtko Ursulin</name>
<email>tvrtko.ursulin@igalia.com</email>
</author>
<published>2025-05-15T09:49:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/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:51+00:00</updated>
<author>
<name>Herbert Xu</name>
<email>herbert@gondor.apana.org.au</email>
</author>
<published>2025-05-30T08:40:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/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:29+00:00</updated>
<author>
<name>Tvrtko Ursulin</name>
<email>tvrtko.ursulin@igalia.com</email>
</author>
<published>2025-05-15T09:49:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/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:53+00:00</updated>
<author>
<name>Christian König</name>
<email>christian.koenig@amd.com</email>
</author>
<published>2024-09-18T06:16:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/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:43+00:00</updated>
<author>
<name>Christian König</name>
<email>christian.koenig@amd.com</email>
</author>
<published>2024-12-10T09:08:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/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>
</feed>
