diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2019-12-12 08:43:06 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2019-12-13 08:35:21 +0100 |
commit | 1d9f509e68a431d902cc655c85dc0601be4617b0 (patch) | |
tree | 34c7cb9da6d5a4f424d96e29fa2607e2ecd67a5a /cpukit | |
parent | config: Add _MPCI_Configuration (diff) | |
download | rtems-1d9f509e68a431d902cc655c85dc0601be4617b0.tar.bz2 |
config: Statically allocate MP thread proxies
Update #3735.
Diffstat (limited to 'cpukit')
-rw-r--r-- | cpukit/include/rtems/confdefs.h | 19 | ||||
-rw-r--r-- | cpukit/include/rtems/score/thread.h | 17 | ||||
-rw-r--r-- | cpukit/score/src/mpcidefault.c | 3 | ||||
-rw-r--r-- | cpukit/score/src/threadmp.c | 6 |
4 files changed, 34 insertions, 11 deletions
diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h index 692470c024..23fa5b4e9d 100644 --- a/cpukit/include/rtems/confdefs.h +++ b/cpukit/include/rtems/confdefs.h @@ -1831,10 +1831,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[]; #ifndef CONFIGURE_MP_MAXIMUM_PROXIES #define CONFIGURE_MP_MAXIMUM_PROXIES 32 #endif - #define _CONFIGURE_MEMORY_FOR_PROXIES(_proxies) \ - _Configure_From_workspace((_proxies) \ - * (sizeof(Thread_Proxy_control) \ - + sizeof(Thread_queue_Configured_heads))) #ifndef CONFIGURE_MP_MPCI_TABLE_POINTER #include <mpci.h> @@ -1850,6 +1846,18 @@ extern rtems_initialization_tasks_table Initialization_tasks[]; #error "CONFIGURE_MP_NODE_NUMBER must be less than or equal to CONFIGURE_MP_MAXIMUM_NODES" #endif + struct Thread_Configured_proxy_control { + Thread_Proxy_control Control; + Thread_queue_Configured_heads Heads; + }; + + static Thread_Configured_proxy_control _Thread_MP_Configured_proxies[ + CONFIGURE_MP_MAXIMUM_PROXIES + ]; + + Thread_Configured_proxy_control * const _Thread_MP_Proxies = + &_Thread_MP_Configured_proxies[ 0 ]; + const MPCI_Configuration _MPCI_Configuration = { CONFIGURE_MP_NODE_NUMBER, /* local node number */ CONFIGURE_MP_MAXIMUM_NODES, /* maximum # nodes */ @@ -2391,8 +2399,7 @@ struct _reent *__getreent(void) */ #ifdef CONFIGURE_MP_APPLICATION #define _CONFIGURE_MEMORY_FOR_MP \ - (_CONFIGURE_MEMORY_FOR_PROXIES(CONFIGURE_MP_MAXIMUM_PROXIES) + \ - _CONFIGURE_MEMORY_FOR_GLOBAL_OBJECTS(CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS)) + _CONFIGURE_MEMORY_FOR_GLOBAL_OBJECTS(CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS) #else #define _CONFIGURE_MEMORY_FOR_MP 0 #endif diff --git a/cpukit/include/rtems/score/thread.h b/cpukit/include/rtems/score/thread.h index fd99e8bb77..bd8de4ef81 100644 --- a/cpukit/include/rtems/score/thread.h +++ b/cpukit/include/rtems/score/thread.h @@ -1065,6 +1065,23 @@ Thread_Information name##_Information = { \ } \ } +#if defined(RTEMS_MULTIPROCESSING) +/** + * @brief The configured thread control block. + * + * This type is defined in <rtems/confdefs.h> and depends on the application + * configuration. + */ +typedef struct Thread_Configured_proxy_control Thread_Configured_proxy_control; + +/** + * @brief The configured proxies. + * + * Provided by the application via <rtems/confdefs.h>. + */ +extern Thread_Configured_proxy_control * const _Thread_MP_Proxies; +#endif + /** @} */ #ifdef __cplusplus diff --git a/cpukit/score/src/mpcidefault.c b/cpukit/score/src/mpcidefault.c index 60f1ef31a7..beb3221564 100644 --- a/cpukit/score/src/mpcidefault.c +++ b/cpukit/score/src/mpcidefault.c @@ -20,6 +20,9 @@ #include <rtems/score/mpci.h> #include <rtems/score/stack.h> +#include <rtems/score/thread.h> + +Thread_Configured_proxy_control * const _Thread_MP_Proxies; const MPCI_Configuration _MPCI_Configuration = { 1, /* local node number */ diff --git a/cpukit/score/src/threadmp.c b/cpukit/score/src/threadmp.c index e0c9da15e7..e60aeed893 100644 --- a/cpukit/score/src/threadmp.c +++ b/cpukit/score/src/threadmp.c @@ -21,7 +21,6 @@ #include <rtems/score/threadimpl.h> #include <rtems/score/isrlock.h> #include <rtems/score/schedulerimpl.h> -#include <rtems/score/wkspace.h> #include <string.h> @@ -46,7 +45,6 @@ void _Thread_MP_Handler_initialization ( ) { size_t proxy_size; - size_t alloc_size; char *proxies; uint32_t i; @@ -55,9 +53,7 @@ void _Thread_MP_Handler_initialization ( } proxy_size = sizeof( Thread_Proxy_control ) + _Thread_queue_Heads_size; - alloc_size = maximum_proxies * proxy_size; - proxies = _Workspace_Allocate_or_fatal_error( alloc_size ); - memset( proxies, 0, alloc_size ); + proxies = (char *) _Thread_MP_Proxies; _Chain_Initialize( &_Thread_MP_Inactive_proxies, |