From: adash Date: Mon, 11 Aug 2008 19:23:06 +0000 (+0000) Subject: bug fix for invalidation (also allow invalidation of objects when these objects are X-Git-Tag: preEdgeChange~5 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;ds=sidebyside;h=673ab6b3e88d812ae2eb1b9222baaea7f2bb30cc;p=IRC.git bug fix for invalidation (also allow invalidation of objects when these objects are commited inside handlelocalRequest) add few more debug messages for runtime debugging --- diff --git a/Robust/src/Runtime/DSTM/interface/dsmdebug.h b/Robust/src/Runtime/DSTM/interface/dsmdebug.h index ad174121..e0d0a06b 100644 --- a/Robust/src/Runtime/DSTM/interface/dsmdebug.h +++ b/Robust/src/Runtime/DSTM/interface/dsmdebug.h @@ -7,8 +7,9 @@ #define TABORT4(s, d) {printf("%s = %d\n", s, d); fflush(stdout);} #define TABORT5(func, msg1 , msg2, val1, val2) {printf("%s(): %s = %x, %s = %d\n", func, msg1, val1, msg2, val2); fflush(stdout);} #define TABORT6(a, b, c, val1, val2) {printf("%s = %x, %s for %s = %x\n", a, val1, b, c, val2); fflush(stdout);} -#define TABORT7(func, a, b, c, val1, val2) {printf("%s(): %s for %s =%x, %s = %d\n", func, a, b, val1, c, val2); fflush(stdout);} +#define TABORT7(func, a, b, c, val1, val2) {printf("%s(): %s for %s =%d, %s = %x\n", func, a, b, val1, c, val2); fflush(stdout);} #define TABORT8(func, s, d) {printf("%s(): %s = %d\n", func, s, d); fflush(stdout);} +#define TABORT9(func, a, b, c, d, val1, val2, val3) {printf("%s(): %s for %s =%x, %s = %d, %s = %x\n", func, a, b, val1, c, val2, d, val3); fflush(stdout);} #endif diff --git a/Robust/src/Runtime/DSTM/interface/gCollect.c b/Robust/src/Runtime/DSTM/interface/gCollect.c index 91fddb56..9e5e08c6 100644 --- a/Robust/src/Runtime/DSTM/interface/gCollect.c +++ b/Robust/src/Runtime/DSTM/interface/gCollect.c @@ -137,7 +137,13 @@ void clearPLookUpTable(void *begin, void *end) { for(; curr != NULL; curr = curr->next) { if(((unsigned long int)(curr->val) >= tmpbegin) && ((unsigned long int)(curr->val) < tmpend)) { unsigned int oid = curr->key; - prehashRemove(oid); + objheader_t *objheader; + if((objheader = prehashSearch(oid)) != NULL) { + prehashRemove(oid); +#ifdef CHECKTA + printf("%s() clearing Look up table for oid = %x\n", __func__, oid); +#endif + } } } } diff --git a/Robust/src/Runtime/DSTM/interface/trans.c b/Robust/src/Runtime/DSTM/interface/trans.c index 83417510..c0dfe4e5 100644 --- a/Robust/src/Runtime/DSTM/interface/trans.c +++ b/Robust/src/Runtime/DSTM/interface/trans.c @@ -355,6 +355,10 @@ objheader_t *transRead(transrecord_t *record, unsigned int oid) { } else if((tmp = (objheader_t *) prehashSearch(oid)) != NULL) { #ifdef TRANSSTATS nprehashSearch++; +#endif +#ifdef CHECKTA + printf("Prefetch cache read, oid = %x, oidtype =%d\n", oid, TYPE(tmp)); + fflush(stdout); #endif /* Look up in prefetch cache */ GETSIZE(size, tmp); @@ -382,6 +386,10 @@ objheader_t *transRead(transrecord_t *record, unsigned int oid) { } else { #ifdef TRANSSTATS nRemoteSend++; +#endif +#ifdef CHECKTA + printf("Remote read, oid = %x, oidtype =%d\n", oid, TYPE(objcopy)); + fflush(stdout); #endif STATUS(objcopy)=0; #ifdef COMPILER @@ -622,7 +630,7 @@ int transCommit(transrecord_t *record) { #ifdef TRANSSTATS numTransAbort++; #endif -#ifdef CHECKTB +#ifdef CHECKTA char a[] = "Aborting"; TABORT1(a); #endif @@ -637,7 +645,7 @@ int transCommit(transrecord_t *record) { #ifdef TRANSSTATS numTransCommit++; #endif -#ifdef CHECKTB +#ifdef CHECKTA char a[] = "Commiting"; TABORT1(a); #endif @@ -723,6 +731,7 @@ void *transRequest(void *threadarg) { header = (objheader_t *) (((char *)newAddr) + offset); oidToPrefetch = OID(header); #ifdef CHECKTA + printf("Trans disagree for oid = %x: ", OID(header)); char a[] = "object type"; TABORT8(__func__, a, TYPE(header)); #endif @@ -743,11 +752,6 @@ void *transRequest(void *threadarg) { } recvcontrol = control; -#ifdef CHECKTA - char a[] = "mid"; - char c[] = "status"; - TABORT5(__func__, a, c, tdata->mid, control); -#endif /* Update common data structure and increment count */ tdata->recvmsg[tdata->thread_id].rcv_status = recvcontrol; @@ -766,6 +770,29 @@ void *transRequest(void *threadarg) { } pthread_mutex_unlock(tdata->lock); + /* clear objects from prefetch cache */ + /* + if(*(tdata->replyctrl) == TRANS_ABORT) { + int i; + for(i=0; ibuffer->f.nummod; i++) { + unsigned int oid = tdata->buffer->oidmod[i]; + objheader_t *header; + if((header = prehashSearch(oid)) != NULL) { + prehashRemove(oid); + } + } + for(i=0; ibuffer->f.numread; i++) { + char *objread = tdata->buffer->objread; + unsigned int oid = *((unsigned int *)(objread+(sizeof(unsigned int) + + sizeof(unsigned short))*i)); + objheader_t *header; + if((header = prehashSearch(oid)) != NULL) { + prehashRemove(oid); + } + } + } + */ + if(*(tdata->replyctrl) == TRANS_COMMIT) { int retval; /* Update prefetch cache */ @@ -972,10 +999,17 @@ void *handleLocalReq(void *threadarg) { /* Send TRANS_DISAGREE to Coordinator */ localtdata->tdata->recvmsg[localtdata->tdata->thread_id].rcv_status = TRANS_DISAGREE; #ifdef CHECKTA - char a[] = "mid"; - char b[] = "version mismatch"; - char c[] = "object type"; - TABORT7(__func__, b, a, c, localtdata->tdata->mid, TYPE(mobj)); + printf("Trans disagree for oid = %x: ", OID(mobj)); + char a[] = "object type"; + TABORT8(__func__, a, TYPE(mobj)); +#endif + +#ifdef CHECKTA + //char a[] = "mid"; + //char b[] = "version mismatch"; + //char c[] = "object type"; + //char d[] = "oid"; + //TABORT9(__func__, b, a, c, d, localtdata->tdata->mid, TYPE(mobj), OID(mobj)); #endif break; } @@ -991,10 +1025,16 @@ void *handleLocalReq(void *threadarg) { /* Send TRANS_DISAGREE to Coordinator */ localtdata->tdata->recvmsg[localtdata->tdata->thread_id].rcv_status = TRANS_DISAGREE; #ifdef CHECKTA - char a[] = "mid"; - char b[] = "version mismatch"; - char c[] = "object type"; - TABORT7(__func__, b, a, c, localtdata->tdata->mid, TYPE(mobj)); + printf("Trans disagree for oid = %x: ", OID(mobj)); + char a[] = "object type"; + TABORT8(__func__, a, TYPE(mobj)); +#endif +#ifdef CHECKTA + //char a[] = "mid"; + //char b[] = "version mismatch"; + //char c[] = "object type"; + //char d[] = "oid"; + //TABORT9(__func__, b, a, c, d, localtdata->tdata->mid, TYPE(mobj), OID(mobj)); #endif break; } @@ -1008,10 +1048,11 @@ void *handleLocalReq(void *threadarg) { /* Condition to send TRANS_SOFT_ABORT */ if((v_matchlock > 0 && v_nomatch == 0) || (numoidnotfound > 0 && v_nomatch == 0)) { #ifdef CHECKTA - char a[] = "mid"; - char b[] = "version mismatch"; - char c[] = "object type"; - TABORT7(__func__, b, a, c, localtdata->tdata->mid, TYPE(mobj)); + //char a[] = "mid"; + //char b[] = "version mismatch"; + //char c[] = "object type"; + //TABORT7(__func__, b, a, c, localtdata->tdata->mid, TYPE(mobj)); + printf("%s() Soft abort\n", __func__); #endif localtdata->tdata->recvmsg[localtdata->tdata->thread_id].rcv_status = TRANS_SOFT_ABORT; } @@ -1043,6 +1084,14 @@ void *handleLocalReq(void *threadarg) { pthread_exit(NULL); } } else if(*(localtdata->tdata->replyctrl) == TRANS_COMMIT) { + /* Invalidate objects in other machine cache */ + if(localtdata->tdata->buffer->f.nummod > 0) { + int retval; + if((retval = invalidateObj(localtdata->tdata)) != 0) { + printf("Error: %s() in invalidating Objects %s, %d\n", __func__, __FILE__, __LINE__); + return; + } + } if(transComProcess(localtdata) != 0) { printf("Error in transComProcess() %s,%d\n", __FILE__, __LINE__); fflush(stdout); @@ -1092,7 +1141,7 @@ int transComProcess(local_thread_data_array_t *localtdata) { oidcreated = localtdata->tdata->buffer->oidcreated; numlocked = localtdata->transinfo->numlocked; oidlocked = localtdata->transinfo->objlocked; - + for (i = 0; i < nummod; i++) { if((header = (objheader_t *) mhashSearch(oidmod[i])) == NULL) { printf("Error: transComProcess() mhashsearch returns NULL at %s, %d\n", __FILE__, __LINE__);