changeset 227:5c475c4b7b49 Common_Ancestor

works except for shutdown, 'cause Holistic makes idle VPs, counted as live
author Some Random Person <seanhalle@yahoo.com>
date Thu, 15 Mar 2012 06:36:37 -0700
parents ea70fa57776e
children 125f0f90a0d3 f2a7831352dc
files CoreController.c Defines/VMS_defs__turn_on_and_off.h Services_Offered_by_VMS/Debugging/DEBUG__macros.h VMS.h VMS__startup_and_shutdown.c
diffstat 5 files changed, 14 insertions(+), 11 deletions(-) [+]
line diff
     1.1 --- a/CoreController.c	Thu Mar 15 05:29:07 2012 -0700
     1.2 +++ b/CoreController.c	Thu Mar 15 06:36:37 2012 -0700
     1.3 @@ -120,7 +120,7 @@
     1.4     if(errorCode){ printf("\n pinning thd to core failed \n"); exit(0); }
     1.5  
     1.6        //make sure the controllers all start at same time, by making them wait
     1.7 -   pthread_mutex_lock(   &suspendLock );
     1.8 +   pthread_mutex_lock(  &suspendLock );
     1.9     while( !(_VMSMasterEnv->setupComplete) )
    1.10      { pthread_cond_wait( &suspendCond, &suspendLock );
    1.11      }
    1.12 @@ -139,7 +139,8 @@
    1.13               // switchToSlv() call. Then control loops back to here.
    1.14               //Alternatively, the VP suspend primitive could just not bother
    1.15               // returning from switchToSlv, and instead jmp directly to here.
    1.16 -      
    1.17 +            DEBUG_Print1(TRUE, "started coreCtrl", thisCoresIdx );
    1.18 +            
    1.19        if( currSlotIdx >= NUM_SCHED_SLOTS ) goto switchToMaster;
    1.20        currSlot = schedSlots[ currSlotIdx ];
    1.21  
     2.1 --- a/Defines/VMS_defs__turn_on_and_off.h	Thu Mar 15 05:29:07 2012 -0700
     2.2 +++ b/Defines/VMS_defs__turn_on_and_off.h	Thu Mar 15 06:36:37 2012 -0700
     2.3 @@ -7,7 +7,7 @@
     2.4   */
     2.5  
     2.6  #ifndef _VMS_DEFS_TURN_ON_AND_OFF_H
     2.7 -#define	_VMS_DEFS_TURN_ON_AND_OFF_H
     2.8 +#define _VMS_DEFS_TURN_ON_AND_OFF_H
     2.9  #define _GNU_SOURCE
    2.10  
    2.11  //======================  Turn Debug things on and off  =====================
    2.12 @@ -15,22 +15,22 @@
    2.13   * It still does co-routines and all the mechanisms are the same, it just
    2.14   * has only a single thread and animates Slvs one at a time
    2.15   */
    2.16 -#define DEBUG__TURN_ON_SEQUENTIAL_MODE
    2.17 +//#define DEBUG__TURN_ON_SEQUENTIAL_MODE
    2.18  
    2.19  
    2.20  /*turns on the probe-instrumentation in the application -- when not
    2.21   * defined, the calls to the probe functions turn into comments
    2.22   */
    2.23 -//#define DEBUG__TURN_ON_DEBUG_MSGS
    2.24 -//#define DEBUG__TURN_ON_ERROR_MSGS
    2.25 +#define DEBUG__TURN_ON_DEBUG_PRINT
    2.26  
    2.27  /*These defines turn types of bug messages on and off
    2.28   */
    2.29  #define dbgAppFlow   TRUE /* Top level flow of application code -- general*/
    2.30  #define dbgProbes    FALSE /* for issues inside probes themselves*/
    2.31  #define dbgB2BMaster FALSE /* in coreloop, back to back master Slvs*/
    2.32 -#define dbgRqstHdlr  FALSE /* in request handler code*/
    2.33 +#define dbgRqstHdlr  TRUE /* in request handler code*/
    2.34  
    2.35 +//#define DEBUG__TURN_ON_ERROR_MSGS
    2.36  
    2.37  //==================  Turn Probe Things on and off ====================
    2.38  /*Probes are used in the application as a cheap, convenient, and fast way
     3.1 --- a/Services_Offered_by_VMS/Debugging/DEBUG__macros.h	Thu Mar 15 05:29:07 2012 -0700
     3.2 +++ b/Services_Offered_by_VMS/Debugging/DEBUG__macros.h	Thu Mar 15 06:36:37 2012 -0700
     3.3 @@ -12,7 +12,7 @@
     3.4  
     3.5  /*
     3.6   */
     3.7 -#ifdef DEBUG__TURN_ON_DEBUG_MSGS
     3.8 +#ifdef DEBUG__TURN_ON_DEBUG_PRINT
     3.9     #define DEBUG_Print(  bool, msg) \
    3.10        if( bool){ printf(msg); fflush(stdin);}
    3.11     #define DEBUG_Print1( bool, msg, param)  \
     4.1 --- a/VMS.h	Thu Mar 15 05:29:07 2012 -0700
     4.2 +++ b/VMS.h	Thu Mar 15 06:36:37 2012 -0700
     4.3 @@ -156,7 +156,7 @@
     4.4     MallocArrays    *freeLists;
     4.5     int32            amtOfOutstandingMem; //total currently allocated
     4.6  
     4.7 -   int32            setupComplete;
     4.8 +   int32            setupComplete;  //use while starting up coreCtlr
     4.9     GateStruc       *workStealingGates[ NUM_CORES ]; //concurrent work-steal
    4.10     int32            workStealingLock;
    4.11     
     5.1 --- a/VMS__startup_and_shutdown.c	Thu Mar 15 05:29:07 2012 -0700
     5.2 +++ b/VMS__startup_and_shutdown.c	Thu Mar 15 06:36:37 2012 -0700
     5.3 @@ -360,6 +360,10 @@
     5.4        // before proceeding -- gives time after creating to initialize other
     5.5        // stuff before the coreCtlrs set off.
     5.6     _VMSMasterEnv->setupComplete = 0;
     5.7 +   
     5.8 +      //initialize the cond used to make the new threads wait and sync up
     5.9 +   pthread_mutex_init( &suspendLock, NULL );
    5.10 +   pthread_cond_init( &suspendCond, NULL );
    5.11  
    5.12        //Make the threads that animate the core controllers
    5.13     for( coreIdx=0; coreIdx < NUM_CORES; coreIdx++ )
    5.14 @@ -417,8 +421,6 @@
    5.15        //get lock, to lock out any threads still starting up -- they'll see
    5.16        // that setupComplete is true before entering while loop, and so never
    5.17        // wait on the condition
    5.18 -   pthread_mutex_init( &suspendLock, NULL );
    5.19 -   pthread_cond_init( &suspendCond, NULL );
    5.20     pthread_mutex_lock(     &suspendLock );
    5.21     _VMSMasterEnv->setupComplete = 1;
    5.22     pthread_mutex_unlock(   &suspendLock );