Changes in / [13cdc8c:ee3da78]
- Files:
-
- 12 edited
-
libcfa/src/concurrency/io.cfa (modified) (7 diffs)
-
libcfa/src/concurrency/kernel.cfa (modified) (3 diffs)
-
libcfa/src/concurrency/kernel.hfa (modified) (1 diff)
-
libcfa/src/concurrency/kernel/startup.cfa (modified) (1 diff)
-
src/AST/Convert.cpp (modified) (1 diff)
-
src/AST/Decl.cpp (modified) (1 diff)
-
src/AST/Type.cpp (modified) (1 diff)
-
src/AST/Type.hpp (modified) (1 diff)
-
src/Concurrency/KeywordsNew.cpp (modified) (2 diffs)
-
src/ResolvExpr/Resolver.cc (modified) (1 diff)
-
src/Validate/Autogen.cpp (modified) (2 diffs)
-
src/Validate/ForallPointerDecay.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/io.cfa
r13cdc8c ree3da78 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 -
libcfa/src/concurrency/kernel.cfa
r13cdc8c ree3da78 642 642 643 643 switch(fd) { 644 __attribute__((unused)) int ret;645 644 case 0: 646 645 // If the processor isn't ready to sleep then the exchange will already wake it up … … 660 659 // If the processor was ready to sleep, we need to wake it up with an actual write 661 660 val = 1; 662 ret = eventfd_write( fd, val ); 663 /* paranoid */ verifyf( ret == 0, "Expected return to be 0, was %d\n", ret ); 661 eventfd_write( fd, val ); 664 662 665 663 #if !defined(__CFA_NO_STATISTICS__) … … 684 682 this->idle_wctx.sem = 1; 685 683 686 this->idle_wctx.wake__time = rdtscl();687 688 684 eventfd_t val; 689 685 val = 1; 690 __attribute__((unused)) int ret = eventfd_write( this->idle_wctx.evfd, val ); 691 692 /* paranoid */ verifyf( ret == 0, "Expected return to be 0, was %d\n", ret ); 686 eventfd_write( this->idle_wctx.evfd, val ); 687 693 688 /* paranoid */ verify( ! __preemption_enabled() ); 694 689 } -
libcfa/src/concurrency/kernel.hfa
r13cdc8c ree3da78 74 74 // unused if not using io_uring for idle sleep 75 75 io_future_t * ftr; 76 77 volatile unsigned long long wake__time;78 volatile unsigned long long sleep_time;79 volatile unsigned long long drain_time;80 76 }; 81 77 -
libcfa/src/concurrency/kernel/startup.cfa
r13cdc8c ree3da78 558 558 559 559 idle_wctx.sem = 0; 560 idle_wctx.wake__time = 0;561 560 562 561 // I'm assuming these two are reserved for standard input and output -
src/AST/Convert.cpp
r13cdc8c ree3da78 2717 2717 2718 2718 for (auto & param : foralls) { 2719 ty->forall.emplace_back(new ast::TypeInstType(param ));2719 ty->forall.emplace_back(new ast::TypeInstType(param->name, param)); 2720 2720 for (auto asst : param->assertions) { 2721 2721 ty->assertions.emplace_back(new ast::VariableExpr({}, asst)); -
src/AST/Decl.cpp
r13cdc8c ree3da78 68 68 } 69 69 for (auto & tp : this->type_params) { 70 ftype->forall.emplace_back(new TypeInstType(tp ));70 ftype->forall.emplace_back(new TypeInstType(tp->name, tp)); 71 71 for (auto & ap: tp->assertions) { 72 72 ftype->assertions.emplace_back(new VariableExpr(loc, ap)); -
src/AST/Type.cpp
r13cdc8c ree3da78 147 147 // --- TypeInstType 148 148 149 TypeInstType::TypeInstType( const TypeDecl * b,150 CV::Qualifiers q, std::vector<ptr<Attribute>> && as )151 : BaseInstType( b->name, q, move(as) ), base( b ), kind( b->kind ) {}152 153 149 void TypeInstType::set_base( const TypeDecl * b ) { 154 150 base = b; -
src/AST/Type.hpp
r13cdc8c ree3da78 421 421 std::vector<ptr<Attribute>> && as = {} ) 422 422 : BaseInstType( n, q, std::move(as) ), base( b ), kind( b->kind ) {} 423 424 TypeInstType( const TypeDecl * b,425 CV::Qualifiers q = {}, std::vector<ptr<Attribute>> && as = {} );426 427 423 TypeInstType( const std::string& n, TypeDecl::Kind k, CV::Qualifiers q = {}, 428 424 std::vector<ptr<Attribute>> && as = {} ) -
src/Concurrency/KeywordsNew.cpp
r13cdc8c ree3da78 88 88 auto typeDecl = ast::deepCopy( typeParam ); 89 89 mutFunc->type_params.push_back( typeDecl ); 90 mutType->forall.push_back( new ast::TypeInstType( typeDecl ) ); 90 mutType->forall.push_back( 91 new ast::TypeInstType( typeDecl->name, typeDecl ) ); 91 92 for ( auto & assertion : typeDecl->assertions ) { 92 93 mutFunc->assertions.push_back( assertion ); … … 107 108 for ( const ast::ptr<ast::TypeDecl> & typeDecl : mutFunc->type_params ) { 108 109 paramTypeInst->params.push_back( 109 new ast::TypeExpr( location, new ast::TypeInstType( typeDecl ) ) ); 110 new ast::TypeExpr( location, 111 new ast::TypeInstType( typeDecl->name, typeDecl ) ) ); 110 112 typeParamInst->params.push_back( 111 new ast::TypeExpr( location, new ast::TypeInstType( typeDecl ) ) ); 113 new ast::TypeExpr( location, 114 new ast::TypeInstType( typeDecl->name, typeDecl ) ) ); 112 115 } 113 116 -
src/ResolvExpr/Resolver.cc
r13cdc8c ree3da78 1385 1385 for (auto & typeParam : mutDecl->type_params) { 1386 1386 symtab.addType(typeParam); 1387 mutType->forall.emplace_back(new ast::TypeInstType(typeParam ));1387 mutType->forall.emplace_back(new ast::TypeInstType(typeParam->name, typeParam)); 1388 1388 } 1389 1389 for (auto & asst : mutDecl->assertions) { -
src/Validate/Autogen.cpp
r13cdc8c ree3da78 248 248 structInst.params.push_back( new ast::TypeExpr( 249 249 typeDecl->location, 250 new ast::TypeInstType( typeDecl )250 new ast::TypeInstType( typeDecl->name, typeDecl ) 251 251 ) ); 252 252 } … … 264 264 unionInst.params.push_back( new ast::TypeExpr( 265 265 unionDecl->location, 266 new ast::TypeInstType( typeDecl )266 new ast::TypeInstType( typeDecl->name, typeDecl ) 267 267 ) ); 268 268 } -
src/Validate/ForallPointerDecay.cpp
r13cdc8c ree3da78 41 41 for ( auto & type_param : decl->type_params ) { 42 42 type->forall.emplace_back( 43 new ast::TypeInstType( type_param ) );43 new ast::TypeInstType( type_param->name, type_param ) ); 44 44 } 45 45 for ( auto & assertion : decl->assertions ) {
Note:
See TracChangeset
for help on using the changeset viewer.