rtems: Simplify semaphore configuration

The MrsP semaphore implementation predates the addition of
self-contained synchronization objects.  At this time, the potential
memory reduction was justified considering the more complex
configuration and additional use of the workspace.  With the
availability of self-contained synchronization options, e.g. POSIX
mutexes, this is no longer justified.  Memory constrained applications
should use the self-contained synchronization objects.   Remove the
CONFIGURE_MAXIMUM_MRSP_SEMAPHORES configuration option. This has only an
impact on applications which use SMP and a large number of scheduler
instances.

Update #3833.
This commit is contained in:
Sebastian Huber
2019-12-11 09:05:07 +01:00
parent 01f8c12ee5
commit 4686554260
9 changed files with 36 additions and 37 deletions
+8 -18
View File
@@ -2000,22 +2000,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
#define CONFIGURE_MAXIMUM_SEMAPHORES 0
#endif
/*
* This macro is calculated to specify the memory required for
* Classic API Semaphores using MRSP. This is only available in
* SMP configurations.
*/
#if !defined(RTEMS_SMP) || \
!defined(CONFIGURE_MAXIMUM_MRSP_SEMAPHORES)
#define _CONFIGURE_MEMORY_FOR_MRSP_SEMAPHORES 0
#else
#define _CONFIGURE_MEMORY_FOR_MRSP_SEMAPHORES \
CONFIGURE_MAXIMUM_MRSP_SEMAPHORES * \
_Configure_From_workspace( \
RTEMS_ARRAY_SIZE(_Scheduler_Table) * sizeof(Priority_Control) \
)
#endif
#ifndef CONFIGURE_MAXIMUM_MESSAGE_QUEUES
/**
* This configuration parameter specifies the maximum number of
@@ -2502,7 +2486,6 @@ struct _reent *__getreent(void)
_CONFIGURE_TASKS, _CONFIGURE_TASKS) + \
_CONFIGURE_MEMORY_FOR_TASKS( \
_CONFIGURE_POSIX_THREADS, _CONFIGURE_POSIX_THREADS) + \
_CONFIGURE_MEMORY_FOR_MRSP_SEMAPHORES + \
_CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES( \
CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES) + \
_CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES( \
@@ -2786,7 +2769,10 @@ struct _reent *__getreent(void)
#endif
#if CONFIGURE_MAXIMUM_SEMAPHORES > 0
SEMAPHORE_INFORMATION_DEFINE( CONFIGURE_MAXIMUM_SEMAPHORES );
SEMAPHORE_INFORMATION_DEFINE(
CONFIGURE_MAXIMUM_SEMAPHORES,
_CONFIGURE_SCHEDULER_COUNT
);
#endif
#if _CONFIGURE_TIMERS > 0
@@ -3171,6 +3157,10 @@ struct _reent *__getreent(void)
#warning "The CONFIGURE_NUMBER_OF_TERMIOS_PORTS configuration option is obsolete since RTEMS 5.1"
#endif
#ifdef CONFIGURE_MAXIMUM_MRSP_SEMAPHORES
#warning "The CONFIGURE_MAXIMUM_MRSP_SEMAPHORES configuration option is obsolete since RTEMS 5.1"
#endif
#ifdef CONFIGURE_MAXIMUM_POSIX_BARRIERS
#warning "The CONFIGURE_MAXIMUM_POSIX_BARRIERS configuration option is obsolete since RTEMS 5.1"
#endif
+26 -2
View File
@@ -108,9 +108,32 @@ void _Semaphore_MP_Send_extract_proxy (
* This macro should only be used by <rtems/confdefs.h>.
*
* @param max The configured object maximum (the OBJECTS_UNLIMITED_OBJECTS flag
* may be set).
* may be set).
* @param scheduler_count The configured scheduler count (only used in SMP
* configurations).
*/
#define SEMAPHORE_INFORMATION_DEFINE( max ) \
#if defined(RTEMS_SMP)
#define SEMAPHORE_INFORMATION_DEFINE( max, scheduler_count ) \
typedef union { \
Objects_Control Object; \
Semaphore_Control Semaphore; \
struct { \
Objects_Control Object; \
MRSP_Control Control; \
Priority_Control ceiling_priorities[ scheduler_count ]; \
} MRSP; \
} Semaphore_Configured_control; \
OBJECTS_INFORMATION_DEFINE( \
_Semaphore, \
OBJECTS_CLASSIC_API, \
OBJECTS_RTEMS_SEMAPHORES, \
Semaphore_Configured_control, \
max, \
OBJECTS_NO_STRING_NAME, \
_Semaphore_MP_Send_extract_proxy \
)
#else
#define SEMAPHORE_INFORMATION_DEFINE( max, scheduler_count ) \
OBJECTS_INFORMATION_DEFINE( \
_Semaphore, \
OBJECTS_CLASSIC_API, \
@@ -120,6 +143,7 @@ void _Semaphore_MP_Send_extract_proxy (
OBJECTS_NO_STRING_NAME, \
_Semaphore_MP_Send_extract_proxy \
)
#endif
/** @} */
+1 -1
View File
@@ -73,7 +73,7 @@ typedef struct {
/**
* @brief One ceiling priority per scheduler instance.
*/
Priority_Control *ceiling_priorities;
Priority_Control ceiling_priorities[ RTEMS_ZERO_LENGTH_ARRAY ];
} MRSP_Control;
/** @} */
+1 -10
View File
@@ -7,7 +7,7 @@
*/
/*
* Copyright (c) 2014, 2016 embedded brains GmbH. All rights reserved.
* Copyright (c) 2014, 2019 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Dornierstr. 4
@@ -31,7 +31,6 @@
#include <rtems/score/status.h>
#include <rtems/score/threadqimpl.h>
#include <rtems/score/watchdogimpl.h>
#include <rtems/score/wkspace.h>
#ifdef __cplusplus
extern "C" {
@@ -302,13 +301,6 @@ RTEMS_INLINE_ROUTINE Status_Control _MRSP_Initialize(
return STATUS_INVALID_NUMBER;
}
mrsp->ceiling_priorities = _Workspace_Allocate(
sizeof( *mrsp->ceiling_priorities ) * scheduler_count
);
if ( mrsp->ceiling_priorities == NULL ) {
return STATUS_NO_MEMORY;
}
for ( i = 0 ; i < scheduler_count ; ++i ) {
const Scheduler_Control *scheduler_of_index;
@@ -524,7 +516,6 @@ RTEMS_INLINE_ROUTINE void _MRSP_Destroy(
{
_MRSP_Release( mrsp, queue_context );
_Thread_queue_Destroy( &mrsp->Wait_queue );
_Workspace_Free( mrsp->ceiling_priorities );
}
/** @} */
-1
View File
@@ -89,7 +89,6 @@ static void fatal_extension(
#define CONFIGURE_MAXIMUM_TASKS 1
#define CONFIGURE_MAXIMUM_TIMERS 1
#define CONFIGURE_MAXIMUM_SEMAPHORES 1
#define CONFIGURE_MAXIMUM_MRSP_SEMAPHORES 1
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
-1
View File
@@ -1777,7 +1777,6 @@ static void Init(rtems_task_argument arg)
#define CONFIGURE_MAXIMUM_TASKS (2 * CPU_COUNT + 2)
#define CONFIGURE_MAXIMUM_SEMAPHORES (MRSP_COUNT + 1)
#define CONFIGURE_MAXIMUM_MRSP_SEMAPHORES MRSP_COUNT
#define CONFIGURE_MAXIMUM_TIMERS 1
#define CONFIGURE_MAXIMUM_PROCESSORS CPU_COUNT
@@ -427,7 +427,6 @@ static void Init(rtems_task_argument arg)
#define CONFIGURE_MAXIMUM_TASKS 2
#define CONFIGURE_MAXIMUM_SEMAPHORES 2
#define CONFIGURE_MAXIMUM_MRSP_SEMAPHORES 1
/* Lets see when the first RTEMS system hits this limit */
#define CONFIGURE_MAXIMUM_PROCESSORS 64
-1
View File
@@ -327,7 +327,6 @@ static void Init(rtems_task_argument arg)
#define CONFIGURE_MAXIMUM_TASKS 2
#define CONFIGURE_MAXIMUM_SEMAPHORES 1
#define CONFIGURE_MAXIMUM_MRSP_SEMAPHORES 1
#define CONFIGURE_INIT_TASK_PRIORITY 2
-2
View File
@@ -816,8 +816,6 @@ static void Init(rtems_task_argument arg)
#define CONFIGURE_MAXIMUM_SEMAPHORES (1 + CPU_COUNT)
#define CONFIGURE_MAXIMUM_MRSP_SEMAPHORES CPU_COUNT
#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES CPU_COUNT
#define CONFIGURE_MESSAGE_BUFFER_MEMORY \