From 14c7659435cff75afabf17bfed90912294d29b44 Mon Sep 17 00:00:00 2001 From: Justin Sobota Date: Tue, 28 May 2013 16:56:48 -0400 Subject: [PATCH] Resolved SDOCM00101586. Added test cases to cover resolved issued --- include/rm_internal.h | 5 +- src/rm_allocator.c | 14 +++-- src/rm_policy.c | 2 +- test/dts_files/server-policy.c | 90 +++++++++++++++---------------- test/dts_files/server-policy.dtb | Bin 2772 -> 2812 bytes test/dts_files/server-policy.dts | 5 +- test/src/rm_test.c | 35 +++++++++++- 7 files changed, 97 insertions(+), 54 deletions(-) diff --git a/include/rm_internal.h b/include/rm_internal.h index 44ec8c4..40a56e0 100644 --- a/include/rm_internal.h +++ b/include/rm_internal.h @@ -51,8 +51,9 @@ extern "C" { #include /* RM true/false definitions */ -#define RM_FALSE 0 -#define RM_TRUE 1 +#define RM_BOOL_UNDEF (-1) +#define RM_FALSE 0 +#define RM_TRUE 1 /* RM cache alignment */ #define RM_MAX_CACHE_ALIGN 128 diff --git a/src/rm_allocator.c b/src/rm_allocator.c index 241df5d..50beaa5 100644 --- a/src/rm_allocator.c +++ b/src/rm_allocator.c @@ -503,11 +503,11 @@ static int32_t allocatorPreAllocate(Rm_Handle rmHandle, Rm_Allocator *allocator, if (matchingNode) { matchingEnd = matchingNode->base + matchingNode->length - 1; findEnd = findNode.base + findNode.length - 1; + nodePassesPolicy = RM_BOOL_UNDEF; if ((matchingNode->allocationCount == 0) && (findNode.base >= matchingNode->base) && (findEnd <= matchingEnd)) { /* Attempt to preallocate from node only if not owned by anyone and sits * within a matching node. */ - nodePassesPolicy = RM_FALSE; policyCheckCfg.type = policyCheckType; policyCheckCfg.validInstNode = opInfo->serviceSrcInstNode; policyCheckCfg.resourceBase = findNode.base; @@ -567,11 +567,17 @@ static int32_t allocatorPreAllocate(Rm_Handle rmHandle, Rm_Allocator *allocator, findNode.base = matchingNode->base; } else { - if (nextNode = RB_NEXT(_Rm_AllocatorResourceTree, allocator->allocatorRootEntry, matchingNode)) { - findNode.base = nextNode->base; + if (!nodePassesPolicy) { + findNode.base += findNode.length; } else { - retVal = RM_SERVICE_DENIED_RES_ALLOC_REQS_NOT_MET; + /* Matching node allocated, move to next node */ + if (nextNode = RB_NEXT(_Rm_AllocatorResourceTree, allocator->allocatorRootEntry, matchingNode)) { + findNode.base = nextNode->base; + } + else { + retVal = RM_SERVICE_DENIED_RES_ALLOC_REQS_NOT_MET; + } } } } diff --git a/src/rm_policy.c b/src/rm_policy.c index d83b4bc..ca62fce 100644 --- a/src/rm_policy.c +++ b/src/rm_policy.c @@ -676,7 +676,7 @@ uint32_t rmPolicyGetResourceBase(void *policyDtb, Rm_PolicyValidInstNode *validI Rm_PolicyAssignment *assignmentStart = NULL; Rm_PolicyPermission *permission = NULL; Rm_PolicyPermission *permissionStart = NULL; - int32_t resourceBase = 0; + int32_t resourceBase = RM_RESOURCE_BASE_UNSPECIFIED; *result = RM_OK; diff --git a/test/dts_files/server-policy.c b/test/dts_files/server-policy.c index 0903cb6..304c435 100644 --- a/test/dts_files/server-policy.c +++ b/test/dts_files/server-policy.c @@ -8,7 +8,7 @@ const char rmGlobalPolicy[] = { 0x00, 0x00, 0x0a, -0xd4, +0xfc, 0x00, 0x00, 0x00, @@ -16,7 +16,7 @@ const char rmGlobalPolicy[] = { 0x00, 0x00, 0x0a, -0x90, +0xb8, 0x00, 0x00, 0x00, @@ -40,7 +40,7 @@ const char rmGlobalPolicy[] = { 0x00, 0x00, 0x0a, -0x58, +0x80, 0x00, 0x00, 0x00, @@ -700,7 +700,7 @@ const char rmGlobalPolicy[] = { 0x00, 0x00, 0x00, -0x12, +0x3c, 0x00, 0x00, 0x00, @@ -712,7 +712,19 @@ const char rmGlobalPolicy[] = { 0x00, 0x00, 0x00, -0x09, +0x01, +0x28, +0x2a, +0x29, +0x00, +0x00, +0x00, +0x02, +0x81, +0x00, +0x00, +0x00, +0x01, 0x69, 0x75, 0x78, @@ -725,6 +737,34 @@ const char rmGlobalPolicy[] = { 0x00, 0x00, 0x00, +0x02, +0x82, +0x00, +0x00, +0x00, +0x01, +0x28, +0x2a, +0x29, +0x00, +0x00, +0x00, +0x02, +0x83, +0x00, +0x00, +0x00, +0x06, +0x69, +0x75, +0x78, +0x20, +0x3d, +0x20, +0x28, +0x2a, +0x29, +0x00, 0x00, 0x00, 0x00, @@ -2777,44 +2817,4 @@ const char rmGlobalPolicy[] = { 0x00, 0x00, 0x00, -0x00, -0x00, -0x00, -0x00, -0x00, -0x00, -0x00, -0x00, -0x00, -0x00, -0x00, -0x00, -0x00, -0x00, -0x00, -0x00, -0x00, -0x00, -0x00, -0x00, -0x00, -0x00, -0x00, -0x00, -0x00, -0x00, -0x00, -0x00, -0x00, -0x00, -0x00, -0x00, -0x00, -0x00, -0x00, -0x00, -0x00, -0x00, -0x00, -0x00, }; diff --git a/test/dts_files/server-policy.dtb b/test/dts_files/server-policy.dtb index 8d1b7cd53e79271b5555f75623f2dd5afcc76bf9..1e4c4d26daed0608914578447f6638b3bb250fe6 100644 GIT binary patch delta 100 zcmca2`bSjY0`I@K3=CX<7#J8Vfb@=u0^*Df8#N{~IoJS&1Q-~Y8h|vThL$FfVrm4j aGfOKJY!#p)O-QoMKsFm(cJpN>Mh*a5WD`ID delta 49 zcmew(dPP*=0`I@K3=CXX7#J8Vfb@ik0^*Dj8#N{~aS8#21Q-~Y8YX|>kl4(^{DU0; DX95ii diff --git a/test/dts_files/server-policy.dts b/test/dts_files/server-policy.dts index 78592d9..e6faf97 100644 --- a/test/dts_files/server-policy.dts +++ b/test/dts_files/server-policy.dts @@ -48,7 +48,10 @@ <526 114>, "iux = (*)"; }; pass-queue { - assignments = <640 9>, "iux = (*)"; + assignments = <640 1>, "(*)", + <641 1>, "iux = (*)", + <642 1>, "(*)", + <643 6>, "iux = (*)"; }; intc-queue { assignments = <662 10>, "iux = (*)"; diff --git a/test/src/rm_test.c b/test/src/rm_test.c index e1b8786..a24954e 100644 --- a/test/src/rm_test.c +++ b/test/src/rm_test.c @@ -358,6 +358,7 @@ char resourceNameQosCluster[RM_NAME_MAX_CHARS] = "qos-cluster"; char resourceNameAifRxCh[RM_NAME_MAX_CHARS] = "aif-rx-ch"; char resourceNameInfraQ[RM_NAME_MAX_CHARS] = "infra-queue"; char resourceNameLowPrioQ[RM_NAME_MAX_CHARS] = "low-prio-queue"; +char resourceNamePassQ[RM_NAME_MAX_CHARS] = "pass-queue"; /* Test RM NameServer name */ char nameServerNameFavQ[RM_NAME_MAX_CHARS] = "My_Favorite_Queue"; @@ -662,7 +663,39 @@ void rmServerTsk(UArg arg0, UArg arg1) POSITIVE_PASS_CHECK("---------- Use Allocation w/ UNSPECIFIED Base -----------", coreNum, rmServerName, resourceNameGpQ, RM_RESOURCE_BASE_UNSPECIFIED, requestInfo.resourceLength, - requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED); + requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED); + + setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNamePassQ, + RM_RESOURCE_BASE_UNSPECIFIED, 1, 0, NULL, RM_TEST_TRUE, &responseInfo); + rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo); + POSITIVE_PASS_CHECK("- UNSPECIFIED Allocation Avoiding Policy Denial (Part 1)-", + coreNum, rmServerName, resourceNameGpQ, + RM_RESOURCE_BASE_UNSPECIFIED, requestInfo.resourceLength, + requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED); + + setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNamePassQ, + RM_RESOURCE_BASE_UNSPECIFIED, 1, 0, NULL, RM_TEST_TRUE, &responseInfo); + rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo); + POSITIVE_PASS_CHECK("- UNSPECIFIED Allocation Avoiding Policy Denial (Part 2)-", + coreNum, rmServerName, resourceNameGpQ, + RM_RESOURCE_BASE_UNSPECIFIED, requestInfo.resourceLength, + requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED); + + setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNamePassQ, + RM_RESOURCE_BASE_UNSPECIFIED, 1, 0, NULL, RM_TEST_TRUE, &responseInfo); + rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo); + POSITIVE_PASS_CHECK("- UNSPECIFIED Allocation Avoiding Policy Denial (Part 3)-", + coreNum, rmServerName, resourceNameGpQ, + RM_RESOURCE_BASE_UNSPECIFIED, requestInfo.resourceLength, + requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED); + + setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNamePassQ, + RM_RESOURCE_BASE_UNSPECIFIED, 1, 0, NULL, RM_TEST_TRUE, &responseInfo); + rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo); + POSITIVE_PASS_CHECK("- UNSPECIFIED Allocation Avoiding Policy Denial (Part 4)-", + coreNum, rmServerName, resourceNameGpQ, + RM_RESOURCE_BASE_UNSPECIFIED, requestInfo.resourceLength, + requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED); /* END testing UNSPECIFIED base and alignment requests on Server */ /* Create new NameServer object */ -- 2.39.2