[rtems commit] rtems: Require RTEMS_PRIORITY for MrsP semaphores

Sebastian Huber sebh at rtems.org
Wed Mar 17 09:46:58 UTC 2021


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Mar 12 14:16:30 2021 +0100

rtems: Require RTEMS_PRIORITY for MrsP semaphores

MrsP semaphores are a generalization of the priority ceiling semaphores
for SMP configurations.  Priority ceiling semaphores are required to use
the priority task wait queue discipline.  Require this discipline also
for MrsP semaphores.

Close #4347.

---

 cpukit/include/rtems/rtems/sem.h          |  3 ++-
 cpukit/rtems/src/semcreate.c              |  4 ++--
 testsuites/smptests/smpfatal03/init.c     |  4 ++--
 testsuites/smptests/smpmrsp01/init.c      |  8 ++++----
 testsuites/smptests/smpscheduler02/init.c |  3 ++-
 testsuites/sptests/spmrsp01/init.c        | 23 ++++++++++++++---------
 testsuites/tmtests/tmfine01/init.c        |  3 ++-
 7 files changed, 28 insertions(+), 20 deletions(-)

diff --git a/cpukit/include/rtems/rtems/sem.h b/cpukit/include/rtems/rtems/sem.h
index 74d0ab4..1f0c952 100644
--- a/cpukit/include/rtems/rtems/sem.h
+++ b/cpukit/include/rtems/rtems/sem.h
@@ -803,7 +803,8 @@ rtems_status_code rtems_semaphore_flush( rtems_id id );
  *   sc = rtems_semaphore_create(
  *     rtems_build_name( 'M', 'R', 'S', 'P' ),
  *     1,
- *     RTEMS_BINARY_SEMAPHORE | RTEMS_MULTIPROCESSOR_RESOURCE_SHARING,
+ *     RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY |
+ *       RTEMS_MULTIPROCESSOR_RESOURCE_SHARING,
  *     1,
  *     &semaphore_id
  *   );
diff --git a/cpukit/rtems/src/semcreate.c b/cpukit/rtems/src/semcreate.c
index 3647bb7..0246c91 100644
--- a/cpukit/rtems/src/semcreate.c
+++ b/cpukit/rtems/src/semcreate.c
@@ -93,8 +93,8 @@ rtems_status_code rtems_semaphore_create(
   ) {
     variant = SEMAPHORE_VARIANT_MUTEX_PRIORITY_CEILING;
   } else if (
-    mutex_with_protocol
-      == ( RTEMS_BINARY_SEMAPHORE | RTEMS_MULTIPROCESSOR_RESOURCE_SHARING )
+    mutex_with_protocol == ( RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY |
+      RTEMS_MULTIPROCESSOR_RESOURCE_SHARING )
   ) {
 #if defined(RTEMS_SMP)
     variant = SEMAPHORE_VARIANT_MRSP;
diff --git a/testsuites/smptests/smpfatal03/init.c b/testsuites/smptests/smpfatal03/init.c
index c40194a..7eb681b 100644
--- a/testsuites/smptests/smpfatal03/init.c
+++ b/testsuites/smptests/smpfatal03/init.c
@@ -41,8 +41,8 @@ static void Init( rtems_task_argument arg )
   sc = rtems_semaphore_create(
     rtems_build_name('M', 'R', 'S', 'P'),
     1,
-    RTEMS_MULTIPROCESSOR_RESOURCE_SHARING
-      | RTEMS_BINARY_SEMAPHORE,
+    RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY |
+      RTEMS_MULTIPROCESSOR_RESOURCE_SHARING,
     1,
     &sem_id
   );
diff --git a/testsuites/smptests/smpmrsp01/init.c b/testsuites/smptests/smpmrsp01/init.c
index 1153576..76bb928 100644
--- a/testsuites/smptests/smpmrsp01/init.c
+++ b/testsuites/smptests/smpmrsp01/init.c
@@ -257,8 +257,8 @@ static void create_mrsp_sema(
   sc = rtems_semaphore_create(
     rtems_build_name('M', 'R', 'S', 'P'),
     1,
-    RTEMS_MULTIPROCESSOR_RESOURCE_SHARING
-      | RTEMS_BINARY_SEMAPHORE,
+    RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY |
+      RTEMS_MULTIPROCESSOR_RESOURCE_SHARING,
     prio,
     id
   );
@@ -744,8 +744,8 @@ static void test_mrsp_initially_locked_error(void)
   sc = rtems_semaphore_create(
     rtems_build_name('M', 'R', 'S', 'P'),
     0,
-    RTEMS_MULTIPROCESSOR_RESOURCE_SHARING
-      | RTEMS_BINARY_SEMAPHORE,
+    RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY |
+      RTEMS_MULTIPROCESSOR_RESOURCE_SHARING,
     1,
     &id
   );
diff --git a/testsuites/smptests/smpscheduler02/init.c b/testsuites/smptests/smpscheduler02/init.c
index 9297efe..b337fc6 100644
--- a/testsuites/smptests/smpscheduler02/init.c
+++ b/testsuites/smptests/smpscheduler02/init.c
@@ -82,7 +82,8 @@ static void sticky_task(rtems_task_argument arg)
   sc = rtems_semaphore_create(
     rtems_build_name(' ', 'M', 'T', 'X'),
     1,
-    RTEMS_BINARY_SEMAPHORE | RTEMS_MULTIPROCESSOR_RESOURCE_SHARING,
+    RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY |
+      RTEMS_MULTIPROCESSOR_RESOURCE_SHARING,
     2,
     &mtx_id
   );
diff --git a/testsuites/sptests/spmrsp01/init.c b/testsuites/sptests/spmrsp01/init.c
index a5f645d..ca35d90 100644
--- a/testsuites/sptests/spmrsp01/init.c
+++ b/testsuites/sptests/spmrsp01/init.c
@@ -53,8 +53,8 @@ static void test_mrsp_create_errors(void)
   sc = rtems_semaphore_create(
     rtems_build_name('M', 'R', 'S', 'P'),
     1,
-    RTEMS_MULTIPROCESSOR_RESOURCE_SHARING
-      | RTEMS_BINARY_SEMAPHORE,
+    RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY
+      | RTEMS_MULTIPROCESSOR_RESOURCE_SHARING,
     UINT32_MAX,
     &id
   );
@@ -63,29 +63,33 @@ static void test_mrsp_create_errors(void)
   create_not_defined(
     RTEMS_MULTIPROCESSOR_RESOURCE_SHARING
       | RTEMS_COUNTING_SEMAPHORE
+      | RTEMS_PRIORITY
   );
 
   create_not_defined(
     RTEMS_MULTIPROCESSOR_RESOURCE_SHARING
       | RTEMS_SIMPLE_BINARY_SEMAPHORE
+      | RTEMS_PRIORITY
   );
 
   create_not_defined(
     RTEMS_MULTIPROCESSOR_RESOURCE_SHARING
       | RTEMS_BINARY_SEMAPHORE
-      | RTEMS_PRIORITY
+      | RTEMS_FIFO
   );
 
   create_not_defined(
     RTEMS_MULTIPROCESSOR_RESOURCE_SHARING
       | RTEMS_INHERIT_PRIORITY
       | RTEMS_BINARY_SEMAPHORE
+      | RTEMS_PRIORITY
   );
 
   create_not_defined(
     RTEMS_MULTIPROCESSOR_RESOURCE_SHARING
       | RTEMS_PRIORITY_CEILING
       | RTEMS_BINARY_SEMAPHORE
+      | RTEMS_PRIORITY
   );
 
   create_not_defined(
@@ -93,6 +97,7 @@ static void test_mrsp_create_errors(void)
       | RTEMS_INHERIT_PRIORITY
       | RTEMS_PRIORITY_CEILING
       | RTEMS_BINARY_SEMAPHORE
+      | RTEMS_PRIORITY
   );
 }
 
@@ -116,8 +121,8 @@ static void test_mrsp_obtain_release(void)
   sc = rtems_semaphore_create(
     rtems_build_name('M', 'R', 'S', 'P'),
     1,
-    RTEMS_MULTIPROCESSOR_RESOURCE_SHARING
-      | RTEMS_BINARY_SEMAPHORE,
+    RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY |
+      RTEMS_MULTIPROCESSOR_RESOURCE_SHARING,
     1,
     &id
   );
@@ -202,8 +207,8 @@ static void test_mrsp_set_priority(void)
   sc = rtems_semaphore_create(
     rtems_build_name('M', 'R', 'S', 'P'),
     1,
-    RTEMS_MULTIPROCESSOR_RESOURCE_SHARING
-      | RTEMS_BINARY_SEMAPHORE,
+    RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY |
+      RTEMS_MULTIPROCESSOR_RESOURCE_SHARING,
     1,
     &id
   );
@@ -266,8 +271,8 @@ static void test_mrsp_timeout_and_not_owner_of_resource(void)
   sc = rtems_semaphore_create(
     rtems_build_name('M', 'R', 'S', 'P'),
     1,
-    RTEMS_MULTIPROCESSOR_RESOURCE_SHARING
-      | RTEMS_BINARY_SEMAPHORE,
+    RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY |
+      RTEMS_MULTIPROCESSOR_RESOURCE_SHARING,
     1,
     &id
   );
diff --git a/testsuites/tmtests/tmfine01/init.c b/testsuites/tmtests/tmfine01/init.c
index d62278c..e2daa17 100644
--- a/testsuites/tmtests/tmfine01/init.c
+++ b/testsuites/tmtests/tmfine01/init.c
@@ -501,7 +501,8 @@ static void test_many_classic_mrsp_body(
   sc = rtems_semaphore_create(
     rtems_build_name('T', 'E', 'S', 'T'),
     1,
-    RTEMS_BINARY_SEMAPHORE | RTEMS_MULTIPROCESSOR_RESOURCE_SHARING,
+    RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY |
+      RTEMS_MULTIPROCESSOR_RESOURCE_SHARING,
     1,
     &id
   );



More information about the vc mailing list