[PATCH 4/5] config: Statically allocate MP object controls

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Dec 12 08:43:06 UTC 2019


Update #3735.
---
 cpukit/include/rtems/confdefs.h         | 20 ++++----------------
 cpukit/include/rtems/score/objectdata.h |  7 +++++++
 cpukit/score/src/mpcidefault.c          |  3 +++
 cpukit/score/src/objectmp.c             |  7 ++-----
 4 files changed, 16 insertions(+), 21 deletions(-)

diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h
index 20ffd6e7ba..095c506c35 100644
--- a/cpukit/include/rtems/confdefs.h
+++ b/cpukit/include/rtems/confdefs.h
@@ -1834,10 +1834,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
     #ifndef CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS
       #define CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS     32
     #endif
-    #define _CONFIGURE_MEMORY_FOR_GLOBAL_OBJECTS(_global_objects) \
-      _Configure_From_workspace( \
-        (_global_objects) * sizeof(Objects_MP_Control) \
-      )
 
     #ifndef CONFIGURE_MP_MAXIMUM_PROXIES
       #define CONFIGURE_MP_MAXIMUM_PROXIES            32
@@ -1857,6 +1853,10 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
         #error "CONFIGURE_MP_NODE_NUMBER must be less than or equal to CONFIGURE_MP_MAXIMUM_NODES"
       #endif
 
+      Objects_MP_Control _Objects_MP_Controls[
+        CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS
+      ];
+
       struct Thread_Configured_proxy_control {
         Thread_Proxy_control Control;
         Thread_queue_Configured_heads Heads;
@@ -2411,17 +2411,6 @@ struct _reent *__getreent(void)
   (_Configure_Max_Objects(_number_FP_tasks) \
     * _Configure_From_workspace(CONTEXT_FP_SIZE))
 
-/*
- * This defines the amount of memory configured for the multiprocessing
- * support required by this application.
- */
-#ifdef CONFIGURE_MP_APPLICATION
-  #define _CONFIGURE_MEMORY_FOR_MP \
-     _CONFIGURE_MEMORY_FOR_GLOBAL_OBJECTS(CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS)
-#else
-  #define _CONFIGURE_MEMORY_FOR_MP  0
-#endif
-
 /**
  * The following macro is used to calculate the memory allocated by RTEMS
  * for the message buffers associated with a particular message queue.
@@ -2500,7 +2489,6 @@ struct _reent *__getreent(void)
    _CONFIGURE_MEMORY_FOR_POSIX_SHMS( \
      CONFIGURE_MAXIMUM_POSIX_SHMS) + \
    _CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS + \
-   _CONFIGURE_MEMORY_FOR_MP + \
    CONFIGURE_MESSAGE_BUFFER_MEMORY + \
    (CONFIGURE_MEMORY_OVERHEAD * 1024) + \
    _CONFIGURE_HEAP_HANDLER_OVERHEAD \
diff --git a/cpukit/include/rtems/score/objectdata.h b/cpukit/include/rtems/score/objectdata.h
index a33f9d497f..e44fb52d68 100644
--- a/cpukit/include/rtems/score/objectdata.h
+++ b/cpukit/include/rtems/score/objectdata.h
@@ -144,6 +144,13 @@ typedef struct {
   uint32_t name;
 } Objects_MP_Control;
 
+/**
+ * @brief The MP object controls.
+ *
+ * Provided by the application via <rtems/confdefs.h>.
+ */
+extern Objects_MP_Control _Objects_MP_Controls[];
+
 /**
  *  The following type defines the callout used when a local task
  *  is extracted from a remote thread queue (i.e. it's proxy must
diff --git a/cpukit/score/src/mpcidefault.c b/cpukit/score/src/mpcidefault.c
index 9957f782fd..191f458b38 100644
--- a/cpukit/score/src/mpcidefault.c
+++ b/cpukit/score/src/mpcidefault.c
@@ -19,9 +19,12 @@
 #endif
 
 #include <rtems/score/mpci.h>
+#include <rtems/score/objectdata.h>
 #include <rtems/score/stack.h>
 #include <rtems/score/thread.h>
 
+Objects_MP_Control _Objects_MP_Controls[ 0 ];
+
 struct Thread_Configured_proxy_control {
   int dummy;
 };
diff --git a/cpukit/score/src/objectmp.c b/cpukit/score/src/objectmp.c
index 1910b8ccba..cad1413c33 100644
--- a/cpukit/score/src/objectmp.c
+++ b/cpukit/score/src/objectmp.c
@@ -21,7 +21,6 @@
 #include <rtems/score/objectimpl.h>
 #include <rtems/score/interr.h>
 #include <rtems/score/isrlock.h>
-#include <rtems/score/wkspace.h>
 #include <rtems/config.h>
 
 #define OBJECTS_MP_CONTROL_OF_ID_LOOKUP_NODE( node ) \
@@ -185,11 +184,9 @@ void _Objects_MP_Handler_initialization( void )
 
   _Chain_Initialize(
     &_Objects_MP_Inactive_global_objects,
-    _Workspace_Allocate_or_fatal_error(
-      maximum_global_objects * sizeof( Objects_MP_Control )
-    ),
+    &_Objects_MP_Controls[ 0 ],
     maximum_global_objects,
-    sizeof( Objects_MP_Control )
+    sizeof( _Objects_MP_Controls[ 0 ] )
   );
 }
 
-- 
2.16.4



More information about the devel mailing list