forked from Imagelibrary/rtems
score: Delete __RTEMS_STRICT_ORDER_MUTEX__
Remove support for strict order mutexes. Close #2124.
This commit is contained in:
@@ -272,12 +272,6 @@ RTEMS_CPUOPT([__RTEMS_DO_NOT_INLINE_CORE_MUTEX_SEIZE__],
|
||||
[1],
|
||||
[disable inlining _Thread_Enable_dispatch])
|
||||
|
||||
## This gives the same behavior as 4.8 and older
|
||||
RTEMS_CPUOPT([__RTEMS_STRICT_ORDER_MUTEX__],
|
||||
[test x"${ENABLE_STRICT_ORDER_MUTEX}" = x"1"],
|
||||
[1],
|
||||
[disable strict order mutex])
|
||||
|
||||
## Deactivate ada bindings
|
||||
RTEMS_CPUOPT([__RTEMS_ADA__],
|
||||
[test x"${enable_ada}" = x"yes"],
|
||||
|
||||
@@ -27,8 +27,5 @@ const int _POSIX_Mutex_Return_codes[CORE_MUTEX_STATUS_LAST + 1] = {
|
||||
EPERM, /* CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE */
|
||||
EINVAL, /* CORE_MUTEX_WAS_DELETED */
|
||||
ETIMEDOUT, /* CORE_MUTEX_TIMEOUT */
|
||||
#ifdef __RTEMS_STRICT_ORDER_MUTEX__
|
||||
EDEADLK, /* CORE_MUTEX_RELEASE_NOT_ORDER */
|
||||
#endif
|
||||
EINVAL /* CORE_MUTEX_STATUS_CEILING_VIOLATED */
|
||||
};
|
||||
|
||||
@@ -29,9 +29,6 @@ const rtems_status_code _Semaphore_Translate_core_mutex_return_code_[] = {
|
||||
RTEMS_NOT_OWNER_OF_RESOURCE, /* CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE */
|
||||
RTEMS_OBJECT_WAS_DELETED, /* CORE_MUTEX_WAS_DELETED */
|
||||
RTEMS_TIMEOUT, /* CORE_MUTEX_TIMEOUT */
|
||||
#if defined(__RTEMS_STRICT_ORDER_MUTEX__)
|
||||
123,
|
||||
#endif
|
||||
RTEMS_INVALID_PRIORITY /* CORE_MUTEX_STATUS_CEILING_VIOLATED */
|
||||
};
|
||||
|
||||
|
||||
@@ -121,26 +121,6 @@ typedef struct {
|
||||
Priority_Control priority_ceiling;
|
||||
} CORE_mutex_Attributes;
|
||||
|
||||
#ifdef __RTEMS_STRICT_ORDER_MUTEX__
|
||||
/**
|
||||
* @brief The control block to manage lock chain of priority inheritance mutex.
|
||||
*
|
||||
* The following defines the control block used to manage lock chain of
|
||||
* priority inheritance mutex.
|
||||
*/
|
||||
typedef struct{
|
||||
/** This field is a chian of locked mutex by a thread,new mutex will
|
||||
* be added to the head of queue, and the mutex which will be released
|
||||
* must be the head of queue.
|
||||
*/
|
||||
Chain_Node lock_queue;
|
||||
/** This field is the priority of thread before locking this mutex
|
||||
*
|
||||
*/
|
||||
Priority_Control priority_before;
|
||||
} CORE_mutex_order_list;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Control block used to manage each mutex.
|
||||
*
|
||||
@@ -170,11 +150,6 @@ typedef struct {
|
||||
* has not unlocked it. If the thread is not locked, there is no holder.
|
||||
*/
|
||||
Thread_Control *holder;
|
||||
#ifdef __RTEMS_STRICT_ORDER_MUTEX__
|
||||
/** This field is used to manipulate the priority inheritance mutex queue*/
|
||||
CORE_mutex_order_list queue;
|
||||
#endif
|
||||
|
||||
} CORE_mutex_Control;
|
||||
|
||||
/**@}*/
|
||||
|
||||
@@ -66,13 +66,6 @@ typedef enum {
|
||||
*/
|
||||
CORE_MUTEX_TIMEOUT,
|
||||
|
||||
#if defined(__RTEMS_STRICT_ORDER_MUTEX__)
|
||||
/** This status indicates that a thread not release the mutex which has
|
||||
* the priority inheritance property in a right order.
|
||||
*/
|
||||
CORE_MUTEX_RELEASE_NOT_ORDER,
|
||||
#endif
|
||||
|
||||
/** This status indicates that a thread of logically greater importance
|
||||
* than the ceiling priority attempted to lock this mutex.
|
||||
*/
|
||||
@@ -489,13 +482,6 @@ RTEMS_INLINE_ROUTINE int _CORE_mutex_Seize_interrupt_trylock_body(
|
||||
the_mutex->nest_count = 1;
|
||||
if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) ||
|
||||
_CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ){
|
||||
|
||||
#ifdef __RTEMS_STRICT_ORDER_MUTEX__
|
||||
_Chain_Prepend_unprotected( &executing->lock_mutex,
|
||||
&the_mutex->queue.lock_queue );
|
||||
the_mutex->queue.priority_before = executing->current_priority;
|
||||
#endif
|
||||
|
||||
executing->resource_count++;
|
||||
}
|
||||
|
||||
|
||||
@@ -808,12 +808,6 @@ struct _Thread_Control {
|
||||
SMP_lock_Stats Potpourri_stats;
|
||||
#endif
|
||||
|
||||
#ifdef __RTEMS_STRICT_ORDER_MUTEX__
|
||||
/** This field is the head of queue of priority inheritance mutex
|
||||
* held by the thread.
|
||||
*/
|
||||
Chain_Control lock_mutex;
|
||||
#endif
|
||||
#if defined(RTEMS_SMP)
|
||||
/**
|
||||
* @brief Resource node to build a dependency tree in case this thread owns
|
||||
|
||||
@@ -67,12 +67,6 @@ CORE_mutex_Status _CORE_mutex_Initialize(
|
||||
return CORE_MUTEX_STATUS_CEILING_VIOLATED;
|
||||
}
|
||||
|
||||
#ifdef __RTEMS_STRICT_ORDER_MUTEX__
|
||||
_Chain_Prepend_unprotected( &executing->lock_mutex,
|
||||
&the_mutex->queue.lock_queue );
|
||||
the_mutex->queue.priority_before = executing->current_priority;
|
||||
#endif
|
||||
|
||||
executing->resource_count++;
|
||||
|
||||
if ( is_priority_ceiling ) {
|
||||
|
||||
@@ -23,51 +23,6 @@
|
||||
#include <rtems/score/coremuteximpl.h>
|
||||
#include <rtems/score/thread.h>
|
||||
|
||||
#ifdef __RTEMS_STRICT_ORDER_MUTEX__
|
||||
static inline void _CORE_mutex_Push_priority(
|
||||
CORE_mutex_Control *mutex,
|
||||
Thread_Control *thread
|
||||
)
|
||||
{
|
||||
_Chain_Prepend_unprotected(
|
||||
&thread->lock_mutex,
|
||||
&mutex->queue.lock_queue
|
||||
);
|
||||
mutex->queue.priority_before = thread->current_priority;
|
||||
}
|
||||
|
||||
static inline CORE_mutex_Status _CORE_mutex_Pop_priority(
|
||||
CORE_mutex_Control *mutex,
|
||||
Thread_Control *holder
|
||||
)
|
||||
{
|
||||
/*
|
||||
* Check whether the holder release the mutex in LIFO order if not return
|
||||
* error code.
|
||||
*/
|
||||
if ( _Chain_First( &holder->lock_mutex ) != &mutex->queue.lock_queue ) {
|
||||
mutex->nest_count++;
|
||||
|
||||
return CORE_MUTEX_RELEASE_NOT_ORDER;
|
||||
}
|
||||
|
||||
/*
|
||||
* This pops the first node from the list.
|
||||
*/
|
||||
_Chain_Get_first_unprotected( &holder->lock_mutex );
|
||||
|
||||
if ( mutex->queue.priority_before != holder->current_priority )
|
||||
_Thread_Change_priority( holder, mutex->queue.priority_before, true );
|
||||
|
||||
return CORE_MUTEX_STATUS_SUCCESSFUL;
|
||||
}
|
||||
#else
|
||||
#define _CORE_mutex_Push_priority( mutex, thread ) ((void) 0)
|
||||
|
||||
#define _CORE_mutex_Pop_priority( mutex, thread ) \
|
||||
CORE_MUTEX_STATUS_SUCCESSFUL
|
||||
#endif
|
||||
|
||||
CORE_mutex_Status _CORE_mutex_Do_surrender(
|
||||
CORE_mutex_Control *the_mutex,
|
||||
#if defined(RTEMS_MULTIPROCESSING)
|
||||
@@ -142,14 +97,6 @@ CORE_mutex_Status _CORE_mutex_Do_surrender(
|
||||
*/
|
||||
if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) ||
|
||||
_CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ) {
|
||||
CORE_mutex_Status pop_status =
|
||||
_CORE_mutex_Pop_priority( the_mutex, holder );
|
||||
|
||||
if ( pop_status != CORE_MUTEX_STATUS_SUCCESSFUL ) {
|
||||
_Thread_queue_Release( &the_mutex->Wait_queue, lock_context );
|
||||
return pop_status;
|
||||
}
|
||||
|
||||
holder->resource_count--;
|
||||
}
|
||||
the_mutex->holder = NULL;
|
||||
@@ -193,12 +140,10 @@ CORE_mutex_Status _CORE_mutex_Do_surrender(
|
||||
case CORE_MUTEX_DISCIPLINES_PRIORITY:
|
||||
break;
|
||||
case CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT:
|
||||
_CORE_mutex_Push_priority( the_mutex, the_thread );
|
||||
the_thread->resource_count++;
|
||||
_Thread_queue_Boost_priority( &the_mutex->Wait_queue.Queue, the_thread );
|
||||
break;
|
||||
case CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING:
|
||||
_CORE_mutex_Push_priority( the_mutex, the_thread );
|
||||
the_thread->resource_count++;
|
||||
_Thread_Raise_priority(
|
||||
the_thread,
|
||||
|
||||
@@ -145,11 +145,6 @@ bool _Thread_Initialize(
|
||||
}
|
||||
_Thread_queue_Heads_initialize( the_thread->Wait.spare_heads );
|
||||
|
||||
#ifdef __RTEMS_STRICT_ORDER_MUTEX__
|
||||
/* Initialize the head of chain of held mutexes */
|
||||
_Chain_Initialize_empty(&the_thread->lock_mutex);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* General initialization
|
||||
*/
|
||||
|
||||
@@ -115,13 +115,6 @@ rtems_task Task0(rtems_task_argument ignored)
|
||||
directive_failed( status,"rtems_semaphore_obtain of S1");
|
||||
printf("The current priority of T0 is %d\n",Get_current_pri());
|
||||
|
||||
#ifdef __RTEMS_STRICT_ORDER_MUTEX__
|
||||
status = rtems_semaphore_release( Mutex_id[0] );
|
||||
printf("T0 - rtems_semaphore_release - S0\n");
|
||||
if(status == CORE_MUTEX_RELEASE_NOT_ORDER)
|
||||
printf("T0 releasing S0 not in order\n");
|
||||
#endif
|
||||
|
||||
status = rtems_semaphore_release(Mutex_id[1]);
|
||||
printf("T0 - rtems_semaphore_release - S1\n");
|
||||
directive_failed( status,"rtems_semaphore_release of S1\n");
|
||||
|
||||
Reference in New Issue
Block a user