Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
changeset 246:4c7414df4f0e Common_Ancestor
bug fixes to taking requests out, and core controller
| author | Sean Halle <seanhalle@yahoo.com> |
|---|---|
| date | Wed, 06 Jun 2012 17:59:58 -0700 |
| parents | f1267bc7b342 |
| children | ce781bd98ddb |
| files | CoreController.c Defines/VMS_defs__HW_constants.h Services_Offered_by_VMS/Measurement_and_Stats/probes.c Services_Offered_by_VMS/Memory_Handling/vmalloc.c VMS.h VMS__PI.c VMS__WL.c VMS__int.c |
| diffstat | 8 files changed, 31 insertions(+), 14 deletions(-) [+] |
line diff
1.1 --- a/CoreController.c Wed May 30 14:23:47 2012 -0700 1.2 +++ b/CoreController.c Wed Jun 06 17:59:58 2012 -0700 1.3 @@ -222,6 +222,17 @@ 1.4 pthread_exit( NULL ); 1.5 } 1.6 1.7 +inline uint32_t 1.8 +randomNumber() 1.9 + { 1.10 + _VMSMasterEnv->seed1 = (uint32)(36969 * (_VMSMasterEnv->seed1 & 65535) + 1.11 + (_VMSMasterEnv->seed1 >> 16) ); 1.12 + _VMSMasterEnv->seed2 = (uint32)(18000 * (_VMSMasterEnv->seed2 & 65535) + 1.13 + (_VMSMasterEnv->seed2 >> 16) ); 1.14 + return (_VMSMasterEnv->seed1 << 16) + _VMSMasterEnv->seed2; 1.15 + } 1.16 + 1.17 + 1.18 1.19 /*Busy-wait for a random number of cycles -- chooses number of cycles 1.20 * differently than for the too-many-tries-to-get-lock backoff
2.1 --- a/Defines/VMS_defs__HW_constants.h Wed May 30 14:23:47 2012 -0700 2.2 +++ b/Defines/VMS_defs__HW_constants.h Wed Jun 06 17:59:58 2012 -0700 2.3 @@ -31,7 +31,7 @@ 2.4 #define VIRT_PROCR_STACK_SIZE 0x8000 /* 32K */ 2.5 2.6 // memory for VMS_int__malloc 2.7 -#define MALLOC_ADDITIONAL_MEM_FROM_OS_SIZE 0x80000000 /* 128M */ 2.8 +#define MALLOC_ADDITIONAL_MEM_FROM_OS_SIZE 0x8000000 /* 128M */ 2.9 2.10 //Frequency of TS counts -- have to do tests to verify 2.11 //NOTE: turn off (in BIOS) TURBO-BOOST and SPEED-STEP else won't be const
3.1 --- a/Services_Offered_by_VMS/Measurement_and_Stats/probes.c Wed May 30 14:23:47 2012 -0700 3.2 +++ b/Services_Offered_by_VMS/Measurement_and_Stats/probes.c Wed Jun 06 17:59:58 2012 -0700 3.3 @@ -163,10 +163,11 @@ 3.4 VMS_impl__index_probe_by_its_name( int32 probeID, SlaveVP *animSlv ) 3.5 { IntervalProbe *probe; 3.6 3.7 - //TODO: fix this To be in Master -- race condition 3.8 + VMS_int__get_master_lock(); 3.9 probe = _VMSMasterEnv->intervalProbes[ probeID ]; 3.10 3.11 addValueIntoTable(probe->nameStr, probe, _VMSMasterEnv->probeNameHashTbl); 3.12 + VMS_int__release_master_lock(); 3.13 } 3.14 3.15
4.1 --- a/Services_Offered_by_VMS/Memory_Handling/vmalloc.c Wed May 30 14:23:47 2012 -0700 4.2 +++ b/Services_Offered_by_VMS/Memory_Handling/vmalloc.c Wed Jun 06 17:59:58 2012 -0700 4.3 @@ -163,7 +163,7 @@ 4.4 uint64 searchVector = freeLists->bigChunksSearchVector[0]; 4.5 //set small chunk bits to zero 4.6 searchVector &= MAX_UINT64 << containerIdx; 4.7 - containerIdx = __builtin_ffsl(searchVector); 4.8 + containerIdx = __builtin_ffsl(searchVector); //least significant 1 bit 4.9 4.10 if(containerIdx == 0) 4.11 { 4.12 @@ -171,6 +171,8 @@ 4.13 containerIdx = __builtin_ffsl(searchVector); 4.14 if(containerIdx == 0) 4.15 { 4.16 + //TODO: get additional mem and insert into free list 4.17 + //malloc( MALLOC_ADDITIONAL_MEM_FROM_OS_SIZE ); 4.18 printf("VMS malloc failed: low memory"); 4.19 exit(1); 4.20 } 4.21 @@ -203,6 +205,7 @@ 4.22 * This is sequential code, meant to only be called from the Master, not from 4.23 * any slave Slvs. 4.24 * 4.25 + *May 2012 4.26 *ToDo: Improve speed, by using built-in leading 1 detector to calc free-list 4.27 * index. 4.28 *Change to two separate arrays, one for free-lists of small fixed-size chunks 4.29 @@ -286,10 +289,12 @@ 4.30 4.31 void * 4.32 VMS_WL__malloc( int32 sizeRequested ) 4.33 - { 4.34 + { void *ret; 4.35 + 4.36 VMS_int__get_master_lock(); 4.37 - VMS_int__malloc( sizeRequested ); 4.38 + ret = VMS_int__malloc( sizeRequested ); 4.39 VMS_int__release_master_lock(); 4.40 + return ret; 4.41 } 4.42 4.43
5.1 --- a/VMS.h Wed May 30 14:23:47 2012 -0700 5.2 +++ b/VMS.h Wed Jun 06 17:59:58 2012 -0700 5.3 @@ -360,9 +360,11 @@ 5.4 5.5 VMSReqst * 5.6 VMS_PI__take_next_request_out_of( SlaveVP *slaveWithReq ); 5.7 +//#define VMS_PI__take_next_request_out_of( slave ) slave->requests 5.8 5.9 -inline void * 5.10 -VMS_PI__take_sem_reqst_from( VMSReqst *req ); 5.11 +//inline void * 5.12 +//VMS_PI__take_sem_reqst_from( VMSReqst *req ); 5.13 +#define VMS_PI__take_sem_reqst_from( req ) req->semReqData 5.14 5.15 void inline 5.16 VMS_PI__handle_VMSSemReq( VMSReqst *req, SlaveVP *requestingSlv, void *semEnv,
6.1 --- a/VMS__PI.c Wed May 30 14:23:47 2012 -0700 6.2 +++ b/VMS__PI.c Wed Jun 06 17:59:58 2012 -0700 6.3 @@ -30,8 +30,6 @@ 6.4 handleThrowException( VMSSemReq *semReq, void *semEnv, ResumeSlvFnPtr resumeFn ); 6.5 //======================================================================= 6.6 6.7 -/*May 2012 6.8 - *DEPRECATED -- turn into a macro, that just accesses the request field 6.9 6.10 VMSReqst * 6.11 VMS_PI__take_next_request_out_of( SlaveVP *slaveWithReq ) 6.12 @@ -43,12 +41,11 @@ 6.13 slaveWithReq->requests = slaveWithReq->requests->nextReqst; 6.14 return req; 6.15 } 6.16 -*/ 6.17 -#define VMS_PI__take_next_request_out_of( slave ) slave->requests 6.18 + 6.19 6.20 6.21 /*May 2012 6.22 - *DEPRECATED 6.23 + *CHANGED IMPL -- now a macro in header file 6.24 * 6.25 *Turn function into macro that just accesses the request field 6.26 * 6.27 @@ -58,7 +55,6 @@ 6.28 return req->semReqData; 6.29 } 6.30 */ 6.31 -#define VMS_PI__take_sem_reqst_from( req ) req->semReqData 6.32 6.33 6.34 /* This is for OS requests and VMS infrastructure requests, such as to create
7.1 --- a/VMS__WL.c Wed May 30 14:23:47 2012 -0700 7.2 +++ b/VMS__WL.c Wed Jun 06 17:59:58 2012 -0700 7.3 @@ -143,6 +143,7 @@ 7.4 *To throw exception from wrapper lib or application, first turn 7.5 * it into a request, then send the request 7.6 */ 7.7 +void 7.8 VMS_WL__throw_exception( char *msgStr, SlaveVP *reqstSlv, VMSExcp *excpData ) 7.9 { VMSReqst req; 7.10 VMSSemReq semReq;
8.1 --- a/VMS__int.c Wed May 30 14:23:47 2012 -0700 8.2 +++ b/VMS__int.c Wed Jun 06 17:59:58 2012 -0700 8.3 @@ -250,7 +250,8 @@ 8.4 } 8.5 8.6 //try to get the lock 8.7 - gotLock = __sync_bool_compare_and_swap( addrOfMasterLock, UNLOCKED, LOCKED ); 8.8 + gotLock = __sync_bool_compare_and_swap( addrOfMasterLock, 8.9 + UNLOCKED, LOCKED ); 8.10 } 8.11 MEAS__Capture_Post_Master_Lock_Point; 8.12 }
