# HG changeset patch # User Some Random Person # Date 1331818597 25200 # Node ID 5c475c4b7b4997c8b817b9dbbd680c8b57306062 # Parent ea70fa57776e364438315dbd7ef86914b2a52627 works except for shutdown, 'cause Holistic makes idle VPs, counted as live diff -r ea70fa57776e -r 5c475c4b7b49 CoreController.c --- a/CoreController.c Thu Mar 15 05:29:07 2012 -0700 +++ b/CoreController.c Thu Mar 15 06:36:37 2012 -0700 @@ -120,7 +120,7 @@ if(errorCode){ printf("\n pinning thd to core failed \n"); exit(0); } //make sure the controllers all start at same time, by making them wait - pthread_mutex_lock( &suspendLock ); + pthread_mutex_lock( &suspendLock ); while( !(_VMSMasterEnv->setupComplete) ) { pthread_cond_wait( &suspendCond, &suspendLock ); } @@ -139,7 +139,8 @@ // switchToSlv() call. Then control loops back to here. //Alternatively, the VP suspend primitive could just not bother // returning from switchToSlv, and instead jmp directly to here. - + DEBUG_Print1(TRUE, "started coreCtrl", thisCoresIdx ); + if( currSlotIdx >= NUM_SCHED_SLOTS ) goto switchToMaster; currSlot = schedSlots[ currSlotIdx ]; diff -r ea70fa57776e -r 5c475c4b7b49 Defines/VMS_defs__turn_on_and_off.h --- a/Defines/VMS_defs__turn_on_and_off.h Thu Mar 15 05:29:07 2012 -0700 +++ b/Defines/VMS_defs__turn_on_and_off.h Thu Mar 15 06:36:37 2012 -0700 @@ -7,7 +7,7 @@ */ #ifndef _VMS_DEFS_TURN_ON_AND_OFF_H -#define _VMS_DEFS_TURN_ON_AND_OFF_H +#define _VMS_DEFS_TURN_ON_AND_OFF_H #define _GNU_SOURCE //====================== Turn Debug things on and off ===================== @@ -15,22 +15,22 @@ * It still does co-routines and all the mechanisms are the same, it just * has only a single thread and animates Slvs one at a time */ -#define DEBUG__TURN_ON_SEQUENTIAL_MODE +//#define DEBUG__TURN_ON_SEQUENTIAL_MODE /*turns on the probe-instrumentation in the application -- when not * defined, the calls to the probe functions turn into comments */ -//#define DEBUG__TURN_ON_DEBUG_MSGS -//#define DEBUG__TURN_ON_ERROR_MSGS +#define DEBUG__TURN_ON_DEBUG_PRINT /*These defines turn types of bug messages on and off */ #define dbgAppFlow TRUE /* Top level flow of application code -- general*/ #define dbgProbes FALSE /* for issues inside probes themselves*/ #define dbgB2BMaster FALSE /* in coreloop, back to back master Slvs*/ -#define dbgRqstHdlr FALSE /* in request handler code*/ +#define dbgRqstHdlr TRUE /* in request handler code*/ +//#define DEBUG__TURN_ON_ERROR_MSGS //================== Turn Probe Things on and off ==================== /*Probes are used in the application as a cheap, convenient, and fast way diff -r ea70fa57776e -r 5c475c4b7b49 Services_Offered_by_VMS/Debugging/DEBUG__macros.h --- a/Services_Offered_by_VMS/Debugging/DEBUG__macros.h Thu Mar 15 05:29:07 2012 -0700 +++ b/Services_Offered_by_VMS/Debugging/DEBUG__macros.h Thu Mar 15 06:36:37 2012 -0700 @@ -12,7 +12,7 @@ /* */ -#ifdef DEBUG__TURN_ON_DEBUG_MSGS +#ifdef DEBUG__TURN_ON_DEBUG_PRINT #define DEBUG_Print( bool, msg) \ if( bool){ printf(msg); fflush(stdin);} #define DEBUG_Print1( bool, msg, param) \ diff -r ea70fa57776e -r 5c475c4b7b49 VMS.h --- a/VMS.h Thu Mar 15 05:29:07 2012 -0700 +++ b/VMS.h Thu Mar 15 06:36:37 2012 -0700 @@ -156,7 +156,7 @@ MallocArrays *freeLists; int32 amtOfOutstandingMem; //total currently allocated - int32 setupComplete; + int32 setupComplete; //use while starting up coreCtlr GateStruc *workStealingGates[ NUM_CORES ]; //concurrent work-steal int32 workStealingLock; diff -r ea70fa57776e -r 5c475c4b7b49 VMS__startup_and_shutdown.c --- a/VMS__startup_and_shutdown.c Thu Mar 15 05:29:07 2012 -0700 +++ b/VMS__startup_and_shutdown.c Thu Mar 15 06:36:37 2012 -0700 @@ -360,6 +360,10 @@ // before proceeding -- gives time after creating to initialize other // stuff before the coreCtlrs set off. _VMSMasterEnv->setupComplete = 0; + + //initialize the cond used to make the new threads wait and sync up + pthread_mutex_init( &suspendLock, NULL ); + pthread_cond_init( &suspendCond, NULL ); //Make the threads that animate the core controllers for( coreIdx=0; coreIdx < NUM_CORES; coreIdx++ ) @@ -417,8 +421,6 @@ //get lock, to lock out any threads still starting up -- they'll see // that setupComplete is true before entering while loop, and so never // wait on the condition - pthread_mutex_init( &suspendLock, NULL ); - pthread_cond_init( &suspendCond, NULL ); pthread_mutex_lock( &suspendLock ); _VMSMasterEnv->setupComplete = 1; pthread_mutex_unlock( &suspendLock );