Changes in / [cd4c605:c60e5094]
- Location:
- libcfa/src/concurrency
- Files:
-
- 4 edited
-
io/setup.cfa (modified) (1 diff)
-
kernel.cfa (modified) (6 diffs)
-
kernel.hfa (modified) (1 diff)
-
kernel/startup.cfa (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/io/setup.cfa
rcd4c605 rc60e5094 111 111 this.ext_sq.empty = true; 112 112 (this.ext_sq.queue){}; 113 __io_uring_setup( this, cl.io.params, proc->idle _fd);113 __io_uring_setup( this, cl.io.params, proc->idle ); 114 114 __cfadbg_print_safe(io_core, "Kernel I/O : Created ring for io_context %u (%p)\n", this.fd, &this); 115 115 } -
libcfa/src/concurrency/kernel.cfa
rcd4c605 rc60e5094 124 124 static void __wake_one(cluster * cltr); 125 125 126 static void idle_sleep(processor * proc);127 126 static bool mark_idle (__cluster_proc_list & idles, processor & proc); 128 127 static void mark_awake(__cluster_proc_list & idles, processor & proc); … … 229 228 } 230 229 231 idle_sleep( this ); 230 #if !defined(__CFA_NO_STATISTICS__) 231 if(this->print_halts) { 232 __cfaabi_bits_print_safe( STDOUT_FILENO, "PH:%d - %lld 0\n", this->unique_id, rdtscl()); 233 } 234 #endif 235 236 __cfadbg_print_safe(runtime_core, "Kernel : core %p waiting on eventfd %d\n", this, this->idle); 237 238 { 239 eventfd_t val; 240 ssize_t ret = read( this->idle, &val, sizeof(val) ); 241 if(ret < 0) { 242 switch((int)errno) { 243 case EAGAIN: 244 #if EAGAIN != EWOULDBLOCK 245 case EWOULDBLOCK: 246 #endif 247 case EINTR: 248 // No need to do anything special here, just assume it's a legitimate wake-up 249 break; 250 default: 251 abort( "KERNEL : internal error, read failure on idle eventfd, error(%d) %s.", (int)errno, strerror( (int)errno ) ); 252 } 253 } 254 } 255 256 #if !defined(__CFA_NO_STATISTICS__) 257 if(this->print_halts) { 258 __cfaabi_bits_print_safe( STDOUT_FILENO, "PH:%d - %lld 1\n", this->unique_id, rdtscl()); 259 } 260 #endif 232 261 233 262 // We were woken up, remove self from idle … … 320 349 321 350 __STATS( if(this->print_halts) __cfaabi_bits_print_safe( STDOUT_FILENO, "PH:%d - %lld 0\n", this->unique_id, rdtscl()); ) 322 __cfadbg_print_safe(runtime_core, "Kernel : core %p waiting on eventfd %d\n", this, this->idle _fd);351 __cfadbg_print_safe(runtime_core, "Kernel : core %p waiting on eventfd %d\n", this, this->idle); 323 352 324 353 { 325 354 eventfd_t val; 326 ssize_t ret = read( this->idle _fd, &val, sizeof(val) );355 ssize_t ret = read( this->idle, &val, sizeof(val) ); 327 356 if(ret < 0) { 328 357 switch((int)errno) { … … 769 798 eventfd_t val; 770 799 val = 1; 771 eventfd_write( this->idle _fd, val );800 eventfd_write( this->idle, val ); 772 801 __enable_interrupts_checked(); 773 }774 775 static void idle_sleep(processor * this) {776 #if !defined(__CFA_NO_STATISTICS__)777 if(this->print_halts) {778 __cfaabi_bits_print_safe( STDOUT_FILENO, "PH:%d - %lld 0\n", this->unique_id, rdtscl());779 }780 #endif781 782 __cfadbg_print_safe(runtime_core, "Kernel : core %p waiting on eventfd %d\n", this, this->idle_fd);783 784 {785 eventfd_t val;786 ssize_t ret = read( this->idle_fd, &val, sizeof(val) );787 if(ret < 0) {788 switch((int)errno) {789 case EAGAIN:790 #if EAGAIN != EWOULDBLOCK791 case EWOULDBLOCK:792 #endif793 case EINTR:794 // No need to do anything special here, just assume it's a legitimate wake-up795 break;796 default:797 abort( "KERNEL : internal error, read failure on idle eventfd, error(%d) %s.", (int)errno, strerror( (int)errno ) );798 }799 }800 }801 802 #if !defined(__CFA_NO_STATISTICS__)803 if(this->print_halts) {804 __cfaabi_bits_print_safe( STDOUT_FILENO, "PH:%d - %lld 1\n", this->unique_id, rdtscl());805 }806 #endif807 802 } 808 803 … … 815 810 insert_first(this.idles, proc); 816 811 817 __atomic_store_n(&this.fd, proc.idle _fd, __ATOMIC_SEQ_CST);812 __atomic_store_n(&this.fd, proc.idle, __ATOMIC_SEQ_CST); 818 813 unlock( this ); 819 814 /* paranoid */ verify( ! __preemption_enabled() ); … … 832 827 { 833 828 int fd = 0; 834 if(!this.idles`isEmpty) fd = this.idles`first.idle _fd;829 if(!this.idles`isEmpty) fd = this.idles`first.idle; 835 830 __atomic_store_n(&this.fd, fd, __ATOMIC_SEQ_CST); 836 831 } -
libcfa/src/concurrency/kernel.hfa
rcd4c605 rc60e5094 100 100 101 101 // Idle lock (kernel semaphore) 102 int idle _fd;102 int idle; 103 103 104 104 // Termination synchronisation (user semaphore) -
libcfa/src/concurrency/kernel/startup.cfa
rcd4c605 rc60e5094 527 527 this.local_data = 0p; 528 528 529 this.idle _fd= eventfd(0, 0);530 if (idle _fd< 0) {529 this.idle = eventfd(0, 0); 530 if (idle < 0) { 531 531 abort("KERNEL ERROR: PROCESSOR EVENTFD - %s\n", strerror(errno)); 532 532 } … … 542 542 // Not a ctor, it just preps the destruction but should not destroy members 543 543 static void deinit(processor & this) { 544 close(this.idle _fd);544 close(this.idle); 545 545 } 546 546
Note:
See TracChangeset
for help on using the changeset viewer.