changeset 23:3787df8b95f9 dev_expl_VP_and_DKU

seedSlv gets taskID -1, assigner initiates shutdown if deadlock detected, more explicit debug messages
author Nina Engelhardt <nengel@mailbox.tu-berlin.de>
date Fri, 01 Feb 2013 17:18:57 +0100
parents b787a5234406
children 552192f088a2 227db52cbd93
files VSs.c VSs_PluginFns.c VSs_Request_Handlers.c
diffstat 3 files changed, 15 insertions(+), 7 deletions(-) [+]
line diff
     1.1 --- a/VSs.c	Thu Dec 27 12:27:45 2012 +0100
     1.2 +++ b/VSs.c	Fri Feb 01 17:18:57 2013 +0100
     1.3 @@ -77,6 +77,7 @@
     1.4     SlaveVP     *seedSlv;
     1.5     VSsSemData  *semData;
     1.6     VSsTaskStub *threadTaskStub, *parentTaskStub;
     1.7 +   int32* taskID;
     1.8  
     1.9     VSs__init();      //normal multi-thd
    1.10     
    1.11 @@ -98,6 +99,11 @@
    1.12     parentTaskStub->numLiveChildThreads = 1; //so dissipate works for seed
    1.13     threadTaskStub->parentTaskStub = parentTaskStub;
    1.14     threadTaskStub->slaveAssignedTo = seedSlv;
    1.15 +   
    1.16 +   taskID = VMS_WL__malloc(2 * sizeof(int32) );
    1.17 +   taskID[0] = 1;
    1.18 +   taskID[1] = -1;
    1.19 +   threadTaskStub->taskID = taskID;
    1.20  
    1.21     semData = (VSsSemData *)seedSlv->semanticData;
    1.22        //seedVP is a thread, so has a permanent task
     2.1 --- a/VSs_PluginFns.c	Thu Dec 27 12:27:45 2012 +0100
     2.2 +++ b/VSs_PluginFns.c	Fri Feb 01 17:18:57 2013 +0100
     2.3 @@ -138,6 +138,9 @@
     2.4                      }
     2.5  #endif
     2.6                  }
     2.7 +            } else if (_VMSMasterEnv->numAnimatedSlaves == 0){
     2.8 +                DEBUG__printf(TRUE,"Deadlock detected");
     2.9 +                semEnv->shutdownInitiated = TRUE;
    2.10              }
    2.11              //return NULL.. no task and none to resume
    2.12              returnSlv = NULL;
     3.1 --- a/VSs_Request_Handlers.c	Thu Dec 27 12:27:45 2012 +0100
     3.2 +++ b/VSs_Request_Handlers.c	Fri Feb 01 17:18:57 2013 +0100
     3.3 @@ -214,12 +214,11 @@
     3.4                  if (taskStub->numBlockingProp == 0) {
     3.5                      writePrivQ(taskStub, semEnv->taskReadyQ);
     3.6                      DEBUG__printf_w_task(dbgRqstHdlr, taskStub, "ready (dependencies fulfilled)");
     3.7 -                } else {
     3.8 -                    DEBUG__printf_w_task(dbgRqstHdlr,taskStub,"still blocked on %d args",taskStub->numBlockingProp);
     3.9                  }
    3.10                  ptrEntry->numEnabledNonDoneReaders += 1;
    3.11              } else { /*Otherwise, the reader is put into the hash-entry's Q of
    3.12               * waiters*/
    3.13 +                DEBUG__printf_w_task(dbgRqstHdlr, taskStub, "getting in line for ptrEntry %p (read)", ptrEntry);
    3.14                  taskCarrier = create_task_carrier(taskStub, argNum, READER);
    3.15                  writePrivQ(taskCarrier, ptrEntry->waitersQ);
    3.16              }
    3.17 @@ -237,11 +236,10 @@
    3.18                  if (taskStub->numBlockingProp == 0) {
    3.19                      DEBUG__printf_w_task(dbgRqstHdlr, taskStub, "ready (dependencies fulfilled)");
    3.20                      writePrivQ(taskStub, semEnv->taskReadyQ);
    3.21 -                } else {
    3.22 -                    DEBUG__printf_w_task(dbgRqstHdlr,taskStub,"still blocked on %d args",taskStub->numBlockingProp);
    3.23                  }
    3.24                  ptrEntry->hasEnabledNonFinishedWriter = TRUE;
    3.25              } else {/*Otherwise, put the writer into the entry's Q of waiters.*/
    3.26 +                DEBUG__printf_w_task(dbgRqstHdlr,taskStub,"getting in line for ptrEntry %p (write)",ptrEntry);
    3.27                  taskCarrier = create_task_carrier(taskStub, argNum, WRITER);
    3.28                  writePrivQ(taskCarrier, ptrEntry->waitersQ);
    3.29              }
    3.30 @@ -1130,14 +1128,12 @@
    3.31      semData = (VSsSemData *) semReq->callingSlv->semanticData;
    3.32      requestingTaskStub = semData->taskStub;
    3.33  
    3.34 -    DEBUG__printf_w_task(dbgRqstHdlr, requestingTaskStub, "TaskwaitOn request from slave %d",
    3.35 -            requestingSlv->slaveID);
    3.36      
    3.37      void* ptr = semReq->args;
    3.38  
    3.39      key[0] = 4; //two 32b values in key
    3.40      *((uint64*) & key[1]) = (uint64) ptr; //write 64b into two 32b
    3.41 -    *((uint64*) & key[3]) = (uint64) requestingTaskStub->parentTaskStub;
    3.42 +    *((uint64*) & key[3]) = (uint64) requestingTaskStub; //->parentTaskStub;
    3.43      /*If the hash entry was chained, put it at the
    3.44       * start of the chain.  (Means no-longer-used pointers accumulate
    3.45       * at end of chain, decide garbage collection later) */
    3.46 @@ -1152,6 +1148,9 @@
    3.47              rawHashEntry = addValueIntoTable32(key, ptrEntry, argPtrHashTbl);
    3.48          }
    3.49      }
    3.50 +    
    3.51 +        DEBUG__printf_w_task(dbgRqstHdlr, requestingTaskStub, 
    3.52 +                "TaskwaitOn request on ptrEntry %p", ptrEntry);
    3.53  
    3.54      if (!ptrEntry->hasEnabledNonFinishedWriter &&
    3.55              isEmptyPrivQ(ptrEntry->waitersQ)) {