From 308238e322dfdbe319c06fb4f961fad5ae25cea6 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 29 Sep 2021 14:06:42 +0200 Subject: testsuites/validation/tr-mtx-seize-wait.c --- testsuites/validation/tr-mtx-seize-wait.c | 113 ++++++++++++++++++------------ 1 file changed, 67 insertions(+), 46 deletions(-) diff --git a/testsuites/validation/tr-mtx-seize-wait.c b/testsuites/validation/tr-mtx-seize-wait.c index 33f6f0f963..769956d2c7 100644 --- a/testsuites/validation/tr-mtx-seize-wait.c +++ b/testsuites/validation/tr-mtx-seize-wait.c @@ -168,9 +168,10 @@ static ScoreMtxReqSeizeWait_Context ScoreMtxReqSeizeWait_Instance; static const char * const ScoreMtxReqSeizeWait_PreDesc_Protocol[] = { + "None", + "Inherit", "Ceiling", "MrsP", - "Other", "NA" }; @@ -403,38 +404,41 @@ static void ScoreMtxReqSeizeWait_Pre_Protocol_Prepare( ) { switch ( state ) { - case ScoreMtxReqSeizeWait_Pre_Protocol_Ceiling: { + case ScoreMtxReqSeizeWait_Pre_Protocol_None: { /* - * Where the mutex uses the priority ceiling locking protocol. + * Where the mutex does not use a locking protocol. */ - if ( - ctx->tq_ctx->priority_ceiling == PRIO_INVALID || - ctx->tq_ctx->base.enqueue_variant == TQ_ENQUEUE_STICKY - ) { + if ( ctx->tq_ctx->protocol != TQ_MTX_NO_PROTOCOL ) { ctx->Map.skip = true; } break; } - case ScoreMtxReqSeizeWait_Pre_Protocol_MrsP: { + case ScoreMtxReqSeizeWait_Pre_Protocol_Inherit: { /* - * Where the mutex uses the MrsP locking protocol. + * Where the mutex uses the priority inheritance locking protocol. */ - if ( - ctx->tq_ctx->priority_ceiling == PRIO_INVALID || - ctx->tq_ctx->base.enqueue_variant != TQ_ENQUEUE_STICKY - ) { + if ( ctx->tq_ctx->protocol != TQ_MTX_PRIORITY_INHERIT ) { ctx->Map.skip = true; } break; } - case ScoreMtxReqSeizeWait_Pre_Protocol_Other: { + case ScoreMtxReqSeizeWait_Pre_Protocol_Ceiling: { /* - * Where the mutex does not use the priority ceiling or MrsP locking - * protocol. + * Where the mutex uses the priority ceiling locking protocol. */ - if ( ctx->tq_ctx->priority_ceiling != PRIO_INVALID ) { + if ( ctx->tq_ctx->protocol != TQ_MTX_PRIORITY_CEILING ) { + ctx->Map.skip = true; + } + break; + } + + case ScoreMtxReqSeizeWait_Pre_Protocol_MrsP: { + /* + * Where the mutex uses the MrsP locking protocol. + */ + if ( ctx->tq_ctx->protocol != TQ_MTX_MRSP ) { ctx->Map.skip = true; } break; @@ -701,6 +705,15 @@ static void ScoreMtxReqSeizeWait_Post_Enqueued_Check( break; } + case ScoreMtxReqSeizeWait_Post_Enqueued_PriorityInherit: { + /* + * The calling thread shall be enqueued in priority order with priorit + * inheritance. + */ + ScoreTqReqEnqueuePriority_Run( &ctx->tq_ctx->base ); + break; + } + case ScoreMtxReqSeizeWait_Post_Enqueued_PriorityCeiling: { /* * The calling thread shall be enqueued in priority order according to @@ -825,28 +838,32 @@ ScoreMtxReqSeizeWait_Entries[] = { ScoreMtxReqSeizeWait_Post_Enqueued_No, ScoreMtxReqSeizeWait_Post_Owner_Caller, ScoreMtxReqSeizeWait_Post_Priority_Nop }, + { 0, 0, 0, 0, 0, 0, 1, ScoreMtxReqSeizeWait_Post_Status_DeadlockStatus, + ScoreMtxReqSeizeWait_Post_Enqueued_No, + ScoreMtxReqSeizeWait_Post_Owner_Other, + ScoreMtxReqSeizeWait_Post_Priority_Nop }, + { 0, 0, 0, 0, 0, 0, 1, ScoreMtxReqSeizeWait_Post_Status_DeadlockFatal, + ScoreMtxReqSeizeWait_Post_Enqueued_No, + ScoreMtxReqSeizeWait_Post_Owner_Other, + ScoreMtxReqSeizeWait_Post_Priority_Nop }, { 0, 0, 0, 0, 0, 0, 0, ScoreMtxReqSeizeWait_Post_Status_Ok, ScoreMtxReqSeizeWait_Post_Enqueued_No, ScoreMtxReqSeizeWait_Post_Owner_Caller, ScoreMtxReqSeizeWait_Post_Priority_Ceiling }, - { 0, 0, 0, 0, 0, 0, 0, ScoreMtxReqSeizeWait_Post_Status_NA, - ScoreMtxReqSeizeWait_Post_Enqueued_PriorityCeiling, - ScoreMtxReqSeizeWait_Post_Owner_Other, - ScoreMtxReqSeizeWait_Post_Priority_Nop }, { 0, 0, 0, 0, 0, 0, 1, ScoreMtxReqSeizeWait_Post_Status_NA, ScoreMtxReqSeizeWait_Post_Enqueued_FIFO, ScoreMtxReqSeizeWait_Post_Owner_Other, ScoreMtxReqSeizeWait_Post_Priority_Nop }, - { 0, 0, 0, 0, 0, 0, 1, ScoreMtxReqSeizeWait_Post_Status_DeadlockStatus, - ScoreMtxReqSeizeWait_Post_Enqueued_No, + { 0, 0, 0, 0, 0, 0, 1, ScoreMtxReqSeizeWait_Post_Status_NA, + ScoreMtxReqSeizeWait_Post_Enqueued_Priority, ScoreMtxReqSeizeWait_Post_Owner_Other, ScoreMtxReqSeizeWait_Post_Priority_Nop }, - { 0, 0, 0, 0, 0, 0, 1, ScoreMtxReqSeizeWait_Post_Status_DeadlockFatal, - ScoreMtxReqSeizeWait_Post_Enqueued_No, + { 0, 0, 0, 0, 0, 0, 1, ScoreMtxReqSeizeWait_Post_Status_NA, + ScoreMtxReqSeizeWait_Post_Enqueued_PriorityInherit, ScoreMtxReqSeizeWait_Post_Owner_Other, ScoreMtxReqSeizeWait_Post_Priority_Nop }, - { 0, 0, 0, 0, 0, 0, 1, ScoreMtxReqSeizeWait_Post_Status_NA, - ScoreMtxReqSeizeWait_Post_Enqueued_Priority, + { 0, 0, 0, 0, 0, 0, 0, ScoreMtxReqSeizeWait_Post_Status_NA, + ScoreMtxReqSeizeWait_Post_Enqueued_PriorityCeiling, ScoreMtxReqSeizeWait_Post_Owner_Other, ScoreMtxReqSeizeWait_Post_Priority_Nop }, { 0, 0, 0, 0, 0, 0, 0, ScoreMtxReqSeizeWait_Post_Status_DeadlockStatus, @@ -857,6 +874,14 @@ ScoreMtxReqSeizeWait_Entries[] = { ScoreMtxReqSeizeWait_Post_Enqueued_No, ScoreMtxReqSeizeWait_Post_Owner_Other, ScoreMtxReqSeizeWait_Post_Priority_Nop }, + { 0, 0, 0, 0, 0, 0, 1, ScoreMtxReqSeizeWait_Post_Status_DeadlockStatus, + ScoreMtxReqSeizeWait_Post_Enqueued_No, + ScoreMtxReqSeizeWait_Post_Owner_Caller, + ScoreMtxReqSeizeWait_Post_Priority_Nop }, + { 0, 0, 0, 0, 0, 0, 1, ScoreMtxReqSeizeWait_Post_Status_DeadlockFatal, + ScoreMtxReqSeizeWait_Post_Enqueued_No, + ScoreMtxReqSeizeWait_Post_Owner_Caller, + ScoreMtxReqSeizeWait_Post_Priority_Nop }, { 0, 0, 0, 0, 0, 0, 0, ScoreMtxReqSeizeWait_Post_Status_MutexCeilingViolated, ScoreMtxReqSeizeWait_Post_Enqueued_No, ScoreMtxReqSeizeWait_Post_Owner_None, @@ -876,14 +901,6 @@ ScoreMtxReqSeizeWait_Entries[] = { ScoreMtxReqSeizeWait_Post_Enqueued_PriorityMrsP, ScoreMtxReqSeizeWait_Post_Owner_Other, ScoreMtxReqSeizeWait_Post_Priority_Ceiling }, - { 0, 0, 0, 0, 0, 0, 1, ScoreMtxReqSeizeWait_Post_Status_DeadlockStatus, - ScoreMtxReqSeizeWait_Post_Enqueued_No, - ScoreMtxReqSeizeWait_Post_Owner_Caller, - ScoreMtxReqSeizeWait_Post_Priority_Nop }, - { 0, 0, 0, 0, 0, 0, 1, ScoreMtxReqSeizeWait_Post_Status_DeadlockFatal, - ScoreMtxReqSeizeWait_Post_Enqueued_No, - ScoreMtxReqSeizeWait_Post_Owner_Caller, - ScoreMtxReqSeizeWait_Post_Priority_Nop }, { 0, 0, 0, 0, 0, 0, 0, ScoreMtxReqSeizeWait_Post_Status_DeadlockStatus, ScoreMtxReqSeizeWait_Post_Enqueued_No, ScoreMtxReqSeizeWait_Post_Owner_Caller, @@ -896,18 +913,22 @@ ScoreMtxReqSeizeWait_Entries[] = { static const uint8_t ScoreMtxReqS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 9, 9, 13, 4, 4, 14, 14, 15, 8, 8, 8, 10, + 10, 10, 13, 4, 4, 19, 19, 15, 8, 8, 8, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 2, 2, 11, - 11, 12, 13, 14, 14, 13, 8, 8, 10, 2, 2, 17, 17, 12, 13, 14, 14, 13, 8, 8, 10, - 2, 2, 11, 11, 12, 13, 14, 14, 13, 9, 9, 10, 2, 2, 18, 18, 12, 13, 14, 14, 13, - 9, 9, 1, 1, 1, 1, 1, 1, 4, 4, 4, 5, 5, 5, 1, 1, 1, 15, 15, 15, 4, 4, 4, 5, 5, - 5, 1, 1, 1, 1, 1, 1, 4, 4, 4, 6, 6, 6, 1, 1, 1, 16, 16, 16, 4, 4, 4, 6, 6, 6, - 1, 1, 1, 1, 1, 1, 7, 7, 7, 5, 5, 5, 1, 1, 1, 15, 15, 15, 7, 7, 7, 5, 5, 5, 1, - 1, 1, 1, 1, 1, 7, 7, 7, 6, 6, 6, 1, 1, 1, 16, 16, 16, 7, 7, 7, 6, 6, 6 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 4, 4, 14, 14, 15, 16, 17, 17, 16, + 9, 9, 13, 4, 4, 18, 18, 15, 16, 17, 17, 16, 9, 9, 13, 4, 4, 14, 14, 15, 16, + 17, 17, 16, 10, 10, 13, 4, 4, 19, 19, 15, 16, 17, 17, 16, 10, 10 }; static size_t ScoreMtxReqSeizeWait_Scope( void *arg, char *buf, size_t n ) @@ -1067,7 +1088,7 @@ void ScoreMtxReqSeizeWait_Run( TQMtxContext *tq_ctx ) ctx->Map.skip = false; for ( - ctx->Map.pci[ 0 ] = ScoreMtxReqSeizeWait_Pre_Protocol_Ceiling; + ctx->Map.pci[ 0 ] = ScoreMtxReqSeizeWait_Pre_Protocol_None; ctx->Map.pci[ 0 ] < ScoreMtxReqSeizeWait_Pre_Protocol_NA; ++ctx->Map.pci[ 0 ] ) { -- cgit v1.2.3