Changes in libcfa/src/concurrency/io.cfa [bdfd0bd:ff55092]
- File:
-
- 1 edited
-
libcfa/src/concurrency/io.cfa (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/io.cfa
rbdfd0bd rff55092 96 96 static void ioring_syscsll( struct $io_context & ctx, unsigned int min_comp, unsigned int flags ) { 97 97 __STATS__( true, io.calls.flush++; ) 98 int ret; 99 for() { 100 ret = syscall( __NR_io_uring_enter, ctx.fd, ctx.sq.to_submit, min_comp, flags, (sigset_t *)0p, _NSIG / 8); 101 if( ret < 0 ) { 102 switch((int)errno) { 103 case EINTR: 104 continue; 105 case EAGAIN: 106 case EBUSY: 107 // Update statistics 108 __STATS__( false, io.calls.errors.busy ++; ) 109 return false; 110 default: 111 abort( "KERNEL ERROR: IO_URING SYSCALL - (%d) %s\n", (int)errno, strerror(errno) ); 112 } 98 int ret = syscall( __NR_io_uring_enter, ctx.fd, ctx.sq.to_submit, min_comp, flags, (sigset_t *)0p, _NSIG / 8); 99 if( ret < 0 ) { 100 switch((int)errno) { 101 case EAGAIN: 102 case EINTR: 103 case EBUSY: 104 // Update statistics 105 __STATS__( false, io.calls.errors.busy ++; ) 106 return false; 107 default: 108 abort( "KERNEL ERROR: IO_URING SYSCALL - (%d) %s\n", (int)errno, strerror(errno) ); 113 109 } 114 break;115 110 } 116 111 … … 184 179 // Ensure that the kernel only sees the new value of the head index after the CQEs have been read. 185 180 __atomic_store_n( ctx->cq.head, head + count, __ATOMIC_SEQ_CST ); 186 ctx->proc->idle_wctx.drain_time = ts_next;187 181 188 182 __cfadbg_print_safe(io, "Kernel I/O : %u completed age %llu\n", count, ts_next); … … 236 230 const unsigned long long cutoff = calc_cutoff(ctsc, ctx->cq.id, ctxs_count, io.data, io.tscs, __shard_factor.io); 237 231 const unsigned long long age = moving_average(ctsc, io.tscs[target].tv, io.tscs[target].ma); 238 __cfadbg_print_safe(io, "Kernel I/O: Help attempt on %u from %u, age %'llu vs cutoff %'llu, %s\n", target, ctx->cq.id, age, cutoff, age > cutoff ? "yes" : "no");232 __cfadbg_print_safe(io, "Kernel I/O: Help attempt on %u from %u, age %'llu vs cutoff %'llu, %s\n", target, this, age, cutoff, age > cutoff ? "yes" : "no"); 239 233 if(age <= cutoff) break HELP; 240 234 … … 641 635 642 636 // We can proceed to the fast path 643 if( !__alloc(ctx, &idx, 1) ) { 644 /* paranoid */ verify( false ); // for now check if this happens, next time just abort the sleep. 645 return false; 646 } 637 if( !__alloc(ctx, &idx, 1) ) return false; 647 638 648 639 // Allocation was successful … … 674 665 675 666 /* paranoid */ verify( sqe->user_data == (uintptr_t)&future ); 676 __submit _only( ctx, &idx, 1);667 __submit( ctx, &idx, 1, true ); 677 668 678 669 /* paranoid */ verify( proc == __cfaabi_tls.this_processor ); … … 685 676 iovec iov; 686 677 __atomic_acquire( &proc->io.ctx->cq.lock ); 687 688 __attribute__((used)) volatile bool was_reset = false;689 678 690 679 with( proc->idle_wctx) { … … 698 687 iov.iov_len = sizeof(eventfd_t); 699 688 __kernel_read(proc, *ftr, iov, evfd ); 700 ftr->result = 0xDEADDEAD;701 *((eventfd_t *)rdbuf) = 0xDEADDEADDEADDEAD;702 was_reset = true;703 689 } 704 690 } 705 691 706 if( !__atomic_load_n( &proc->do_terminate, __ATOMIC_SEQ_CST ) ) { 707 __ioarbiter_flush( *proc->io.ctx ); 708 proc->idle_wctx.sleep_time = rdtscl(); 709 ioring_syscsll( *proc->io.ctx, 1, IORING_ENTER_GETEVENTS); 710 } 692 __ioarbiter_flush( *proc->io.ctx ); 693 ioring_syscsll( *proc->io.ctx, 1, IORING_ENTER_GETEVENTS); 711 694 712 695 ready_schedule_lock(); 713 696 __cfa_do_drain( proc->io.ctx, proc->cltr ); 714 697 ready_schedule_unlock(); 715 716 asm volatile ("" :: "m" (was_reset));717 698 } 718 699 #endif
Note:
See TracChangeset
for help on using the changeset viewer.