- File:
-
- 1 edited
-
libcfa/src/concurrency/kernel.cfa (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note:
See TracChangeset
for help on using the changeset viewer.