Changes in / [cd4c605:c60e5094]


Ignore:
Location:
libcfa/src/concurrency
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/io/setup.cfa

    rcd4c605 rc60e5094  
    111111                this.ext_sq.empty = true;
    112112                (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 );
    114114                __cfadbg_print_safe(io_core, "Kernel I/O : Created ring for io_context %u (%p)\n", this.fd, &this);
    115115        }
  • libcfa/src/concurrency/kernel.cfa

    rcd4c605 rc60e5094  
    124124static void __wake_one(cluster * cltr);
    125125
    126 static void idle_sleep(processor * proc);
    127126static bool mark_idle (__cluster_proc_list & idles, processor & proc);
    128127static void mark_awake(__cluster_proc_list & idles, processor & proc);
     
    229228                                }
    230229
    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
    232261
    233262                                // We were woken up, remove self from idle
     
    320349
    321350                                __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);
    323352
    324353                                {
    325354                                        eventfd_t val;
    326                                         ssize_t ret = read( this->idle_fd, &val, sizeof(val) );
     355                                        ssize_t ret = read( this->idle, &val, sizeof(val) );
    327356                                        if(ret < 0) {
    328357                                                switch((int)errno) {
     
    769798                eventfd_t val;
    770799                val = 1;
    771                 eventfd_write( this->idle_fd, val );
     800                eventfd_write( this->idle, val );
    772801        __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
    807802}
    808803
     
    815810                insert_first(this.idles, proc);
    816811
    817                 __atomic_store_n(&this.fd, proc.idle_fd, __ATOMIC_SEQ_CST);
     812                __atomic_store_n(&this.fd, proc.idle, __ATOMIC_SEQ_CST);
    818813        unlock( this );
    819814        /* paranoid */ verify( ! __preemption_enabled() );
     
    832827                {
    833828                        int fd = 0;
    834                         if(!this.idles`isEmpty) fd = this.idles`first.idle_fd;
     829                        if(!this.idles`isEmpty) fd = this.idles`first.idle;
    835830                        __atomic_store_n(&this.fd, fd, __ATOMIC_SEQ_CST);
    836831                }
  • libcfa/src/concurrency/kernel.hfa

    rcd4c605 rc60e5094  
    100100
    101101        // Idle lock (kernel semaphore)
    102         int idle_fd;
     102        int idle;
    103103
    104104        // Termination synchronisation (user semaphore)
  • libcfa/src/concurrency/kernel/startup.cfa

    rcd4c605 rc60e5094  
    527527        this.local_data = 0p;
    528528
    529         this.idle_fd = eventfd(0, 0);
    530         if (idle_fd < 0) {
     529        this.idle = eventfd(0, 0);
     530        if (idle < 0) {
    531531                abort("KERNEL ERROR: PROCESSOR EVENTFD - %s\n", strerror(errno));
    532532        }
     
    542542// Not a ctor, it just preps the destruction but should not destroy members
    543543static void deinit(processor & this) {
    544         close(this.idle_fd);
     544        close(this.idle);
    545545}
    546546
Note: See TracChangeset for help on using the changeset viewer.