Changeset 762fbc1 for libcfa/src/concurrency
- Timestamp:
- Aug 15, 2020, 12:20:44 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 36de20d
- Parents:
- 7f51b9d (diff), 5715d43 (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
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/coroutine.cfa
r7f51b9d r762fbc1 215 215 return cor; 216 216 } 217 218 struct $coroutine * __cfactx_cor_active(void) { 219 return active_coroutine(); 220 } 217 221 } 218 222 -
libcfa/src/concurrency/invoke.c
r7f51b9d r762fbc1 29 29 // Called from the kernel when starting a coroutine or task so must switch back to user mode. 30 30 31 extern struct $coroutine * __cfactx_cor_active(void); 31 32 extern struct $coroutine * __cfactx_cor_finish(void); 32 33 extern void __cfactx_cor_leave ( struct $coroutine * ); … … 35 36 extern void disable_interrupts() OPTIONAL_THREAD; 36 37 extern void enable_interrupts( __cfaabi_dbg_ctx_param ); 38 39 struct exception_context_t * this_exception_context() { 40 return &__get_stack( __cfactx_cor_active() )->exception_context; 41 } 37 42 38 43 void __cfactx_invoke_coroutine( -
libcfa/src/concurrency/invoke.h
r7f51b9d r762fbc1 98 98 } 99 99 100 struct exception_context_t * this_exception_context(); 101 100 102 // struct which calls the monitor is accepting 101 103 struct __waitfor_mask_t { -
libcfa/src/concurrency/io.cfa
r7f51b9d r762fbc1 359 359 360 360 // We got the lock 361 // Collect the submissions 361 362 unsigned to_submit = __collect_submitions( ring ); 363 364 // Actually submit 362 365 int ret = __io_uring_enter( ring, to_submit, false ); 363 if( ret < 0 ) { 364 unlock(ring.submit_q.lock); 365 return; 366 } 367 368 /* paranoid */ verify( ret > 0 || to_submit == 0 || (ring.ring_flags & IORING_SETUP_SQPOLL) ); 366 367 unlock(ring.submit_q.lock); 368 if( ret < 0 ) return; 369 369 370 370 // Release the consumed SQEs … … 372 372 373 373 // update statistics 374 __STATS__( true,374 __STATS__( false, 375 375 io.submit_q.submit_avg.rdy += to_submit; 376 376 io.submit_q.submit_avg.csm += ret; 377 377 io.submit_q.submit_avg.cnt += 1; 378 378 ) 379 380 unlock(ring.submit_q.lock);381 379 } 382 380 else { -
libcfa/src/concurrency/io/setup.cfa
r7f51b9d r762fbc1 298 298 if( params_in.poll_complete ) params.flags |= IORING_SETUP_IOPOLL; 299 299 300 uint32_t nentries = params_in.num_entries; 300 uint32_t nentries = params_in.num_entries != 0 ? params_in.num_entries : 256; 301 if( !is_pow2(nentries) ) { 302 abort("ERROR: I/O setup 'num_entries' must be a power of 2\n"); 303 } 304 if( params_in.poller_submits && params_in.eager_submits ) { 305 abort("ERROR: I/O setup 'poller_submits' and 'eager_submits' cannot be used together\n"); 306 } 301 307 302 308 int fd = syscall(__NR_io_uring_setup, nentries, ¶ms ); -
libcfa/src/concurrency/iocall.cfa
r7f51b9d r762fbc1 101 101 #endif 102 102 103 104 103 #define __submit_prelude \ 105 104 if( 0 != (submit_flags & LINK_FLAGS) ) { errno = ENOTSUP; return -1; } \ … … 110 109 struct io_uring_sqe * sqe; \ 111 110 uint32_t idx; \ 111 uint8_t sflags = REGULAR_FLAGS & submit_flags; \ 112 112 [sqe, idx] = __submit_alloc( ring, (uint64_t)(uintptr_t)&data ); \ 113 sqe->flags = REGULAR_FLAGS & submit_flags;113 sqe->flags = sflags; 114 114 115 115 #define __submit_wait \ … … 186 186 __submit_prelude 187 187 188 (*sqe){ IORING_OP_READV, fd, iov, iovcnt, offset }; 188 sqe->opcode = IORING_OP_READV; 189 sqe->ioprio = 0; 190 sqe->fd = fd; 191 sqe->off = offset; 192 sqe->addr = (uint64_t)(uintptr_t)iov; 193 sqe->len = iovcnt; 194 sqe->rw_flags = 0; 195 sqe->__pad2[0] = sqe->__pad2[1] = sqe->__pad2[2] = 0; 189 196 190 197 __submit_wait
Note:
See TracChangeset
for help on using the changeset viewer.