Ignore:
Timestamp:
Apr 16, 2021, 2:28:09 PM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
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:
665edf40
Parents:
857a1c6 (diff), 5f6a172 (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.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/kernel/startup.cfa

    r857a1c6 rc8a0210  
    268268                        __print_stats( st, mainProcessor->print_stats, "Processor ", mainProcessor->name, (void*)mainProcessor );
    269269                }
     270                #if defined(CFA_STATS_ARRAY)
     271                        __flush_stat( st, "Processor", mainProcessor );
     272                #endif
    270273        #endif
    271274
     
    348351                        __print_stats( &local_stats, proc->print_stats, "Processor ", proc->name, (void*)proc );
    349352                }
     353                #if defined(CFA_STATS_ARRAY)
     354                        __flush_stat( &local_stats, "Processor", proc );
     355                #endif
    350356        #endif
    351357
     
    463469        this.name = name;
    464470        this.cltr = &_cltr;
     471        this.rdq.its = 0;
     472        this.rdq.itr = 0;
     473        this.rdq.id  = -1u;
     474        this.rdq.target = -1u;
     475        this.rdq.cutoff = -1ull;
    465476        do_terminate = false;
    466477        preemption_alarm = 0p;
     
    483494        #endif
    484495
    485         lock( this.cltr->idles );
    486                 int target = this.cltr->idles.total += 1u;
    487         unlock( this.cltr->idles );
    488 
    489         id = doregister((__processor_id_t*)&this);
    490 
     496        // Register and Lock the RWlock so no-one pushes/pops while we are changing the queue
     497        uint_fast32_t last_size = ready_mutate_register((__processor_id_t*)&this);
     498                this.cltr->procs.total += 1u;
     499                insert_last(this.cltr->procs.actives, this);
     500
     501                // Adjust the ready queue size
     502                ready_queue_grow( cltr );
     503
     504        // Unlock the RWlock
     505        ready_mutate_unlock( last_size );
     506
     507        __cfadbg_print_safe(runtime_core, "Kernel : core %p created\n", &this);
     508}
     509
     510// Not a ctor, it just preps the destruction but should not destroy members
     511static void deinit(processor & this) {
    491512        // Lock the RWlock so no-one pushes/pops while we are changing the queue
    492513        uint_fast32_t last_size = ready_mutate_lock();
     514                this.cltr->procs.total -= 1u;
     515                remove(this);
    493516
    494517                // Adjust the ready queue size
    495                 this.cltr_id = ready_queue_grow( cltr, target );
    496 
    497         // Unlock the RWlock
    498         ready_mutate_unlock( last_size );
    499 
    500         __cfadbg_print_safe(runtime_core, "Kernel : core %p created\n", &this);
    501 }
    502 
    503 // Not a ctor, it just preps the destruction but should not destroy members
    504 static void deinit(processor & this) {
    505         lock( this.cltr->idles );
    506                 int target = this.cltr->idles.total -= 1u;
    507         unlock( this.cltr->idles );
    508 
    509         // Lock the RWlock so no-one pushes/pops while we are changing the queue
    510         uint_fast32_t last_size = ready_mutate_lock();
    511 
    512                 // Adjust the ready queue size
    513                 ready_queue_shrink( this.cltr, target );
    514 
    515         // Unlock the RWlock
    516         ready_mutate_unlock( last_size );
    517 
    518         // Finally we don't need the read_lock any more
    519         unregister((__processor_id_t*)&this);
     518                ready_queue_shrink( this.cltr );
     519
     520        // Unlock the RWlock and unregister: we don't need the read_lock any more
     521        ready_mutate_unregister((__processor_id_t*)&this, last_size );
    520522
    521523        close(this.idle);
     
    560562//-----------------------------------------------------------------------------
    561563// Cluster
    562 static void ?{}(__cluster_idles & this) {
     564static void ?{}(__cluster_proc_list & this) {
    563565        this.lock  = 0;
    564566        this.idle  = 0;
    565567        this.total = 0;
    566         (this.list){};
    567568}
    568569
     
    590591
    591592                // Adjust the ready queue size
    592                 ready_queue_grow( &this, 0 );
     593                ready_queue_grow( &this );
    593594
    594595        // Unlock the RWlock
     
    605606
    606607                // Adjust the ready queue size
    607                 ready_queue_shrink( &this, 0 );
     608                ready_queue_shrink( &this );
    608609
    609610        // Unlock the RWlock
     
    615616                        __print_stats( this.stats, this.print_stats, "Cluster", this.name, (void*)&this );
    616617                }
     618                #if defined(CFA_STATS_ARRAY)
     619                        __flush_stat( this.stats, "Cluster", &this );
     620                #endif
    617621                free( this.stats );
    618622        #endif
Note: See TracChangeset for help on using the changeset viewer.