Merge branch 'master' into ksII-rm-dev
authorJustin Sobota <jsobota@ti.com>
Fri, 31 May 2013 19:14:50 +0000 (15:14 -0400)
committerJustin Sobota <jsobota@ti.com>
Fri, 31 May 2013 19:14:50 +0000 (15:14 -0400)
include/rm_internal.h
rm_services.h
src/rm.c
src/rm_allocator.c
src/rm_services.c
src/rm_transport.c
test/src/rm_shared_test.c
test/src/rm_test.c

index 40a56e0d2520f3bb61d5416813a699ebc07c3189..ca7ca2a1e6802b779f61b896d35714c1eed6adf8 100644 (file)
@@ -105,6 +105,8 @@ typedef struct {
     /* Resource owner count - number of instances that are in the
      * resource's owner list */
     int32_t  ownerCount;
+    /* Requesting instance's allocation count for the resource */
+    int32_t  instAllocCount;
     /* NameServer name tied to resource */
     char     nameServerName[RM_NAME_MAX_CHARS];
 } Rm_ResourceInfo;
index a00292bf43a20c0efc2e935c96b06c4c90772c06..ec9c21e79c30b13f8858540658623bd4b1086035 100644 (file)
@@ -110,6 +110,12 @@ typedef struct {
      *  than one means the resource is being shared.  This value is only valid
      *  if the serviceState is RM_SERVICE_APPROVED or RM_SERVICE_APPROVED_STATIC. */
     int32_t   resourceNumOwners;
+/** instAllocCount is not valid unless >= 0 */
+#define RM_INST_ALLOC_COUNT_INVALID (-1) 
+    /** Number of times the requesting instance has allocated the returned resource.
+     *  This value is only valid if the serviceState is RM_SERVICE_APPROVED or
+     *  RM_SERVICE_APPROVED_STATIC */
+    int32_t   instAllocCount;
 } Rm_ServiceRespInfo;
 
 /** 
index e99d5190d9a8a5db815b2683bd0a6b783b214636..59098aead097f1fabcc9e1d40794c47e08c54f14 100644 (file)
--- a/src/rm.c
+++ b/src/rm.c
@@ -220,9 +220,9 @@ static void serviceResponder (Rm_Inst *rmInst, Rm_Transaction *transaction)
     /* Pass back the ID that was provided to the component when it requested
      * the service */
     serviceResponse.serviceId = transaction->localId;
-    /* Owner count will only be set within RM under certain circumstances.  Most of time
-     * it will be RM_RESOURCE_NUM_OWNERS_INVALID */
+    /* Owner and instance allocation count will only be set within RM under certain circumstances. */
     serviceResponse.resourceNumOwners = transaction->resourceInfo.ownerCount;
+    serviceResponse.instAllocCount = transaction->resourceInfo.instAllocCount;
 
     /* Service was approved and service was an allocate request.  The resource
      * data is passed back to the component */
index 50beaa526e7e087301b410d7915894d0ce2cb8ed..c18b64502b7888f432a9c2ebaba34bc7989ef140 100644 (file)
@@ -109,7 +109,7 @@ static Rm_Allocator *allocatorAdd(Rm_Handle rmHandle, const char *resourceName)
  *              instance node is in the list of resource node owners.  Otherwise,
  *              returns 0.
  */
-static int allocatorResNodeIsOwnedBy(Rm_Handle rmHandle, Rm_ResourceNode *node, void *serviceInstNode)
+static int allocatorResNodeIsOwnedBy(Rm_Handle rmHandle, Rm_ResourceNode *node, Rm_PolicyValidInstNode *serviceInstNode)
 {
     Rm_Inst  *rmInst = (Rm_Inst *)rmHandle;
     Rm_Owner *owner = node->ownerList;
@@ -128,7 +128,7 @@ static int allocatorResNodeIsOwnedBy(Rm_Handle rmHandle, Rm_ResourceNode *node,
  ***********************************************************************
  * DESCRIPTION: Increments a resource owner's reference count
  */
-static void allocatorResNodeOwnerRefCntInc(Rm_Handle rmHandle, Rm_ResourceNode *node, void *serviceInstNode)
+static void allocatorResNodeOwnerRefCntInc(Rm_Handle rmHandle, Rm_ResourceNode *node, Rm_PolicyValidInstNode *serviceInstNode)
 {
     Rm_Inst  *rmInst = (Rm_Inst *)rmHandle;
     Rm_Owner *owner = node->ownerList;
@@ -148,7 +148,7 @@ static void allocatorResNodeOwnerRefCntInc(Rm_Handle rmHandle, Rm_ResourceNode *
  ***********************************************************************
  * DESCRIPTION: Decrements a resource owner's reference count
  */
-static void allocatorResNodeOwnerRefCntDec(Rm_Handle rmHandle, Rm_ResourceNode *node, void *serviceInstNode)
+static void allocatorResNodeOwnerRefCntDec(Rm_Handle rmHandle, Rm_ResourceNode *node, Rm_PolicyValidInstNode *serviceInstNode)
 {
     Rm_Inst  *rmInst = (Rm_Inst *)rmHandle;
     Rm_Owner *owner = node->ownerList;
@@ -164,13 +164,33 @@ static void allocatorResNodeOwnerRefCntDec(Rm_Handle rmHandle, Rm_ResourceNode *
     }
 }
 
+/* FUNCTION PURPOSE: Returns an owner's refCnt
+ ***********************************************************************
+ * DESCRIPTION: Returns a resource owner's reference count
+ */
+static uint16_t allocatorResNodeOwnerGetRefCnt(Rm_Handle rmHandle, Rm_ResourceNode *node, Rm_PolicyValidInstNode *serviceInstNode)
+{
+    Rm_Inst  *rmInst = (Rm_Inst *)rmHandle;
+    Rm_Owner *owner = node->ownerList;
+
+    while (owner) {
+        RM_SS_OBJ_INV(owner, Rm_Owner);
+        if (owner->instNameNode == serviceInstNode) {
+            return (owner->refCnt);
+        }
+        owner = owner->nextOwner;
+    }
+
+    return(0);
+}
+
 /* FUNCTION PURPOSE: Adds an owner to an allocator resource
  ***********************************************************************
  * DESCRIPTION: Adds a RM instance node to a resource node's
  *              list of owners.  If the owner is already present that
  *              owner's reference count is incremented
  */
-static void allocatorResNodeOwnerAdd(Rm_Handle rmHandle, Rm_ResourceNode *node, void *serviceInstNode)
+static void allocatorResNodeOwnerAdd(Rm_Handle rmHandle, Rm_ResourceNode *node, Rm_PolicyValidInstNode *serviceInstNode)
 {
     Rm_Inst  *rmInst = (Rm_Inst *)rmHandle;    
     Rm_Owner *ownerList = node->ownerList;
@@ -397,7 +417,7 @@ static void allocatorResNodeOwnerClear(Rm_Handle rmHandle, Rm_ResourceNode *node
  *              resource's owner reference count is returned if the 
  *              resource range is found.
  */
-static int32_t allocatorStatus(Rm_Allocator *allocator, Rm_AllocatorOpInfo *opInfo)
+static int32_t allocatorStatus(Rm_Handle rmHandle, Rm_Allocator *allocator, Rm_AllocatorOpInfo *opInfo)
 {
     Rm_ResourceNode  findNode;
     Rm_ResourceNode *matchingNode = NULL; 
@@ -415,6 +435,8 @@ static int32_t allocatorStatus(Rm_Allocator *allocator, Rm_AllocatorOpInfo *opIn
         findEnd = findNode.base + findNode.length - 1;
         if ((findNode.base >= matchingNode->base) && (findEnd <= matchingEnd)) {        
             opInfo->resourceInfo->ownerCount = matchingNode->allocationCount;
+            opInfo->resourceInfo->instAllocCount = allocatorResNodeOwnerGetRefCnt(rmHandle, matchingNode,
+                                                                                  opInfo->serviceSrcInstNode);            
             retVal = RM_SERVICE_APPROVED;
         }
         else {
@@ -768,8 +790,11 @@ static int32_t allocatorAllocate(Rm_Handle rmHandle, Rm_Allocator *allocator, in
                     /* Always reinsert matchingNode */                
                     RB_INSERT(_Rm_AllocatorResourceTree, allocator->allocatorRootEntry, matchingNode);
                     
-                    /* Matching node contains new reference count after alloc.  Return new owner count. */
+                    /* Matching node contains new reference count after alloc.  Return new owner count
+                     * and originating instance allocation reference count. */
                     opInfo->resourceInfo->ownerCount = matchingNode->allocationCount;
+                    opInfo->resourceInfo->instAllocCount = allocatorResNodeOwnerGetRefCnt(rmHandle, matchingNode,
+                                                                                          opInfo->serviceSrcInstNode);
                 }   
                 else if ((findNode.base > matchingNode->base) && (findEnd < matchingEnd)) {
                     /* findNode range is subset of matchingNode range and neither boundary is
@@ -793,8 +818,11 @@ static int32_t allocatorAllocate(Rm_Handle rmHandle, Rm_Allocator *allocator, in
                     RB_INSERT(_Rm_AllocatorResourceTree, allocator->allocatorRootEntry, leftNode);
                     RB_INSERT(_Rm_AllocatorResourceTree, allocator->allocatorRootEntry, rightNode);
                     
-                    /* Matching node contains new reference count after alloc.  Return new owner count. */
+                    /* Matching node contains new reference count after alloc.  Return new owner count
+                     * and originating instance allocation reference count. */
                     opInfo->resourceInfo->ownerCount = matchingNode->allocationCount;
+                    opInfo->resourceInfo->instAllocCount = allocatorResNodeOwnerGetRefCnt(rmHandle, matchingNode, 
+                                                                                          opInfo->serviceSrcInstNode);
                 }  
                 else {    
                     if (findNode.base == matchingNode->base) {
@@ -825,8 +853,11 @@ static int32_t allocatorAllocate(Rm_Handle rmHandle, Rm_Allocator *allocator, in
                         matchingNode->length = matchingEnd - findEnd;  
 
                         RB_INSERT(_Rm_AllocatorResourceTree, allocator->allocatorRootEntry, leftNode);
-                        /* Left node contains new reference count after alloc.  Return new owner count. */
+                        /* Left node contains new reference count after alloc.  Return new owner count
+                         * and originating instance allocation reference count. */
                         opInfo->resourceInfo->ownerCount = leftNode->allocationCount;
+                        opInfo->resourceInfo->instAllocCount = allocatorResNodeOwnerGetRefCnt(rmHandle, leftNode, 
+                                                                                              opInfo->serviceSrcInstNode);
                     }
                     else if (findEnd == matchingEnd) {
                         /* findNode end and matchingNode end are equivalent.  May be combine
@@ -856,8 +887,11 @@ static int32_t allocatorAllocate(Rm_Handle rmHandle, Rm_Allocator *allocator, in
                         matchingNode->length -= findNode.length;  
 
                         RB_INSERT(_Rm_AllocatorResourceTree, allocator->allocatorRootEntry, rightNode);
-                        /* Right node contains new reference count after alloc.  Return new owner count. */
+                        /* Right node contains new reference count after alloc.  Return new owner count
+                         * and originating instance allocation reference count. */
                         opInfo->resourceInfo->ownerCount = rightNode->allocationCount;
+                        opInfo->resourceInfo->instAllocCount = allocatorResNodeOwnerGetRefCnt(rmHandle, rightNode, 
+                                                                                              opInfo->serviceSrcInstNode);
                     }
                     /* Remove allocating instance from leftover matchingNode */
                     allocatorResNodeOwnerDelete(rmHandle, matchingNode, opInfo->serviceSrcInstNode);
@@ -981,8 +1015,11 @@ static int32_t allocatorFree(Rm_Handle rmHandle, Rm_Allocator *allocator, Rm_All
                         /* Always reinsert matchingNode */
                         RB_INSERT(_Rm_AllocatorResourceTree, allocator->allocatorRootEntry, matchingNode);
                         
-                        /* Matching node is what remains after free.  Return remaining owner count. */
+                        /* Matching node is what remains after free.  Return remaining owner count
+                         * and originating instance allocation reference count. */
                         opInfo->resourceInfo->ownerCount = matchingNode->allocationCount;
+                        opInfo->resourceInfo->instAllocCount = allocatorResNodeOwnerGetRefCnt(rmHandle, matchingNode,
+                                                                                              opInfo->serviceSrcInstNode);
                     }
                     else if ((findNode.base > matchingNode->base) && (findEnd < matchingEnd)) {
                         /* Case 2: Free range is less than range in matched node. Split
@@ -1011,8 +1048,11 @@ static int32_t allocatorFree(Rm_Handle rmHandle, Rm_Allocator *allocator, Rm_All
                         matchingNode->length = findNode.length;
                         RB_INSERT(_Rm_AllocatorResourceTree, allocator->allocatorRootEntry, matchingNode);
                         
-                        /* Matching node is what remains after free.  Return remaining owner count. */
+                        /* Matching node is what remains after free.  Return remaining owner count
+                         * and originating instance allocation reference count. */
                         opInfo->resourceInfo->ownerCount = matchingNode->allocationCount;
+                        opInfo->resourceInfo->instAllocCount = allocatorResNodeOwnerGetRefCnt(rmHandle, matchingNode,
+                                                                                              opInfo->serviceSrcInstNode);
                     }
                     else {                        
                         if (findNode.base == matchingNode->base) {
@@ -1044,8 +1084,11 @@ static int32_t allocatorFree(Rm_Handle rmHandle, Rm_Allocator *allocator, Rm_All
                             matchingNode->length = matchingEnd - findEnd;  
                             RB_INSERT(_Rm_AllocatorResourceTree, allocator->allocatorRootEntry, leftNode);
                             
-                            /* Left node is what remains after free.  Return remaining owner count. */
+                            /* Left node is what remains after free.  Return remaining owner count
+                             * and originating instance allocation reference count. */
                             opInfo->resourceInfo->ownerCount = leftNode->allocationCount;
+                            opInfo->resourceInfo->instAllocCount = allocatorResNodeOwnerGetRefCnt(rmHandle, leftNode,
+                                                                                                  opInfo->serviceSrcInstNode);
                         }
                         else if (findEnd == matchingEnd) {
                             /* Case 4: Free range is on right boundary of matched node. Try to 
@@ -1076,8 +1119,11 @@ static int32_t allocatorFree(Rm_Handle rmHandle, Rm_Allocator *allocator, Rm_All
                             matchingNode->length -= findNode.length;  
                             RB_INSERT(_Rm_AllocatorResourceTree, allocator->allocatorRootEntry, rightNode);
                             
-                            /* Right node is what remains after free.  Return remaining owner count. */
+                            /* Right node is what remains after free.  Return remaining owner count
+                             * and originating instance allocation reference count. */
                             opInfo->resourceInfo->ownerCount = rightNode->allocationCount;
+                            opInfo->resourceInfo->instAllocCount = allocatorResNodeOwnerGetRefCnt(rmHandle, rightNode,
+                                                                                                  opInfo->serviceSrcInstNode);
                         }
 
                         /* Add freeing instance back into matchingNode allocations */
@@ -1087,14 +1133,20 @@ static int32_t allocatorFree(Rm_Handle rmHandle, Rm_Allocator *allocator, Rm_All
                     retVal = RM_SERVICE_APPROVED;
                 }
                 else {
-                    /* Return owner count.  In case it's a reference count check in application */
+                    /* Return owner count and instance alloc count.  In case it's a reference count
+                     * check in application */
                     opInfo->resourceInfo->ownerCount = matchingNode->allocationCount;
+                    opInfo->resourceInfo->instAllocCount = allocatorResNodeOwnerGetRefCnt(rmHandle, matchingNode,
+                                                                                          opInfo->serviceSrcInstNode);
                     retVal = RM_SERVICE_DENIED_RES_NOT_ALLOCD_TO_INST;
                 }
             }
             else {
-                /* Return owner count.  In case it's a reference count check in application */
+                /* Return owner count and instance alloc count.  In case it's a reference count
+                 * check in application */
                 opInfo->resourceInfo->ownerCount = matchingNode->allocationCount;
+                opInfo->resourceInfo->instAllocCount = allocatorResNodeOwnerGetRefCnt(rmHandle, matchingNode,
+                                                                                      opInfo->serviceSrcInstNode);
                 retVal = RM_SERVICE_DENIED_RES_ALREADY_FREE;
             }
         }
@@ -1497,7 +1549,7 @@ int32_t rmAllocatorOperation(Rm_Handle rmHandle, Rm_AllocatorOpInfo *opInfo)
         }
 
         if (opInfo->operation == Rm_allocatorOp_GET_STATUS) {
-            retVal = allocatorStatus(allocator, opInfo);
+            retVal = allocatorStatus(rmHandle, allocator, opInfo);
         }
         else if ((opInfo->operation == Rm_allocatorOp_PRE_ALLOCATE_INIT) ||
                  (opInfo->operation == Rm_allocatorOp_PRE_ALLOCATE_USE)) {
index 2b0355f2fb3ee4c91028101d7adbe7cf31fe94e4..a2d13e79fd6e013c6892345b388f3d4991c566fb 100644 (file)
@@ -130,7 +130,8 @@ void Rm_serviceHandler (void *rmHandle, const Rm_ServiceReqInfo *serviceRequest,
         transaction->resourceInfo.base = serviceRequest->resourceBase;
         transaction->resourceInfo.length = serviceRequest->resourceLength;
         transaction->resourceInfo.alignment = serviceRequest->resourceAlignment;
-        transaction->resourceInfo.ownerCount = RM_RESOURCE_NUM_OWNERS_INVALID;        
+        transaction->resourceInfo.ownerCount = RM_RESOURCE_NUM_OWNERS_INVALID;
+        transaction->resourceInfo.instAllocCount = RM_INST_ALLOC_COUNT_INVALID;
         if (serviceRequest->resourceNsName) {
             strncpy(transaction->resourceInfo.nameServerName, serviceRequest->resourceNsName, RM_NAME_MAX_CHARS);
         }
@@ -155,9 +156,9 @@ void Rm_serviceHandler (void *rmHandle, const Rm_ServiceReqInfo *serviceRequest,
 
             serviceResponse->rmHandle = rmHandle;
             serviceResponse->serviceState = transaction->state;
-            /* Owner count will only be set within RM under certain circumstances.  Most of time
-             * it will be RM_RESOURCE_NUM_OWNERS_INVALID */
+            /* Owner and instance allocation count will only be set within RM under certain circumstances. */
             serviceResponse->resourceNumOwners = transaction->resourceInfo.ownerCount;
+            serviceResponse->instAllocCount = transaction->resourceInfo.instAllocCount;
             if ((serviceResponse->serviceState == RM_SERVICE_PROCESSING) ||
                 (serviceResponse->serviceState == RM_SERVICE_APPROVED_STATIC) ||
                 (serviceResponse->serviceState == RM_SERVICE_PENDING_SERVER_RESPONSE)) {
index 38126d229f9288d7b02fa217d6dbea857ddeab8e..470a6d19e6f57a2ab36954b3bbbc564c44c52d14 100644 (file)
@@ -373,8 +373,9 @@ int32_t Rm_receivePacket(Rm_TransportHandle transportHandle, const Rm_Packet *pk
                             sizeof(Rm_ResourceInfo));\r
                 }\r
                 else {\r
-                    /* Always copy owner count */\r
+                    /* Always copy owner count and instance allocation count */\r
                     transaction->resourceInfo.ownerCount = resourceRespPkt->resourceInfo.ownerCount;\r
+                    transaction->resourceInfo.instAllocCount = resourceRespPkt->resourceInfo.instAllocCount;\r
                 }\r
             }\r
             else {\r
index 5f46c4e443c1c872512f435d00dbd6e1ead52d5b..6a0617c0854627bc65b31ff1eb27bef87e00d932 100644 (file)
         System_printf ("\n");                                                                       \
     } while(0);    
 
-#define STATUS_PASS_CHECK(title, core, instName, resName, resStart, resLen, refCnt, state, check, expectRefCnt) \
+#define STATUS_PASS_CHECK(title, core, instName, resName, resStart, resLen, refCnt, allocCnt, state, check, expectRefCnt, expectAllocCnt) \
     do {                                                                                                        \
         int32_t start = resStart;                                                                               \
         char    titleMsg[] = title;                                                                             \
                        core, expectRefCnt);                                                                     \
         System_printf ("Core %d : - Returned Owner Count: %-16d                -\n",                            \
                        core, refCnt);                                                                           \
+        System_printf ("Core %d : - Expected Inst Allocation Count: %-16d      -\n",                            \
+                       core, expectAllocCnt);                                                                   \
+        System_printf ("Core %d : - Returned Inst Allocation Count: %-16d      -\n",                            \
+                       core, allocCnt);                                                                         \
         System_printf ("Core %d : -                                                       -\n", core);          \
-        if ((state == check) && (refCnt == expectRefCnt)) {                                                     \
+        if ((state == check) && (refCnt == expectRefCnt) && (allocCnt == expectAllocCnt)) {                     \
             System_printf ("Core %d : - PASSED                                                -\n", core);      \
         }                                                                                                       \
         else {                                                                                                  \
                 System_printf ("Core %d : - FAILED - Owner Count Mismatch                         -\n",         \
                                core);                                                                           \
             }                                                                                                   \
+            else if (allocCnt != expectAllocCnt) {                                                              \
+                System_printf ("Core %d : - FAILED - Instance Allocation Count Mismatch           -\n",         \
+                               core);                                                                           \
+            }                                                                                                   \
             else {                                                                                              \
                 System_printf ("Core %d : - FAILED - Denial: %-6d                               -\n",           \
                                core, state);                                                                    \
@@ -586,7 +594,8 @@ void rmServerTsk(UArg arg0, UArg arg1)
     STATUS_PASS_CHECK("----- Status Check of Resources from Shared Server ------", 
                       coreNum, rmServerName, responseInfo.resourceName,
                       responseInfo.resourceBase, responseInfo.resourceLength, 
-                      responseInfo.resourceNumOwners, responseInfo.serviceState, RM_SERVICE_APPROVED, 2); 
+                      responseInfo.resourceNumOwners, responseInfo.instAllocCount,
+                      responseInfo.serviceState, RM_SERVICE_APPROVED, 2, 1); 
 
     /* Get the status of a resource from Server */
     setRmRequest(&requestInfo, Rm_service_RESOURCE_STATUS, resourceNameQosCluster, 
@@ -595,7 +604,8 @@ void rmServerTsk(UArg arg0, UArg arg1)
     STATUS_PASS_CHECK("----- Status Check of Resources from Shared Server ------", 
                       coreNum, rmServerName, responseInfo.resourceName,
                       responseInfo.resourceBase, responseInfo.resourceLength, 
-                      responseInfo.resourceNumOwners, responseInfo.serviceState, RM_SERVICE_APPROVED, 0);
+                      responseInfo.resourceNumOwners, responseInfo.instAllocCount,
+                      responseInfo.serviceState, RM_SERVICE_APPROVED, 0, 0);
 
 #if PRINT_USED_RESOURCES
     Rm_resourceStatus(rmSharedHandle.sharedServerHandle, RM_TEST_TRUE);
@@ -764,7 +774,8 @@ void rmClientTsk(UArg arg0, UArg arg1)
     STATUS_PASS_CHECK("------- Resource Status Check from Shared Client --------", 
                       coreNum, rmSharedClient2Name, responseInfo.resourceName,
                       responseInfo.resourceBase, responseInfo.resourceLength, 
-                      responseInfo.resourceNumOwners, responseInfo.serviceState, RM_SERVICE_APPROVED, 2);   
+                      responseInfo.resourceNumOwners, responseInfo.instAllocCount,
+                      responseInfo.serviceState, RM_SERVICE_APPROVED, 2, 1);   
     
     setRmRequest(&requestInfo, Rm_service_RESOURCE_STATUS, resourceNameGpQ, 
                  4025, 20, 0, NULL, RM_TEST_FALSE, &responseInfo);     
@@ -772,7 +783,8 @@ void rmClientTsk(UArg arg0, UArg arg1)
     STATUS_PASS_CHECK("------- Resource Status Check from Shared Client --------", 
                       coreNum, rmSharedClient1Name, responseInfo.resourceName,
                       responseInfo.resourceBase, responseInfo.resourceLength, 
-                      responseInfo.resourceNumOwners, responseInfo.serviceState, RM_SERVICE_APPROVED, 1);        
+                      responseInfo.resourceNumOwners, responseInfo.instAllocCount,
+                      responseInfo.serviceState, RM_SERVICE_APPROVED, 1, 0);        
     /* END Getting the status of resources from Client and CD */    
 
     GateMP_leave(clientGate, clientKey);
index a24954e46f1c14245e007b1d4cc031bf1e236dd4..afb25a865f7a5d0e6bb67f92215e0364545db255 100644 (file)
         System_printf ("\n");                                                                       \
     } while(0);    
 
-#define STATUS_PASS_CHECK(title, core, instName, resName, resStart, resLen, refCnt, state, check, expectRefCnt) \
+#define STATUS_PASS_CHECK(title, core, instName, resName, resStart, resLen, refCnt, allocCnt, state, check, expectRefCnt, expectAllocCnt) \
     do {                                                                                                        \
         int32_t start = resStart;                                                                               \
         char    titleMsg[] = title;                                                                             \
                        core, expectRefCnt);                                                                     \
         System_printf ("Core %d : - Returned Owner Count: %-16d                -\n",                            \
                        core, refCnt);                                                                           \
+        System_printf ("Core %d : - Expected Inst Allocation Count: %-16d      -\n",                            \
+                       core, expectAllocCnt);                                                                   \
+        System_printf ("Core %d : - Returned Inst Allocation Count: %-16d      -\n",                            \
+                       core, allocCnt);                                                                         \
         System_printf ("Core %d : -                                                       -\n", core);          \
-        if ((state == check) && (refCnt == expectRefCnt)) {                                                     \
+        if ((state == check) && (refCnt == expectRefCnt) && (allocCnt == expectAllocCnt)) {                     \
             System_printf ("Core %d : - PASSED                                                -\n", core);      \
         }                                                                                                       \
         else {                                                                                                  \
                 System_printf ("Core %d : - FAILED - Owner Count Mismatch                         -\n",         \
                                core);                                                                           \
             }                                                                                                   \
+            else if (allocCnt != expectAllocCnt) {                                                              \
+                System_printf ("Core %d : - FAILED - Instance Allocation Count Mismatch           -\n",         \
+                               core);                                                                           \
+            }                                                                                                   \
             else {                                                                                              \
                 System_printf ("Core %d : - FAILED - Denial: %-6d                               -\n",           \
                                core, state);                                                                    \
@@ -821,6 +829,16 @@ void rmServerTsk(UArg arg0, UArg arg1)
                         requestInfo.resourceBase, requestInfo.resourceLength, 
                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
     
+    /* Get the status of a resource from Server */
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_STATUS, resourceNameGpQ, 
+                 6543, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    STATUS_PASS_CHECK("--------- Status Check of Resources from Server ---------", 
+                      coreNum, rmServerName, responseInfo.resourceName,
+                      responseInfo.resourceBase, responseInfo.resourceLength, 
+                      responseInfo.resourceNumOwners, responseInfo.instAllocCount, responseInfo.serviceState,
+                      RM_SERVICE_APPROVED, 1, 2); 
+    
     /* Should take two frees to free both references */
     setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameGpQ, 
                  6543, 5, 0, NULL, RM_TEST_TRUE, &responseInfo);      
@@ -830,13 +848,33 @@ void rmServerTsk(UArg arg0, UArg arg1)
                         requestInfo.resourceBase, requestInfo.resourceLength, 
                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
 
+    /* Get the status of a resource from Server */
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_STATUS, resourceNameGpQ, 
+                 6543, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    STATUS_PASS_CHECK("--------- Status Check of Resources from Server ---------", 
+                      coreNum, rmServerName, responseInfo.resourceName,
+                      responseInfo.resourceBase, responseInfo.resourceLength, 
+                      responseInfo.resourceNumOwners, responseInfo.instAllocCount, responseInfo.serviceState,
+                      RM_SERVICE_APPROVED, 1, 1); 
+
     setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameGpQ, 
                  6543, 2, 0, NULL, RM_TEST_TRUE, &responseInfo);      
     rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);
     POSITIVE_PASS_CHECK("------- Free of Resource from Same Inst (2nd Ref) -------", 
                         coreNum, rmServerName, resourceNameGpQ,
                         requestInfo.resourceBase, requestInfo.resourceLength, 
-                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);     
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
+
+    /* Get the status of a resource from Server */
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_STATUS, resourceNameGpQ, 
+                 6543, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    STATUS_PASS_CHECK("--------- Status Check of Resources from Server ---------", 
+                      coreNum, rmServerName, responseInfo.resourceName,
+                      responseInfo.resourceBase, responseInfo.resourceLength, 
+                      responseInfo.resourceNumOwners, responseInfo.instAllocCount, responseInfo.serviceState,
+                      RM_SERVICE_APPROVED, 0, 0);     
 
     /* Allocate infrastructure queue taken by Linux kernel and shared with Rm_Client.  Expect error or denial. */
     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameInfraQ, 
@@ -853,7 +891,8 @@ void rmServerTsk(UArg arg0, UArg arg1)
     STATUS_PASS_CHECK("--------- Status Check of Resources from Server ---------", 
                       coreNum, rmServerName, responseInfo.resourceName,
                       responseInfo.resourceBase, responseInfo.resourceLength, 
-                      responseInfo.resourceNumOwners, responseInfo.serviceState, RM_SERVICE_APPROVED, 2); 
+                      responseInfo.resourceNumOwners, responseInfo.instAllocCount, responseInfo.serviceState,
+                      RM_SERVICE_APPROVED, 2, 1); 
 
     /* Get the status of a resource from Server */
     setRmRequest(&requestInfo, Rm_service_RESOURCE_STATUS, resourceNameQosCluster, 
@@ -862,7 +901,8 @@ void rmServerTsk(UArg arg0, UArg arg1)
     STATUS_PASS_CHECK("--------- Status Check of Resources from Server ---------", 
                       coreNum, rmServerName, responseInfo.resourceName,
                       responseInfo.resourceBase, responseInfo.resourceLength, 
-                      responseInfo.resourceNumOwners, responseInfo.serviceState, RM_SERVICE_APPROVED, 0);
+                      responseInfo.resourceNumOwners, responseInfo.instAllocCount,
+                      responseInfo.serviceState, RM_SERVICE_APPROVED, 0, 0);
 
     /* BEGIN Testing CD local allocation feature from Server */
     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameGpQ, 
@@ -930,7 +970,8 @@ void rmClientTsk(UArg arg0, UArg arg1)
     STATUS_PASS_CHECK("---- Retrieve Resource Status Via NameServer Object -----", 
                       coreNum, rmClientName, responseInfo.resourceName,
                       responseInfo.resourceBase, responseInfo.resourceLength, 
-                      responseInfo.resourceNumOwners, responseInfo.serviceState, RM_SERVICE_APPROVED, 1);  
+                      responseInfo.resourceNumOwners, responseInfo.instAllocCount,
+                      responseInfo.serviceState, RM_SERVICE_APPROVED, 1, 1);  
 
     /* Free resource via a NameServer name */
     setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, NULL, 
@@ -1066,7 +1107,8 @@ void rmClientTsk(UArg arg0, UArg arg1)
     STATUS_PASS_CHECK("-- Status Check of Resources from Client (Non-Blocking) -", 
                       coreNum, rmClientName, responseInfo.resourceName,
                       responseInfo.resourceBase, responseInfo.resourceLength, 
-                      responseInfo.resourceNumOwners, responseInfo.serviceState, RM_SERVICE_APPROVED, 2);   
+                      responseInfo.resourceNumOwners, responseInfo.instAllocCount,
+                      responseInfo.serviceState, RM_SERVICE_APPROVED, 2, 1);   
     
     setRmRequest(&requestInfo, Rm_service_RESOURCE_STATUS, resourceNameGpQ, 
                  4025, 20, 0, NULL, RM_TEST_FALSE, &responseInfo);     
@@ -1074,7 +1116,8 @@ void rmClientTsk(UArg arg0, UArg arg1)
     STATUS_PASS_CHECK("---- Status Check of Resources from Client (Blocking) ---", 
                       coreNum, rmClientName, responseInfo.resourceName,
                       responseInfo.resourceBase, responseInfo.resourceLength, 
-                      responseInfo.resourceNumOwners, responseInfo.serviceState, RM_SERVICE_APPROVED, 1);      
+                      responseInfo.resourceNumOwners, responseInfo.instAllocCount,
+                      responseInfo.serviceState, RM_SERVICE_APPROVED, 1, 0);      
 
     setRmRequest(&requestInfo, Rm_service_RESOURCE_STATUS, resourceNameInfraQ, 
                  800, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
@@ -1083,7 +1126,8 @@ void rmClientTsk(UArg arg0, UArg arg1)
     STATUS_PASS_CHECK("---- Status Check of Resources from CD (Non-Blocking) ---", 
                       coreNum, rmCdName, responseInfo.resourceName,
                       responseInfo.resourceBase, responseInfo.resourceLength, 
-                      responseInfo.resourceNumOwners, responseInfo.serviceState, RM_SERVICE_APPROVED, 2); 
+                      responseInfo.resourceNumOwners, responseInfo.instAllocCount,
+                      responseInfo.serviceState, RM_SERVICE_APPROVED, 2, 0); 
 
     setRmRequest(&requestInfo, Rm_service_RESOURCE_STATUS, resourceNameInfraQ, 
                  805, 6, 0, NULL, RM_TEST_FALSE, &responseInfo);     
@@ -1091,7 +1135,8 @@ void rmClientTsk(UArg arg0, UArg arg1)
     STATUS_PASS_CHECK("------ Status Check of Resources from CD (Blocking) -----", 
                       coreNum, rmCdName, responseInfo.resourceName,
                       responseInfo.resourceBase, responseInfo.resourceLength, 
-                      responseInfo.resourceNumOwners, responseInfo.serviceState, RM_SERVICE_APPROVED, 1);   
+                      responseInfo.resourceNumOwners, responseInfo.instAllocCount, 
+                      responseInfo.serviceState, RM_SERVICE_APPROVED, 1, 0);   
     /* END Getting the status of resources from Client and CD */    
 
     /* BEGIN Testing CD local allocation feature */
@@ -1177,7 +1222,8 @@ void rmClientTsk(UArg arg0, UArg arg1)
     STATUS_PASS_CHECK("----- Status Check of Resource Alloc'd Locally to CD ----", 
                       coreNum, rmCdName, responseInfo.resourceName,
                       responseInfo.resourceBase, responseInfo.resourceLength, 
-                      responseInfo.resourceNumOwners, responseInfo.serviceState, RM_SERVICE_APPROVED, 1); 
+                      responseInfo.resourceNumOwners, responseInfo.instAllocCount,
+                      responseInfo.serviceState, RM_SERVICE_APPROVED, 1, 0); 
 
     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameLowPrioQ, 
                  responseInfo.resourceBase, responseInfo.resourceLength, 0, NULL, RM_TEST_TRUE, &responseInfo);     
@@ -1194,7 +1240,8 @@ void rmClientTsk(UArg arg0, UArg arg1)
     STATUS_PASS_CHECK("- Status Check of Res Alloc'd Locally to CD After Share -", 
                       coreNum, rmClientName, responseInfo.resourceName,
                       responseInfo.resourceBase, responseInfo.resourceLength, 
-                      responseInfo.resourceNumOwners, responseInfo.serviceState, RM_SERVICE_APPROVED, 2);
+                      responseInfo.resourceNumOwners, responseInfo.instAllocCount,
+                      responseInfo.serviceState, RM_SERVICE_APPROVED, 2, 1);
 
     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameGpQ, 
                  900, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
@@ -1229,7 +1276,8 @@ void rmClientTsk(UArg arg0, UArg arg1)
     STATUS_PASS_CHECK("-- Status Check After Free of Locally Shared Resource ---", 
                       coreNum, rmClientName, responseInfo.resourceName,
                       responseInfo.resourceBase, responseInfo.resourceLength, 
-                      responseInfo.resourceNumOwners, responseInfo.serviceState, RM_SERVICE_APPROVED, 0);   
+                      responseInfo.resourceNumOwners, responseInfo.instAllocCount,
+                      responseInfo.serviceState, RM_SERVICE_APPROVED, 0, 0);   
 
     setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameGpQ, 
                  965, 2, 0, NULL, RM_TEST_FALSE, &responseInfo);