- Timestamp:
- Nov 22, 2021, 2:18:56 PM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
- Children:
- 2514f68b
- Parents:
- 7ef162b2
- Location:
- libcfa/src/concurrency
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/io.cfa
r7ef162b2 r6ddef36 502 502 } 503 503 504 bool __kernel_read(processor * proc, io_future_t & future, char buf[], int fd) { 505 $io_context * ctx = proc->io.ctx; 506 /* paranoid */ verify( ! __preemption_enabled() ); 507 /* paranoid */ verify( proc == __cfaabi_tls.this_processor ); 508 /* paranoid */ verify( ctx ); 509 510 __u32 idx; 511 struct io_uring_sqe * sqe; 512 513 // We can proceed to the fast path 514 if( !__alloc(ctx, &idx, 1) ) return false; 515 516 // Allocation was successful 517 __fill( &sqe, 1, &idx, ctx ); 518 519 sqe->opcode = IORING_OP_READ; 520 sqe->user_data = (uintptr_t)&future; 521 sqe->flags = 0; 522 sqe->ioprio = 0; 523 sqe->fd = 0; 524 sqe->off = 0; 525 sqe->fsync_flags = 0; 526 sqe->__pad2[0] = 0; 527 sqe->__pad2[1] = 0; 528 sqe->__pad2[2] = 0; 529 sqe->addr = (uintptr_t)buf; 530 sqe->len = sizeof(uint64_t); 531 532 asm volatile("": : :"memory"); 533 534 /* paranoid */ verify( sqe->user_data == (uintptr_t)&future ); 535 __submit( ctx, &idx, 1, true ); 536 537 /* paranoid */ verify( proc == __cfaabi_tls.this_processor ); 538 /* paranoid */ verify( ! __preemption_enabled() ); 539 } 504 #if !defined(IO_URING_IDLE) 505 bool __kernel_read(processor * proc, io_future_t & future, char buf[], int fd) { 506 $io_context * ctx = proc->io.ctx; 507 /* paranoid */ verify( ! __preemption_enabled() ); 508 /* paranoid */ verify( proc == __cfaabi_tls.this_processor ); 509 /* paranoid */ verify( ctx ); 510 511 __u32 idx; 512 struct io_uring_sqe * sqe; 513 514 // We can proceed to the fast path 515 if( !__alloc(ctx, &idx, 1) ) return false; 516 517 // Allocation was successful 518 __fill( &sqe, 1, &idx, ctx ); 519 520 sqe->opcode = IORING_OP_READ; 521 sqe->user_data = (uintptr_t)&future; 522 sqe->flags = 0; 523 sqe->ioprio = 0; 524 sqe->fd = 0; 525 sqe->off = 0; 526 sqe->fsync_flags = 0; 527 sqe->__pad2[0] = 0; 528 sqe->__pad2[1] = 0; 529 sqe->__pad2[2] = 0; 530 sqe->addr = (uintptr_t)buf; 531 sqe->len = sizeof(uint64_t); 532 533 asm volatile("": : :"memory"); 534 535 /* paranoid */ verify( sqe->user_data == (uintptr_t)&future ); 536 __submit( ctx, &idx, 1, true ); 537 538 /* paranoid */ verify( proc == __cfaabi_tls.this_processor ); 539 /* paranoid */ verify( ! __preemption_enabled() ); 540 } 541 #endif 540 542 #endif -
libcfa/src/concurrency/kernel.cfa
r7ef162b2 r6ddef36 135 135 static inline bool __maybe_io_drain( processor * ); 136 136 137 extern bool __kernel_read(processor * proc, io_future_t & future, char buf[], int fd); 137 #if defined(IO_URING_IDLE) && defined(CFA_HAVE_LINUX_IO_URING_H) 138 extern bool __kernel_read(processor * proc, io_future_t & future, char buf[], int fd); 139 #endif 138 140 139 141 extern void __disable_interrupts_hard();
Note: See TracChangeset
for help on using the changeset viewer.