XenevaOS
Loading...
Searching...
No Matches
Public Attributes | List of all members
dma_fence Struct Reference

#include <dma-fence.h>

Collaboration diagram for dma_fence:
Collaboration graph
[legend]

Public Attributes

union { 
 
   spinlock_t *   extern_lock 
 
   spinlock_t   inline_lock 
 
};  
 
const struct dma_fence_ops __rcu * ops
 
union { 
 
   struct list_head   cb_list 
 
   ktime_t   timestamp 
 
   struct rcu_head   rcu 
 
};  
 
u64 context
 
u64 seqno
 
unsigned long flags
 
struct kref refcount
 
int error
 

Detailed Description

struct dma_fence - software synchronization primitive @refcount: refcount for this fence @ops: dma_fence_ops associated with this fence @rcu: used for releasing fence with kfree_rcu @cb_list: list of all callbacks to call @extern_lock: external spin_lock_irqsave used for locking (deprecated) @inline_lock: alternative internal spin_lock_irqsave used for locking @context: execution context this fence belongs to, returned by dma_fence_context_alloc() @seqno: the sequence number of this fence inside the execution context, can be compared to decide which fence would be signaled later. @flags: A mask of DMA_FENCE_FLAG_* defined below @timestamp: Timestamp when the fence was signaled. @error: Optional, only valid if < 0, must be set before calling dma_fence_signal, indicates that the fence has completed with an error.

the flags member must be manipulated and read using the appropriate atomic ops (bit_*), so taking the spinlock will not be needed most of the time.

DMA_FENCE_FLAG_INITIALIZED_BIT - fence was initialized DMA_FENCE_FLAG_INLINE_LOCK_BIT - use inline spinlock instead of external one DMA_FENCE_FLAG_SIGNALED_BIT - fence is already signaled DMA_FENCE_FLAG_TIMESTAMP_BIT - timestamp recorded for fence signaling DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT - enable_signaling might have been called DMA_FENCE_FLAG_USER_BITS - start of the unused bits, can be used by the implementer of the fence for its own purposes. Can be used in different ways by different fence implementers, so do not rely on this.

Since atomic bitops are used, this is not guaranteed to be the case. Particularly, if the bit was set, but dma_fence_signal was called right before this bit was set, it would have been able to set the DMA_FENCE_FLAG_SIGNALED_BIT, before enable_signaling was called. Adding a check for DMA_FENCE_FLAG_SIGNALED_BIT after setting DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT closes this race, and makes sure that after dma_fence_signal was called, any enable_signaling call will have either been completed, or never called at all.

Member Data Documentation

◆ [union]

union { ... } dma_fence

◆ [union]

union { ... } dma_fence

◆ cb_list

struct list_head dma_fence::cb_list

◆ context

u64 dma_fence::context

◆ error

int dma_fence::error

◆ extern_lock

spinlock_t* dma_fence::extern_lock

◆ flags

unsigned long dma_fence::flags

◆ inline_lock

spinlock_t dma_fence::inline_lock

◆ ops

const struct dma_fence_ops __rcu* dma_fence::ops

◆ rcu

struct rcu_head dma_fence::rcu

◆ refcount

struct kref dma_fence::refcount

◆ seqno

u64 dma_fence::seqno

◆ timestamp

ktime_t dma_fence::timestamp

The documentation for this struct was generated from the following file: