Changeset d672350 for libcfa/src/concurrency/io
- Timestamp:
- Mar 21, 2022, 1:44:06 PM (4 years ago)
- Branches:
- ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
- Children:
- a76202d
- Parents:
- ef3c383 (diff), dbe2533 (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. - Location:
- libcfa/src/concurrency/io
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/io/setup.cfa
ref3c383 rd672350 39 39 40 40 #else 41 #pragma GCC diagnostic push 42 #pragma GCC diagnostic ignored "-Waddress-of-packed-member" 41 43 #include <errno.h> 42 44 #include <stdint.h> … … 56 58 57 59 #include "bitmanip.hfa" 58 #include "kernel_private.hfa" 60 #include "fstream.hfa" 61 #include "kernel/private.hfa" 59 62 #include "thread.hfa" 63 #pragma GCC diagnostic pop 60 64 61 65 void ?{}(io_context_params & this) { … … 111 115 this.ext_sq.empty = true; 112 116 (this.ext_sq.queue){}; 113 __io_uring_setup( this, cl.io.params, proc->idle_ fd );117 __io_uring_setup( this, cl.io.params, proc->idle_wctx.evfd ); 114 118 __cfadbg_print_safe(io_core, "Kernel I/O : Created ring for io_context %u (%p)\n", this.fd, &this); 115 119 } … … 121 125 __cfadbg_print_safe(io_core, "Kernel I/O : Destroyed ring for io_context %u\n", this.fd); 122 126 } 123 124 extern void __disable_interrupts_hard();125 extern void __enable_interrupts_hard();126 127 127 128 static void __io_uring_setup( $io_context & this, const io_context_params & params_in, int procfd ) { … … 213 214 214 215 // completion queue 216 cq.lock = 0; 215 217 cq.head = (volatile __u32 *)(((intptr_t)cq.ring_ptr) + params.cq_off.head); 216 218 cq.tail = (volatile __u32 *)(((intptr_t)cq.ring_ptr) + params.cq_off.tail); … … 226 228 __cfadbg_print_safe(io_core, "Kernel I/O : registering %d for completion with ring %d\n", procfd, fd); 227 229 228 __disable_interrupts_hard();229 230 230 int ret = syscall( __NR_io_uring_register, fd, IORING_REGISTER_EVENTFD, &procfd, 1); 231 231 if (ret < 0) { 232 232 abort("KERNEL ERROR: IO_URING EVENTFD REGISTER - %s\n", strerror(errno)); 233 233 } 234 235 __enable_interrupts_hard();236 234 237 235 __cfadbg_print_safe(io_core, "Kernel I/O : registered %d for completion with ring %d\n", procfd, fd); … … 258 256 struct __sub_ring_t & sq = this.sq; 259 257 struct __cmp_ring_t & cq = this.cq; 258 { 259 __u32 fhead = sq.free_ring.head; 260 __u32 ftail = sq.free_ring.tail; 261 262 __u32 total = *sq.num; 263 __u32 avail = ftail - fhead; 264 265 if(avail != total) abort | "Processor (" | (void*)this.proc | ") tearing down ring with" | (total - avail) | "entries allocated but not submitted, out of" | total; 266 } 260 267 261 268 // unmap the submit queue entries -
libcfa/src/concurrency/io/types.hfa
ref3c383 rd672350 23 23 #include "bits/locks.hfa" 24 24 #include "bits/queue.hfa" 25 #include "iofwd.hfa" 25 26 #include "kernel/fwd.hfa" 26 27 … … 77 78 78 79 struct __cmp_ring_t { 80 volatile bool lock; 81 79 82 // Head and tail of the ring 80 83 volatile __u32 * head; … … 170 173 // void __ioctx_prepare_block($io_context & ctx); 171 174 #endif 172 173 //-----------------------------------------------------------------------174 // IO user data175 struct io_future_t {176 future_t self;177 __s32 result;178 };179 180 static inline {181 thread$ * fulfil( io_future_t & this, __s32 result, bool do_unpark = true ) {182 this.result = result;183 return fulfil(this.self, do_unpark);184 }185 186 // Wait for the future to be fulfilled187 bool wait ( io_future_t & this ) { return wait (this.self); }188 void reset ( io_future_t & this ) { return reset (this.self); }189 bool available( io_future_t & this ) { return available(this.self); }190 }
Note:
See TracChangeset
for help on using the changeset viewer.