Changeset 1757f98
- Timestamp:
- Nov 19, 2021, 3:03:54 PM (2 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
- Children:
- cd4c605
- Parents:
- a633f6f
- Location:
- libcfa/src/concurrency
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/io/setup.cfa
ra633f6f r1757f98 111 111 this.ext_sq.empty = true; 112 112 (this.ext_sq.queue){}; 113 __io_uring_setup( this, cl.io.params, proc->idle );113 __io_uring_setup( this, cl.io.params, proc->idle_fd ); 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
ra633f6f r1757f98 124 124 static void __wake_one(cluster * cltr); 125 125 126 static void idle_sleep(processor * proc); 126 127 static bool mark_idle (__cluster_proc_list & idles, processor & proc); 127 128 static void mark_awake(__cluster_proc_list & idles, processor & proc); … … 228 229 } 229 230 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 231 idle_sleep( this ); 261 232 262 233 // We were woken up, remove self from idle … … 349 320 350 321 __STATS( if(this->print_halts) __cfaabi_bits_print_safe( STDOUT_FILENO, "PH:%d - %lld 0\n", this->unique_id, rdtscl()); ) 351 __cfadbg_print_safe(runtime_core, "Kernel : core %p waiting on eventfd %d\n", this, this->idle );322 __cfadbg_print_safe(runtime_core, "Kernel : core %p waiting on eventfd %d\n", this, this->idle_fd); 352 323 353 324 { 354 325 eventfd_t val; 355 ssize_t ret = read( this->idle , &val, sizeof(val) );326 ssize_t ret = read( this->idle_fd, &val, sizeof(val) ); 356 327 if(ret < 0) { 357 328 switch((int)errno) { … … 798 769 eventfd_t val; 799 770 val = 1; 800 eventfd_write( this->idle , val );771 eventfd_write( this->idle_fd, val ); 801 772 __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 #endif 781 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 != EWOULDBLOCK 791 case EWOULDBLOCK: 792 #endif 793 case EINTR: 794 // No need to do anything special here, just assume it's a legitimate wake-up 795 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 #endif 802 807 } 803 808 … … 810 815 insert_first(this.idles, proc); 811 816 812 __atomic_store_n(&this.fd, proc.idle , __ATOMIC_SEQ_CST);817 __atomic_store_n(&this.fd, proc.idle_fd, __ATOMIC_SEQ_CST); 813 818 unlock( this ); 814 819 /* paranoid */ verify( ! __preemption_enabled() ); … … 827 832 { 828 833 int fd = 0; 829 if(!this.idles`isEmpty) fd = this.idles`first.idle ;834 if(!this.idles`isEmpty) fd = this.idles`first.idle_fd; 830 835 __atomic_store_n(&this.fd, fd, __ATOMIC_SEQ_CST); 831 836 } -
libcfa/src/concurrency/kernel.hfa
ra633f6f r1757f98 100 100 101 101 // Idle lock (kernel semaphore) 102 int idle ;102 int idle_fd; 103 103 104 104 // Termination synchronisation (user semaphore) -
libcfa/src/concurrency/kernel/startup.cfa
ra633f6f r1757f98 527 527 this.local_data = 0p; 528 528 529 this.idle = eventfd(0, 0);530 if (idle < 0) {529 this.idle_fd = eventfd(0, 0); 530 if (idle_fd < 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 );544 close(this.idle_fd); 545 545 } 546 546
Note: See TracChangeset
for help on using the changeset viewer.