mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-21 08:36:22 +08:00
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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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 \
|
||||
|
||||
Reference in New Issue
Block a user