Changeset 77ff383 for libcfa/src/concurrency
- Timestamp:
- Jan 15, 2021, 3:22:50 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum, stuck-waitfor-destruct
- Children:
- 02b73ea
- Parents:
- 03ecdcf (diff), d46bdac (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:
-
- 4 edited
-
io.cfa (modified) (1 diff)
-
io/setup.cfa (modified) (1 diff)
-
kernel.cfa (modified) (3 diffs)
-
stats.hfa (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/io.cfa
r03ecdcf r77ff383 390 390 block++; 391 391 392 abort( "Kernel I/O : all submit queue entries used, yielding\n" );393 394 392 yield(); 395 393 } -
libcfa/src/concurrency/io/setup.cfa
r03ecdcf r77ff383 42 42 void ^?{}(io_context & this, bool cluster_context) {} 43 43 44 void register_fixed_files( io_context &, int *, unsigned ) {} 45 void register_fixed_files( cluster &, int *, unsigned ) {} 46 44 47 #else 45 48 #include <errno.h> -
libcfa/src/concurrency/kernel.cfa
r03ecdcf r77ff383 140 140 preemption_scope scope = { this }; 141 141 142 #if !defined(__CFA_NO_STATISTICS__) 143 unsigned long long last_tally = rdtscl(); 144 #endif 145 146 142 147 __cfadbg_print_safe(runtime_core, "Kernel : core %p started\n", this); 143 148 … … 206 211 // Are we done? 207 212 if( __atomic_load_n(&this->do_terminate, __ATOMIC_SEQ_CST) ) break MAIN_LOOP; 213 214 #if !defined(__CFA_NO_STATISTICS__) 215 unsigned long long curr = rdtscl(); 216 if(curr > (last_tally + 500000000)) { 217 __tally_stats(this->cltr->stats, __cfaabi_tls.this_stats); 218 last_tally = curr; 219 } 220 #endif 208 221 } 209 222 … … 611 624 // Unexpected Terminating logic 612 625 //============================================================================================= 613 static __spinlock_t kernel_abort_lock; 614 static bool kernel_abort_called = false; 626 627 extern "C" { 628 extern void __cfaabi_real_abort(void); 629 } 630 static volatile bool kernel_abort_called = false; 615 631 616 632 void * kernel_abort(void) __attribute__ ((__nothrow__)) { 617 633 // abort cannot be recursively entered by the same or different processors because all signal handlers return when 618 634 // the globalAbort flag is true. 619 lock( kernel_abort_lock __cfaabi_dbg_ctx2 ); 635 bool first = __atomic_test_and_set( &kernel_abort_called, __ATOMIC_SEQ_CST); 636 637 // first task to abort ? 638 if ( !first ) { 639 // We aren't the first to abort. 640 // I give up, just let C handle it 641 __cfaabi_real_abort(); 642 } 620 643 621 644 // disable interrupts, it no longer makes sense to try to interrupt this processor 622 645 disable_interrupts(); 623 624 // first task to abort ?625 if ( kernel_abort_called ) { // not first task to abort ?626 unlock( kernel_abort_lock );627 628 sigset_t mask;629 sigemptyset( &mask );630 sigaddset( &mask, SIGALRM ); // block SIGALRM signals631 sigaddset( &mask, SIGUSR1 ); // block SIGALRM signals632 sigsuspend( &mask ); // block the processor to prevent further damage during abort633 _exit( EXIT_FAILURE ); // if processor unblocks before it is killed, terminate it634 }635 else {636 kernel_abort_called = true;637 unlock( kernel_abort_lock );638 }639 646 640 647 return __cfaabi_tls.this_thread; -
libcfa/src/concurrency/stats.hfa
r03ecdcf r77ff383 2 2 3 3 #include <stdint.h> 4 5 enum { 6 CFA_STATS_READY_Q = 0x01, 7 CFA_STATS_IO = 0x02, 8 }; 4 9 5 10 #if defined(__CFA_NO_STATISTICS__) … … 9 14 static inline void __print_stats( struct __stats_t *, int, const char *, const char *, void * ) {} 10 15 #else 11 enum {12 CFA_STATS_READY_Q = 0x01,13 #if defined(CFA_HAVE_LINUX_IO_URING_H)14 CFA_STATS_IO = 0x02,15 #endif16 };17 16 18 17 struct __attribute__((aligned(64))) __stats_readQ_t {
Note:
See TracChangeset
for help on using the changeset viewer.