[rtems commit] score: Delete __RTEMS_STRICT_ORDER_MUTEX__

Sebastian Huber sebh at rtems.org
Mon May 2 10:08:46 UTC 2016


Module:    rtems
Branch:    master
Commit:    500a8e9c62dca9f62611ecca64857dadb2bc0557
Changeset: http://git.rtems.org/rtems/commit/?id=500a8e9c62dca9f62611ecca64857dadb2bc0557

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Apr 28 06:26:01 2016 +0200

score: Delete __RTEMS_STRICT_ORDER_MUTEX__

Remove support for strict order mutexes.

Close #2124.

---

 cpukit/configure.ac                              |  6 ---
 cpukit/posix/src/mutextranslatereturncode.c      |  3 --
 cpukit/rtems/src/semtranslatereturncode.c        |  3 --
 cpukit/score/include/rtems/score/coremutex.h     | 25 -----------
 cpukit/score/include/rtems/score/coremuteximpl.h | 14 ------
 cpukit/score/include/rtems/score/thread.h        |  6 ---
 cpukit/score/src/coremutex.c                     |  6 ---
 cpukit/score/src/coremutexsurrender.c            | 55 ------------------------
 cpukit/score/src/threadinitialize.c              |  5 ---
 testsuites/sptests/sp36/strict_order_mut.c       |  7 ---
 10 files changed, 130 deletions(-)

diff --git a/cpukit/configure.ac b/cpukit/configure.ac
index 3ec966f..4b9020c 100644
--- a/cpukit/configure.ac
+++ b/cpukit/configure.ac
@@ -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"],
diff --git a/cpukit/posix/src/mutextranslatereturncode.c b/cpukit/posix/src/mutextranslatereturncode.c
index 1e031be..1cc0b5c 100644
--- a/cpukit/posix/src/mutextranslatereturncode.c
+++ b/cpukit/posix/src/mutextranslatereturncode.c
@@ -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 */
 };
diff --git a/cpukit/rtems/src/semtranslatereturncode.c b/cpukit/rtems/src/semtranslatereturncode.c
index c55e90e..9aa9420 100644
--- a/cpukit/rtems/src/semtranslatereturncode.c
+++ b/cpukit/rtems/src/semtranslatereturncode.c
@@ -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 */
 };
 
diff --git a/cpukit/score/include/rtems/score/coremutex.h b/cpukit/score/include/rtems/score/coremutex.h
index c9b30dd..41f1c4f 100644
--- a/cpukit/score/include/rtems/score/coremutex.h
+++ b/cpukit/score/include/rtems/score/coremutex.h
@@ -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;
 
 /**@}*/
diff --git a/cpukit/score/include/rtems/score/coremuteximpl.h b/cpukit/score/include/rtems/score/coremuteximpl.h
index 4b144e8..69935b5 100644
--- a/cpukit/score/include/rtems/score/coremuteximpl.h
+++ b/cpukit/score/include/rtems/score/coremuteximpl.h
@@ -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++;
     }
 
diff --git a/cpukit/score/include/rtems/score/thread.h b/cpukit/score/include/rtems/score/thread.h
index 4da4a34..8bc12d2 100644
--- a/cpukit/score/include/rtems/score/thread.h
+++ b/cpukit/score/include/rtems/score/thread.h
@@ -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
diff --git a/cpukit/score/src/coremutex.c b/cpukit/score/src/coremutex.c
index 75e0c49..8fc3a40 100644
--- a/cpukit/score/src/coremutex.c
+++ b/cpukit/score/src/coremutex.c
@@ -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 ) {
diff --git a/cpukit/score/src/coremutexsurrender.c b/cpukit/score/src/coremutexsurrender.c
index 1858f9c..cf6f096 100644
--- a/cpukit/score/src/coremutexsurrender.c
+++ b/cpukit/score/src/coremutexsurrender.c
@@ -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,
diff --git a/cpukit/score/src/threadinitialize.c b/cpukit/score/src/threadinitialize.c
index 18d29f8..c3e6469 100644
--- a/cpukit/score/src/threadinitialize.c
+++ b/cpukit/score/src/threadinitialize.c
@@ -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
    */
diff --git a/testsuites/sptests/sp36/strict_order_mut.c b/testsuites/sptests/sp36/strict_order_mut.c
index 5bc7c57..db270ca 100644
--- a/testsuites/sptests/sp36/strict_order_mut.c
+++ b/testsuites/sptests/sp36/strict_order_mut.c
@@ -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");




More information about the vc mailing list