Changeset 8e4aa05 for libcfa/src/concurrency/io/types.hfa
- Timestamp:
- Mar 4, 2021, 7:40:25 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 77d601f
- Parents:
- 342af53 (diff), a5040fe (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/io/types.hfa
r342af53 r8e4aa05 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // io/types.hfa -- 7 // io/types.hfa -- PRIVATE 8 // Types used by the I/O subsystem 8 9 // 9 10 // Author : Thierry Delisle … … 21 22 22 23 #include "bits/locks.hfa" 24 #include "kernel/fwd.hfa" 23 25 24 26 #if defined(CFA_HAVE_LINUX_IO_URING_H) 25 #define LEADER_LOCK 26 struct __leaderlock_t { 27 struct $thread * volatile value; // ($thread) next_leader | (bool:1) is_locked 28 }; 27 #include "bits/sequence.hfa" 28 #include "monitor.hfa" 29 29 30 static inline void ?{}( __leaderlock_t & this ) { this.value = 0p; } 30 struct processor; 31 monitor $io_arbiter; 31 32 32 33 //----------------------------------------------------------------------- 33 34 // Ring Data structure 34 struct __submition_data { 35 // Head and tail of the ring (associated with array) 36 volatile __u32 * head; 37 volatile __u32 * tail; 38 volatile __u32 prev_head; 35 struct __sub_ring_t { 36 struct { 37 // Head and tail of the ring (associated with array) 38 volatile __u32 * head; // one passed last index consumed by the kernel 39 volatile __u32 * tail; // one passed last index visible to the kernel 40 volatile __u32 released; // one passed last index released back to the free list 39 41 40 // The actual kernel ring which uses head/tail 41 // indexes into the sqes arrays 42 __u32 * array; 42 // The actual kernel ring which uses head/tail 43 // indexes into the sqes arrays 44 __u32 * array; 45 } kring; 46 47 struct { 48 volatile __u32 head; 49 volatile __u32 tail; 50 // The ring which contains free allocations 51 // indexes into the sqes arrays 52 __u32 * array; 53 } free_ring; 54 55 // number of sqes to submit on next system call. 56 __u32 to_submit; 43 57 44 58 // number of entries and mask to go with it … … 46 60 const __u32 * mask; 47 61 48 // Submission flags (Not sure what for)62 // Submission flags, currently only IORING_SETUP_SQPOLL 49 63 __u32 * flags; 50 64 51 // number of sqes not submitted (whatever that means) 65 // number of sqes not submitted 66 // From documentation : [dropped] is incremented for each invalid submission queue entry encountered in the ring buffer. 52 67 __u32 * dropped; 53 68 54 // Like head/tail but not seen by the kernel55 volatile __u32 * ready;56 __u32 ready_cnt;57 __u32 prev_ready;58 59 #if defined(LEADER_LOCK)60 __leaderlock_t submit_lock;61 #else62 __spinlock_t submit_lock;63 #endif64 __spinlock_t release_lock;65 66 69 // A buffer of sqes (not the actual ring) 67 volatilestruct io_uring_sqe * sqes;70 struct io_uring_sqe * sqes; 68 71 69 72 // The location and size of the mmaped area … … 72 75 }; 73 76 74 struct __c ompletion_data{77 struct __cmp_ring_t { 75 78 // Head and tail of the ring 76 79 volatile __u32 * head; … … 81 84 const __u32 * num; 82 85 83 // number of cqes not submitted (whatever that means)86 // I don't know what this value is for 84 87 __u32 * overflow; 85 88 … … 92 95 }; 93 96 94 struct __io_data { 95 struct __submition_data submit_q; 96 struct __completion_data completion_q; 97 struct __attribute__((aligned(128))) $io_context { 98 $io_arbiter * arbiter; 99 processor * proc; 100 101 struct { 102 volatile bool empty; 103 condition blocked; 104 } ext_sq; 105 106 struct __sub_ring_t sq; 107 struct __cmp_ring_t cq; 97 108 __u32 ring_flags; 98 109 int fd; 99 int efd; 100 bool eager_submits:1; 101 bool poller_submits:1; 110 }; 111 112 monitor __attribute__((aligned(128))) $io_arbiter { 113 struct { 114 condition blocked; 115 $io_context * ctx; 116 volatile bool flag; 117 } pending; 102 118 }; 103 119 … … 131 147 #endif 132 148 133 struct $io_ctx_thread; 134 void __ioctx_register($io_ctx_thread & ctx); 135 void __ioctx_prepare_block($io_ctx_thread & ctx); 136 void __sqe_clean( volatile struct io_uring_sqe * sqe ); 149 // void __ioctx_prepare_block($io_context & ctx); 137 150 #endif 138 151
Note:
See TracChangeset
for help on using the changeset viewer.