changeset 225:309559064073 Common_Ancestor

Working on shutdown bug -- shutdown puts shutdown slaves direct into sched slots
author Some Random Person <seanhalle@yahoo.com>
date Thu, 15 Mar 2012 04:11:55 -0700
parents efcc6331a2a2
children ea70fa57776e
files CoreController.c SchedulingMaster.c VMS.h VMS__int.c VMS__startup_and_shutdown.c
diffstat 5 files changed, 24 insertions(+), 13 deletions(-) [+]
line diff
     1.1 --- a/CoreController.c	Wed Mar 14 23:21:01 2012 -0700
     1.2 +++ b/CoreController.c	Thu Mar 15 04:11:55 2012 -0700
     1.3 @@ -109,7 +109,7 @@
     1.4     thisCoresMasterVP = _VMSMasterEnv->masterVPs[thisCoresIdx];
     1.5     
     1.6     //==================== pthread related stuff ======================
     1.7 -      //pin the pthread to the core
     1.8 +      //pin the pthread to the core -- takes away Linux control
     1.9        //Linux requires pinning to be done inside the thread-function
    1.10        //Designate a core by a 1 in bit-position corresponding to the core
    1.11     CPU_ZERO(&coreMask); //initialize mask bits to zero
     2.1 --- a/SchedulingMaster.c	Wed Mar 14 23:21:01 2012 -0700
     2.2 +++ b/SchedulingMaster.c	Thu Mar 15 04:11:55 2012 -0700
     2.3 @@ -114,7 +114,6 @@
     2.4        //GCC may optimize so doesn't always re-define from frame-storage
     2.5     masterVP         = (SlaveVP*)volatileMasterVP;  //just to make sure after jmp
     2.6     thisCoresIdx     = masterVP->coreAnimatedBy;
     2.7 -   readyToAnimateQ  = masterEnv->readyToAnimateQs[thisCoresIdx];
     2.8     schedSlots       = masterEnv->allSchedSlots[thisCoresIdx];
     2.9  
    2.10     requestHandler   = masterEnv->requestHandler;
    2.11 @@ -194,7 +193,8 @@
    2.12        else
    2.13         { coreIdx++;
    2.14         }
    2.15 -      currQ = _VMSMasterEnv->readyToAnimateQs[coreIdx];
    2.16 +      //TODO: fix this for coreCtlr scans slots
    2.17 +//      currQ = _VMSMasterEnv->readyToAnimateQs[coreIdx];
    2.18        if( numInVMSQ( currQ ) > 0 )
    2.19         { stolenSlv = readVMSQ (currQ );
    2.20           break;
    2.21 @@ -304,7 +304,8 @@
    2.22        else
    2.23         { coreIdx++;
    2.24         }
    2.25 -      victimsQ = _VMSMasterEnv->readyToAnimateQs[coreIdx];
    2.26 +      //TODO: fix this for coreCtlr scans slots
    2.27 +//      victimsQ = _VMSMasterEnv->readyToAnimateQs[coreIdx];
    2.28        if( numInVMSQ( victimsQ ) > 0 )
    2.29         { haveAVictim = TRUE;
    2.30           vicGate = _VMSMasterEnv->workStealingGates[ coreIdx ];
     3.1 --- a/VMS.h	Wed Mar 14 23:21:01 2012 -0700
     3.2 +++ b/VMS.h	Thu Mar 15 04:11:55 2012 -0700
     3.3 @@ -141,11 +141,10 @@
     3.4   */
     3.5  typedef struct
     3.6   {
     3.7 -   SlaveAssigner   slaveAssigner;
     3.8 +   SlaveAssigner    slaveAssigner;
     3.9     RequestHandler   requestHandler;
    3.10     
    3.11     SchedSlot     ***allSchedSlots;
    3.12 -   VMSQueueStruc  **readyToAnimateQs;
    3.13     SlaveVP        **masterVPs;
    3.14  
    3.15     void            *semanticEnv;
     4.1 --- a/VMS__int.c	Wed Mar 14 23:21:01 2012 -0700
     4.2 +++ b/VMS__int.c	Thu Mar 15 04:11:55 2012 -0700
     4.3 @@ -90,7 +90,13 @@
     4.4  void
     4.5  VMS_ext__dissipate_slaveVP( SlaveVP *slaveToDissipate )
     4.6   {
     4.7 -      //NOTE: dataParam was given to the processor, so should either have
     4.8 +   _VMSMasterEnv->numSlavesAlive -= 1;
     4.9 +   if( _VMSMasterEnv->numSlavesAlive == 0 )
    4.10 +    {    //no more work, so shutdown
    4.11 +      VMS_SS__shutdown();  //note, creates 4 shut-down slaves
    4.12 +    }
    4.13 +
    4.14 +   //NOTE: dataParam was given to the processor, so should either have
    4.15        // been alloc'd with VMS_int__malloc, or freed by the level above animSlv.
    4.16        //So, all that's left to free here is the stack and the SlaveVP struc
    4.17        // itself
     5.1 --- a/VMS__startup_and_shutdown.c	Wed Mar 14 23:21:01 2012 -0700
     5.2 +++ b/VMS__startup_and_shutdown.c	Thu Mar 15 04:11:55 2012 -0700
     5.3 @@ -298,7 +298,6 @@
     5.4        allSchedSlots[ coreIdx ] = create_sched_slots(); //makes for one core
     5.5        _VMSMasterEnv->workStealingGates[ coreIdx ] = NULL;
     5.6      }
     5.7 -   _VMSMasterEnv->readyToAnimateQs = readyToAnimateQs;
     5.8     _VMSMasterEnv->masterVPs        = masterVPs;
     5.9     _VMSMasterEnv->masterLock       = UNLOCKED;
    5.10     _VMSMasterEnv->allSchedSlots    = allSchedSlots;
    5.11 @@ -473,15 +472,21 @@
    5.12   */
    5.13  void
    5.14  VMS_SS__shutdown()
    5.15 - { int coreIdx;
    5.16 -   SlaveVP *shutDownSlv;
    5.17 -
    5.18 + { int32       coreIdx;
    5.19 +   SlaveVP    *shutDownSlv;
    5.20 +   SchedSlot **schedSlots;
    5.21        //create the shutdown processors, one for each core controller -- put them
    5.22        // directly into the Q -- each core will die when gets one
    5.23 -   for( coreIdx=0; coreIdx < NUM_CORES; coreIdx++ )
    5.24 +   for( coreIdx = 0; coreIdx < NUM_CORES; coreIdx++ )
    5.25      {    //Note, this is running in the master
    5.26        shutDownSlv = VMS_int__create_slaveVP( &endOSThreadFn, NULL );
    5.27 -      writeVMSQ( shutDownSlv, _VMSMasterEnv->readyToAnimateQs[coreIdx] );
    5.28 +         //last slave has dissipated, so no more in slots, so write
    5.29 +         // shut down slave into first schedulng slot.
    5.30 +      schedSlots = _VMSMasterEnv->allSchedSlots[ coreIdx ];
    5.31 +      schedSlots[0]->slaveAssignedToSlot = shutDownSlv;
    5.32 +      schedSlots[0]->needsSlaveAssigned = FALSE;
    5.33 +      shutDownSlv->coreAnimatedBy = coreIdx;
    5.34 +      shutDownSlv->schedSlot = schedSlots[ 0 ];
    5.35      }
    5.36   }
    5.37