include/linux/dma-fence.h
Source file repositories/reference/linux-study-clean/include/linux/dma-fence.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/dma-fence.h- Extension
.h- Size
- 27546 bytes
- Lines
- 794
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/err.hlinux/wait.hlinux/list.hlinux/bitops.hlinux/kref.hlinux/sched.hlinux/printk.hlinux/rcupdate.hlinux/timekeeping.h
Detected Declarations
struct dma_fencestruct dma_fence_opsstruct dma_fence_cbstruct seq_filestruct dma_fencestruct dma_fence_cbstruct dma_fence_opsenum dma_fence_flag_bitsfunction dma_fence_was_initializedfunction dma_fence_putfunction periodfunction dma_fence_begin_signallingfunction dma_fence_end_signallingfunction dma_fence_test_signaled_flagfunction dma_fence_add_callbackfunction dma_fence_add_callbackfunction __dma_fence_is_laterfunction dma_fence_is_laterfunction dma_fence_is_later_or_samefunction fencefunction dma_fence_set_errorfunction dma_fence_timestampfunction dma_fence_wait_timeoutfunction dma_fence_is_arrayfunction dma_fence_is_chainfunction dma_fence_is_container
Annotated Snippet
struct dma_fence {
union {
spinlock_t *extern_lock;
spinlock_t inline_lock;
};
const struct dma_fence_ops __rcu *ops;
/*
* We clear the callback list on kref_put so that by the time we
* release the fence it is unused. No one should be adding to the
* cb_list that they don't themselves hold a reference for.
*
* The lifetime of the timestamp is similarly tied to both the
* rcu freelist and the cb_list. The timestamp is only set upon
* signaling while simultaneously notifying the cb_list. Ergo, we
* only use either the cb_list of timestamp. Upon destruction,
* neither are accessible, and so we can use the rcu. This means
* that the cb_list is *only* valid until the signal bit is set,
* and to read either you *must* hold a reference to the fence,
* and not just the rcu_read_lock.
*
* Listed in chronological order.
*/
union {
struct list_head cb_list;
/* @cb_list replaced by @timestamp on dma_fence_signal() */
ktime_t timestamp;
/* @timestamp replaced by @rcu on dma_fence_release() */
struct rcu_head rcu;
};
u64 context;
u64 seqno;
unsigned long flags;
struct kref refcount;
int error;
};
enum dma_fence_flag_bits {
DMA_FENCE_FLAG_INITIALIZED_BIT,
DMA_FENCE_FLAG_INLINE_LOCK_BIT,
DMA_FENCE_FLAG_SEQNO64_BIT,
DMA_FENCE_FLAG_SIGNALED_BIT,
DMA_FENCE_FLAG_TIMESTAMP_BIT,
DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT,
DMA_FENCE_FLAG_USER_BITS, /* must always be last member */
};
typedef void (*dma_fence_func_t)(struct dma_fence *fence,
struct dma_fence_cb *cb);
/**
* struct dma_fence_cb - callback for dma_fence_add_callback()
* @node: used by dma_fence_add_callback() to append this struct to fence::cb_list
* @func: dma_fence_func_t to call
*
* This struct will be initialized by dma_fence_add_callback(), additional
* data can be passed along by embedding dma_fence_cb in another struct.
*/
struct dma_fence_cb {
struct list_head node;
dma_fence_func_t func;
};
/**
* struct dma_fence_ops - operations implemented for fence
*
*/
struct dma_fence_ops {
/**
* @get_driver_name:
*
* Returns the driver name. This is a callback to allow drivers to
* compute the name at runtime, without having it to store permanently
* for each fence, or build a cache of some sort.
*
* This callback is mandatory.
*/
const char * (*get_driver_name)(struct dma_fence *fence);
/**
* @get_timeline_name:
*
* Return the name of the context this fence belongs to. This is a
* callback to allow drivers to compute the name at runtime, without
* having it to store permanently for each fence, or build a cache of
* some sort.
*
* This callback is mandatory.
*/
const char * (*get_timeline_name)(struct dma_fence *fence);
Annotation
- Immediate include surface: `linux/err.h`, `linux/wait.h`, `linux/list.h`, `linux/bitops.h`, `linux/kref.h`, `linux/sched.h`, `linux/printk.h`, `linux/rcupdate.h`.
- Detected declarations: `struct dma_fence`, `struct dma_fence_ops`, `struct dma_fence_cb`, `struct seq_file`, `struct dma_fence`, `struct dma_fence_cb`, `struct dma_fence_ops`, `enum dma_fence_flag_bits`, `function dma_fence_was_initialized`, `function dma_fence_put`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.