# HG changeset patch # User Some Random Person # Date 1331809915 25200 # Node ID 309559064073b7bc90df2a30b2ab9716867d9211 # Parent efcc6331a2a207b899d46e9db0f33560c4cc98fd Working on shutdown bug -- shutdown puts shutdown slaves direct into sched slots diff -r efcc6331a2a2 -r 309559064073 CoreController.c --- a/CoreController.c Wed Mar 14 23:21:01 2012 -0700 +++ b/CoreController.c Thu Mar 15 04:11:55 2012 -0700 @@ -109,7 +109,7 @@ thisCoresMasterVP = _VMSMasterEnv->masterVPs[thisCoresIdx]; //==================== pthread related stuff ====================== - //pin the pthread to the core + //pin the pthread to the core -- takes away Linux control //Linux requires pinning to be done inside the thread-function //Designate a core by a 1 in bit-position corresponding to the core CPU_ZERO(&coreMask); //initialize mask bits to zero diff -r efcc6331a2a2 -r 309559064073 SchedulingMaster.c --- a/SchedulingMaster.c Wed Mar 14 23:21:01 2012 -0700 +++ b/SchedulingMaster.c Thu Mar 15 04:11:55 2012 -0700 @@ -114,7 +114,6 @@ //GCC may optimize so doesn't always re-define from frame-storage masterVP = (SlaveVP*)volatileMasterVP; //just to make sure after jmp thisCoresIdx = masterVP->coreAnimatedBy; - readyToAnimateQ = masterEnv->readyToAnimateQs[thisCoresIdx]; schedSlots = masterEnv->allSchedSlots[thisCoresIdx]; requestHandler = masterEnv->requestHandler; @@ -194,7 +193,8 @@ else { coreIdx++; } - currQ = _VMSMasterEnv->readyToAnimateQs[coreIdx]; + //TODO: fix this for coreCtlr scans slots +// currQ = _VMSMasterEnv->readyToAnimateQs[coreIdx]; if( numInVMSQ( currQ ) > 0 ) { stolenSlv = readVMSQ (currQ ); break; @@ -304,7 +304,8 @@ else { coreIdx++; } - victimsQ = _VMSMasterEnv->readyToAnimateQs[coreIdx]; + //TODO: fix this for coreCtlr scans slots +// victimsQ = _VMSMasterEnv->readyToAnimateQs[coreIdx]; if( numInVMSQ( victimsQ ) > 0 ) { haveAVictim = TRUE; vicGate = _VMSMasterEnv->workStealingGates[ coreIdx ]; diff -r efcc6331a2a2 -r 309559064073 VMS.h --- a/VMS.h Wed Mar 14 23:21:01 2012 -0700 +++ b/VMS.h Thu Mar 15 04:11:55 2012 -0700 @@ -141,11 +141,10 @@ */ typedef struct { - SlaveAssigner slaveAssigner; + SlaveAssigner slaveAssigner; RequestHandler requestHandler; SchedSlot ***allSchedSlots; - VMSQueueStruc **readyToAnimateQs; SlaveVP **masterVPs; void *semanticEnv; diff -r efcc6331a2a2 -r 309559064073 VMS__int.c --- a/VMS__int.c Wed Mar 14 23:21:01 2012 -0700 +++ b/VMS__int.c Thu Mar 15 04:11:55 2012 -0700 @@ -90,7 +90,13 @@ void VMS_ext__dissipate_slaveVP( SlaveVP *slaveToDissipate ) { - //NOTE: dataParam was given to the processor, so should either have + _VMSMasterEnv->numSlavesAlive -= 1; + if( _VMSMasterEnv->numSlavesAlive == 0 ) + { //no more work, so shutdown + VMS_SS__shutdown(); //note, creates 4 shut-down slaves + } + + //NOTE: dataParam was given to the processor, so should either have // been alloc'd with VMS_int__malloc, or freed by the level above animSlv. //So, all that's left to free here is the stack and the SlaveVP struc // itself diff -r efcc6331a2a2 -r 309559064073 VMS__startup_and_shutdown.c --- a/VMS__startup_and_shutdown.c Wed Mar 14 23:21:01 2012 -0700 +++ b/VMS__startup_and_shutdown.c Thu Mar 15 04:11:55 2012 -0700 @@ -298,7 +298,6 @@ allSchedSlots[ coreIdx ] = create_sched_slots(); //makes for one core _VMSMasterEnv->workStealingGates[ coreIdx ] = NULL; } - _VMSMasterEnv->readyToAnimateQs = readyToAnimateQs; _VMSMasterEnv->masterVPs = masterVPs; _VMSMasterEnv->masterLock = UNLOCKED; _VMSMasterEnv->allSchedSlots = allSchedSlots; @@ -473,15 +472,21 @@ */ void VMS_SS__shutdown() - { int coreIdx; - SlaveVP *shutDownSlv; - + { int32 coreIdx; + SlaveVP *shutDownSlv; + SchedSlot **schedSlots; //create the shutdown processors, one for each core controller -- put them // directly into the Q -- each core will die when gets one - for( coreIdx=0; coreIdx < NUM_CORES; coreIdx++ ) + for( coreIdx = 0; coreIdx < NUM_CORES; coreIdx++ ) { //Note, this is running in the master shutDownSlv = VMS_int__create_slaveVP( &endOSThreadFn, NULL ); - writeVMSQ( shutDownSlv, _VMSMasterEnv->readyToAnimateQs[coreIdx] ); + //last slave has dissipated, so no more in slots, so write + // shut down slave into first schedulng slot. + schedSlots = _VMSMasterEnv->allSchedSlots[ coreIdx ]; + schedSlots[0]->slaveAssignedToSlot = shutDownSlv; + schedSlots[0]->needsSlaveAssigned = FALSE; + shutDownSlv->coreAnimatedBy = coreIdx; + shutDownSlv->schedSlot = schedSlots[ 0 ]; } }