forked from Imagelibrary/rtems
score: Improve priority node debugging
Make sure the actions of priority aggregations are not reused while in use. Update #5159.
This commit is contained in:
@@ -159,6 +159,7 @@ static inline void _Priority_Actions_add(
|
||||
* Priority aggregations are only added to action lists, so do not care about
|
||||
* the current next pointer value.
|
||||
*/
|
||||
_Assert( aggregation->Action.next == NULL );
|
||||
aggregation->Action.next = actions->actions;
|
||||
#endif
|
||||
actions->actions = aggregation;
|
||||
@@ -334,6 +335,7 @@ static inline void _Priority_Set_action_node(
|
||||
Priority_Node *node
|
||||
)
|
||||
{
|
||||
_Assert( aggregation->Action.next == NULL );
|
||||
aggregation->Action.node = node;
|
||||
}
|
||||
|
||||
@@ -348,6 +350,7 @@ static inline void _Priority_Set_action_type(
|
||||
Priority_Action_type type
|
||||
)
|
||||
{
|
||||
_Assert( aggregation->Action.next == NULL );
|
||||
aggregation->Action.type = type;
|
||||
}
|
||||
|
||||
@@ -365,6 +368,7 @@ static inline void _Priority_Set_action(
|
||||
Priority_Action_type type
|
||||
)
|
||||
{
|
||||
_Assert( aggregation->Action.next == NULL );
|
||||
aggregation->Action.node = node;
|
||||
aggregation->Action.type = type;
|
||||
}
|
||||
@@ -379,10 +383,21 @@ static inline void _Priority_Set_action(
|
||||
* is no next action.
|
||||
*/
|
||||
static inline Priority_Aggregation *_Priority_Get_next_action(
|
||||
#if defined(RTEMS_DEBUG)
|
||||
Priority_Aggregation *aggregation
|
||||
#else
|
||||
const Priority_Aggregation *aggregation
|
||||
#endif
|
||||
)
|
||||
{
|
||||
return aggregation->Action.next;
|
||||
Priority_Aggregation *next;
|
||||
|
||||
next = aggregation->Action.next;
|
||||
#if defined(RTEMS_DEBUG)
|
||||
aggregation->Action.next = NULL;
|
||||
#endif
|
||||
|
||||
return next;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -68,6 +68,16 @@ void _Thread_queue_Do_nothing_priority_actions(
|
||||
Priority_Actions *priority_actions
|
||||
)
|
||||
{
|
||||
#if defined(RTEMS_DEBUG)
|
||||
Priority_Aggregation *priority_aggregation;
|
||||
|
||||
priority_aggregation = _Priority_Actions_move( priority_actions );
|
||||
|
||||
while ( priority_aggregation != NULL ) {
|
||||
priority_aggregation = _Priority_Get_next_action( priority_aggregation );
|
||||
}
|
||||
#endif
|
||||
|
||||
(void) queue;
|
||||
_Priority_Actions_initialize_empty( priority_actions );
|
||||
}
|
||||
@@ -366,10 +376,17 @@ static void _Thread_queue_Priority_priority_actions(
|
||||
priority_aggregation = _Priority_Actions_move( priority_actions );
|
||||
|
||||
do {
|
||||
#if defined(RTEMS_SMP)
|
||||
Priority_Aggregation *next_aggregation;
|
||||
#endif
|
||||
Scheduler_Node *scheduler_node;
|
||||
Thread_queue_Priority_queue *priority_queue;
|
||||
Priority_Action_type priority_action_type;
|
||||
|
||||
#if defined(RTEMS_SMP)
|
||||
next_aggregation = _Priority_Get_next_action( priority_aggregation );
|
||||
#endif
|
||||
|
||||
scheduler_node = SCHEDULER_NODE_OF_WAIT_PRIORITY( priority_aggregation );
|
||||
priority_queue = _Thread_queue_Priority_queue( heads, scheduler_node );
|
||||
priority_action_type = priority_aggregation->Action.type;
|
||||
@@ -408,7 +425,7 @@ static void _Thread_queue_Priority_priority_actions(
|
||||
}
|
||||
|
||||
#if defined(RTEMS_SMP)
|
||||
priority_aggregation = _Priority_Get_next_action( priority_aggregation );
|
||||
priority_aggregation = next_aggregation;
|
||||
} while ( priority_aggregation != NULL );
|
||||
#else
|
||||
} while ( false );
|
||||
@@ -1366,6 +1383,9 @@ static void _Thread_queue_Priority_inherit_do_surrender(
|
||||
* _Thread_Priority_perform_actions().
|
||||
*/
|
||||
_Thread_queue_Context_add_priority_update( queue_context, previous_owner );
|
||||
#if defined(RTEMS_DEBUG)
|
||||
_Thread_queue_Do_nothing_priority_actions( queue, &queue_context->Priority.Actions );
|
||||
#endif
|
||||
}
|
||||
|
||||
_Thread_Wait_release_default_critical( previous_owner, &lock_context );
|
||||
|
||||
Reference in New Issue
Block a user