Changeset 46865542 in rtems


Ignore:
Timestamp:
Dec 7, 2019, 11:06:01 AM (12 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
5, master
Children:
84aee2e9
Parents:
01f8c12e
git-author:
Sebastian Huber <sebastian.huber@…> (12/07/19 11:06:01)
git-committer:
Sebastian Huber <sebastian.huber@…> (12/11/19 08:05:07)
Message:

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.

Files:
9 edited

Legend:

Unmodified
Added
Removed
  • cpukit/include/rtems/confdefs.h

    r01f8c12e r46865542  
    20012001#endif
    20022002
    2003 /*
    2004  * This macro is calculated to specify the memory required for
    2005  * Classic API Semaphores using MRSP. This is only available in
    2006  * SMP configurations.
    2007  */
    2008 #if !defined(RTEMS_SMP) || \
    2009   !defined(CONFIGURE_MAXIMUM_MRSP_SEMAPHORES)
    2010   #define _CONFIGURE_MEMORY_FOR_MRSP_SEMAPHORES 0
    2011 #else
    2012   #define _CONFIGURE_MEMORY_FOR_MRSP_SEMAPHORES \
    2013     CONFIGURE_MAXIMUM_MRSP_SEMAPHORES * \
    2014       _Configure_From_workspace( \
    2015         RTEMS_ARRAY_SIZE(_Scheduler_Table) * sizeof(Priority_Control) \
    2016       )
    2017 #endif
    2018 
    20192003#ifndef CONFIGURE_MAXIMUM_MESSAGE_QUEUES
    20202004  /**
     
    25032487   _CONFIGURE_MEMORY_FOR_TASKS( \
    25042488     _CONFIGURE_POSIX_THREADS, _CONFIGURE_POSIX_THREADS) + \
    2505    _CONFIGURE_MEMORY_FOR_MRSP_SEMAPHORES + \
    25062489   _CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES( \
    25072490     CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES) + \
     
    27872770
    27882771  #if CONFIGURE_MAXIMUM_SEMAPHORES > 0
    2789     SEMAPHORE_INFORMATION_DEFINE( CONFIGURE_MAXIMUM_SEMAPHORES );
     2772    SEMAPHORE_INFORMATION_DEFINE(
     2773      CONFIGURE_MAXIMUM_SEMAPHORES,
     2774      _CONFIGURE_SCHEDULER_COUNT
     2775    );
    27902776  #endif
    27912777
     
    31723158#endif
    31733159
     3160#ifdef CONFIGURE_MAXIMUM_MRSP_SEMAPHORES
     3161  #warning "The CONFIGURE_MAXIMUM_MRSP_SEMAPHORES configuration option is obsolete since RTEMS 5.1"
     3162#endif
     3163
    31743164#ifdef CONFIGURE_MAXIMUM_POSIX_BARRIERS
    31753165  #warning "The CONFIGURE_MAXIMUM_POSIX_BARRIERS configuration option is obsolete since RTEMS 5.1"
  • cpukit/include/rtems/rtems/semdata.h

    r01f8c12e r46865542  
    109109 *
    110110 * @param max The configured object maximum (the OBJECTS_UNLIMITED_OBJECTS flag
    111  * may be set).
     111 *   may be set).
     112 * @param scheduler_count The configured scheduler count (only used in SMP
     113 *   configurations).
    112114 */
    113 #define SEMAPHORE_INFORMATION_DEFINE( max ) \
     115#if defined(RTEMS_SMP)
     116#define SEMAPHORE_INFORMATION_DEFINE( max, scheduler_count ) \
     117  typedef union { \
     118    Objects_Control Object; \
     119    Semaphore_Control Semaphore; \
     120    struct { \
     121      Objects_Control Object; \
     122      MRSP_Control Control; \
     123      Priority_Control ceiling_priorities[ scheduler_count ]; \
     124    } MRSP; \
     125  } Semaphore_Configured_control; \
     126  OBJECTS_INFORMATION_DEFINE( \
     127    _Semaphore, \
     128    OBJECTS_CLASSIC_API, \
     129    OBJECTS_RTEMS_SEMAPHORES, \
     130    Semaphore_Configured_control, \
     131    max, \
     132    OBJECTS_NO_STRING_NAME, \
     133    _Semaphore_MP_Send_extract_proxy \
     134  )
     135#else
     136#define SEMAPHORE_INFORMATION_DEFINE( max, scheduler_count ) \
    114137  OBJECTS_INFORMATION_DEFINE( \
    115138    _Semaphore, \
     
    121144    _Semaphore_MP_Send_extract_proxy \
    122145  )
     146#endif
    123147
    124148/** @} */
  • cpukit/include/rtems/score/mrsp.h

    r01f8c12e r46865542  
    7474   * @brief One ceiling priority per scheduler instance.
    7575   */
    76   Priority_Control *ceiling_priorities;
     76  Priority_Control ceiling_priorities[ RTEMS_ZERO_LENGTH_ARRAY ];
    7777} MRSP_Control;
    7878
  • cpukit/include/rtems/score/mrspimpl.h

    r01f8c12e r46865542  
    88
    99/*
    10  * Copyright (c) 2014, 2016 embedded brains GmbH.  All rights reserved.
     10 * Copyright (c) 2014, 2019 embedded brains GmbH.  All rights reserved.
    1111 *
    1212 *  embedded brains GmbH
     
    3232#include <rtems/score/threadqimpl.h>
    3333#include <rtems/score/watchdogimpl.h>
    34 #include <rtems/score/wkspace.h>
    3534
    3635#ifdef __cplusplus
     
    301300  if ( initially_locked ) {
    302301    return STATUS_INVALID_NUMBER;
    303   }
    304 
    305   mrsp->ceiling_priorities = _Workspace_Allocate(
    306     sizeof( *mrsp->ceiling_priorities ) * scheduler_count
    307   );
    308   if ( mrsp->ceiling_priorities == NULL ) {
    309     return STATUS_NO_MEMORY;
    310302  }
    311303
     
    525517  _MRSP_Release( mrsp, queue_context );
    526518  _Thread_queue_Destroy( &mrsp->Wait_queue );
    527   _Workspace_Free( mrsp->ceiling_priorities );
    528519}
    529520
  • testsuites/smptests/smpfatal03/init.c

    r01f8c12e r46865542  
    9090#define CONFIGURE_MAXIMUM_TIMERS 1
    9191#define CONFIGURE_MAXIMUM_SEMAPHORES 1
    92 #define CONFIGURE_MAXIMUM_MRSP_SEMAPHORES 1
    9392
    9493#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
  • testsuites/smptests/smpmrsp01/init.c

    r01f8c12e r46865542  
    17781778#define CONFIGURE_MAXIMUM_TASKS (2 * CPU_COUNT + 2)
    17791779#define CONFIGURE_MAXIMUM_SEMAPHORES (MRSP_COUNT + 1)
    1780 #define CONFIGURE_MAXIMUM_MRSP_SEMAPHORES MRSP_COUNT
    17811780#define CONFIGURE_MAXIMUM_TIMERS 1
    17821781
  • testsuites/smptests/smpscheduler02/init.c

    r01f8c12e r46865542  
    428428#define CONFIGURE_MAXIMUM_TASKS 2
    429429#define CONFIGURE_MAXIMUM_SEMAPHORES 2
    430 #define CONFIGURE_MAXIMUM_MRSP_SEMAPHORES 1
    431430
    432431/* Lets see when the first RTEMS system hits this limit */
  • testsuites/sptests/spmrsp01/init.c

    r01f8c12e r46865542  
    328328#define CONFIGURE_MAXIMUM_TASKS 2
    329329#define CONFIGURE_MAXIMUM_SEMAPHORES 1
    330 #define CONFIGURE_MAXIMUM_MRSP_SEMAPHORES 1
    331330
    332331#define CONFIGURE_INIT_TASK_PRIORITY 2
  • testsuites/tmtests/tmfine01/init.c

    r01f8c12e r46865542  
    817817#define CONFIGURE_MAXIMUM_SEMAPHORES (1 + CPU_COUNT)
    818818
    819 #define CONFIGURE_MAXIMUM_MRSP_SEMAPHORES CPU_COUNT
    820 
    821819#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES CPU_COUNT
    822820
Note: See TracChangeset for help on using the changeset viewer.