Changeset e53aae2 in rtems


Ignore:
Timestamp:
Mar 26, 2012, 8:42:38 PM (8 years ago)
Author:
Gedare Bloom <gedare@…>
Branches:
4.11, master
Children:
e6f327c
Parents:
39671330
git-author:
Gedare Bloom <gedare@…> (03/26/12 20:42:38)
git-committer:
Gedare Bloom <gedare@…> (03/27/12 23:51:31)
Message:

confdefs: Add declaration for unlimited objects.

Adds to confdefs a way to specify rtems_resource_unlimited for classic and
posix objects using a new macro CONFIGURE_OBJECTS_UNLIMITED.
Use CONFIGURE_OBJECTS_ALLOCATION_SIZE to declare the allocation size for
extending the set of objects at runtime. Updates the unlimited sample
to demonstrate how to use the new macros. Also adds new documentation in
the C User's Manual regarding configuring with unlimited objects.

Files:
4 edited

Legend:

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

    r39671330 re53aae2  
    13451345
    13461346
     1347/**
     1348 * This macro specifies that the user wants to use unlimited objects for any
     1349 * classic or posix objects that have not already been given resource limits.
     1350 */
     1351#if defined(CONFIGURE_UNLIMITED_OBJECTS)
     1352  #if !defined(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
     1353  /**
     1354   * This macro specifies a default allocation size for when auto-extending
     1355   * unlimited objects if none was given by the user.
     1356   */
     1357    #define CONFIGURE_UNLIMITED_ALLOCATION_SIZE 8
     1358  #endif
     1359  #if !defined(CONFIGURE_MAXIMUM_TASKS)
     1360    #define CONFIGURE_MAXIMUM_TASKS \
     1361      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
     1362  #endif
     1363  #if !defined(CONFIGURE_MAXIMUM_TIMERS)
     1364    #define CONFIGURE_MAXIMUM_TIMERS \
     1365      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
     1366  #endif
     1367  #if !defined(CONFIGURE_MAXIMUM_SEMAPHORES)
     1368    #define CONFIGURE_MAXIMUM_SEMAPHORES \
     1369      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
     1370  #endif
     1371  #if !defined(CONFIGURE_MAXIMUM_MESSAGE_QUEUES)
     1372    #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES \
     1373      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
     1374  #endif
     1375  #if !defined(CONFIGURE_MAXIMUM_PARTITIONS)
     1376    #define CONFIGURE_MAXIMUM_PARTITIONS \
     1377      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
     1378  #endif
     1379  #if !defined(CONFIGURE_MAXIMUM_REGIONS)
     1380    #define CONFIGURE_MAXIMUM_REGIONS \
     1381      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
     1382  #endif
     1383  #if !defined(CONFIGURE_MAXIMUM_PORTS)
     1384    #define CONFIGURE_MAXIMUM_PORTS \
     1385      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
     1386  #endif
     1387  #if !defined(CONFIGURE_MAXIMUM_PERIODS)
     1388    #define CONFIGURE_MAXIMUM_PERIODS \
     1389      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
     1390  #endif
     1391  #if !defined(CONFIGURE_MAXIMUM_BARRIERS)
     1392    #define CONFIGURE_MAXIMUM_BARRIERS \
     1393      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
     1394  #endif
     1395
     1396  #ifdef RTEMS_POSIX_API
     1397    #if !defined(CONFIGURE_MAXIMUM_POSIX_THREADS)
     1398      #define CONFIGURE_MAXIMUM_POSIX_THREADS \
     1399        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
     1400    #endif
     1401    #if !defined(CONFIGURE_MAXIMUM_POSIX_MUTEXES)
     1402      #define CONFIGURE_MAXIMUM_POSIX_MUTEXES \
     1403        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
     1404    #endif
     1405    #if !defined(CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES)
     1406      #define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES \
     1407        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
     1408    #endif
     1409/*
     1410    #if !defined(CONFIGURE_MAXIMUM_POSIX_KEYS)
     1411      #define CONFIGURE_MAXIMUM_POSIX_KEYS \
     1412        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
     1413    #endif
     1414*/
     1415    #if !defined(CONFIGURE_MAXIMUM_POSIX_TIMERS)
     1416      #define CONFIGURE_MAXIMUM_POSIX_TIMERS \
     1417        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
     1418    #endif
     1419/*
     1420    #if !defined(CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS)
     1421      #define CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS \
     1422        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
     1423    #endif
     1424*/
     1425    #if !defined(CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES)
     1426      #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES \
     1427        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
     1428    #endif
     1429    #if !defined(CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS)
     1430      #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS \
     1431        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
     1432    #endif
     1433    #if !defined(CONFIGURE_MAXIMUM_POSIX_SEMAPHORES)
     1434      #define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES \
     1435        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
     1436    #endif
     1437    #if !defined(CONFIGURE_MAXIMUM_POSIX_BARRIERS)
     1438      #define CONFIGURE_MAXIMUM_POSIX_BARRIERS \
     1439        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
     1440    #endif
     1441    #if !defined(CONFIGURE_MAXIMUM_POSIX_RWLOCKS)
     1442      #define CONFIGURE_MAXIMUM_POSIX_RWLOCKS \
     1443        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
     1444    #endif
     1445    #if !defined(CONFIGURE_MAXIMUM_POSIX_SPINLOCKS)
     1446      #define CONFIGURE_MAXIMUM_POSIX_SPINLOCKS \
     1447        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
     1448    #endif
     1449  #endif /* RTEMS_POSIX_API */
     1450#endif /* CONFIGURE_UNLIMITED_OBJECTS */
     1451
     1452
    13471453/*
    13481454 *  Default Configuration Table.
     
    15491655  #define _Configure_POSIX_Named_Object_RAM(_number, _size) \
    15501656    _Configure_Object_RAM( (_number), _size ) + \
    1551     ((_number) * _Configure_From_workspace(NAME_MAX) )
     1657    (_Configure_Max_Objects(_number) * _Configure_From_workspace(NAME_MAX) )
    15521658
    15531659  #ifndef CONFIGURE_MAXIMUM_POSIX_THREADS
  • doc/user/Makefile.am

    r39671330 re53aae2  
    162162
    163163mp.texi: mp.t
    164         $(BMENU2) -p "Configuring a System Sizing the RTEMS RAM Workspace" \
     164        $(BMENU2) -p "Configuring a System Unlimited Objects" \
    165165            -u "Top" \
    166166            -n "Stack Bounds Checker" < $< > $@
  • doc/user/conf.t

    r39671330 re53aae2  
    21362136specifying the application requirements via parameters
    21372137such as @code{CONFIGURE_EXTRA_TASK_STACKS} and
    2138 @code{CONFIGURE_MAXIMUM_TASKS} is critical.
     2138@code{CONFIGURE_MAXIMUM_TASKS} is critical for production software.
    21392139
    21402140The allocation of objects can operate in two modes. The default mode
     
    21452145objects to grow to use the available free memory in the RTEMS RAM Workspace.
    21462146
    2147 The auto-extending mode can be enabled individually for each object
     2147See @ref{Configuring a System Unlimited Objects} for more details
     2148about the second mode, which allows for dynamic allocation of objects
     2149and therefore does not provide determinism.
     2150This mode is useful mostly for when the number of objects cannot be
     2151determined ahead of time or when porting software for which you do not
     2152know the object requirements.
     2153
     2154Note that future versions of RTEMS may not have the
     2155same memory requirements per object. Although the value calculated is
     2156sufficient for a particular target processor and release of RTEMS,
     2157memory usage is subject to change across versions and target
     2158processors.  To avoid problems, users should accurately
     2159specify each configuration parameter and allow
     2160@code{<rtems/confdefs.h>} to calculate the memory requirements.
     2161The memory requirements are likely to change each
     2162time one of the following events occurs:
     2163
     2164@itemize @bullet
     2165@item a configuration parameter is modified,
     2166@item task or interrupt stack requirements change,
     2167@item task floating point attribute is altered,
     2168@item RTEMS is upgraded, or
     2169@item the target processor is changed.
     2170@end itemize
     2171
     2172Failure to provide enough space in the RTEMS RAM
     2173Workspace will result in the
     2174@code{@value{DIRPREFIX}fatal_error_occurred} directive
     2175being invoked with the appropriate error code.
     2176
     2177@subsection Unlimited Objects
     2178
     2179In real-time embedded systems the RAM is normally a limited, critical resource
     2180and dynamic allocation is avoided as much as possible to ensure predictable,
     2181deterministic execution times. For such cases,
     2182see @ref{Configuring a System Sizing the RTEMS RAM Workspace}
     2183for an overview of how to tune the size of the workspace.
     2184Frequently when users are porting software to RTEMS the precise resource
     2185requirements of the software is unknown. In these situations users do not
     2186need to control the size of the workspace very tightly because they just
     2187want to get the new software to run; later they can tune the workspace size
     2188as needed.
     2189
     2190When the number of objects is not known ahead of time, RTEMS provides an
     2191auto-extending mode that can be enabled individually for each object
    21482192type by using the macro @code{rtems_resource_unlimited}. This takes a value
    21492193as a parameter, and is used to set the object maximum number field in
     
    21612205@end example
    21622206
    2163 The user is cautioned that future versions of RTEMS may not have the
    2164 same memory requirements per object. Although the value calculated is
    2165 suficient for a particular target processor and release of RTEMS,
    2166 memory usage is subject to change across versions and target
    2167 processors.  To avoid problems, the user should accurately
    2168 specify each configuration parameter and allow
    2169 @code{<rtems/confdefs.h>} to calculate the memory requirements.
    2170 The memory requirements are likely to change each
    2171 time one of the following events occurs:
    2172 
     2207To ease the burden of developers who are porting new software RTEMS also
     2208provides the following macros:
    21732209@itemize @bullet
    2174 @item a configuration parameter is modified,
    2175 @item task or interrupt stack requirements change,
    2176 @item task floating point attribute is altered,
    2177 @item RTEMS is upgraded, or
    2178 @item the target processor is changed.
     2210
     2211@findex CONFIGURE_OBJECTS_UNLIMITED
     2212@item @code{CONFIGURE_OBJECTS_UNLIMITED}
     2213uses @code{rtems_resource_unlimited} for classic and posix objects that
     2214do not already have a maximum limit defined.
     2215
     2216@findex CONFIGURE_OBJECTS_ALLOCATION_SIZE
     2217@item @code{CONFIGURE_OBJECTS_ALLOCATION_SIZE}
     2218provides an allocation size to use for @code{rtems_resource_unlimited} when
     2219using @code{CONFIGURE_OBJECTS_UNLIMITED}; the default value is 8.
     2220
    21792221@end itemize
    21802222
    2181 Failure to provide enough space in the RTEMS RAM
    2182 Workspace will result in the
    2183 @code{@value{DIRPREFIX}fatal_error_occurred} directive
    2184 being invoked with the appropriate error code.
     2223By allowing users to declare all resources as being unlimited the user
     2224can avoid identifying and limiting the resources used.
     2225@code{CONFIGURE_OBJECTS_UNLIMITED} does not support varying
     2226the allocation sizes for different objects; users who want that
     2227much control can define the @code{rtems_resource_unlimited} macros themselves.
     2228
     2229@example
     2230#define CONFIGURE_OBJECTS_UNLIMITED
     2231#define CONFIGURE_OBJECTS_ALLOCATION_SIZE 5
     2232@end example
     2233
     2234Due to how the posix object memory requirements are configured the
     2235unlimited object support does not provide unlimited size declarations
     2236for posix keys or queued signals.
     2237
     2238Users are cautioned that using unlimited objects is not recommended for
     2239production software unless the dynamic growth is absolutely required.
  • testsuites/samples/unlimited/system.h

    r39671330 re53aae2  
    5151
    5252#define TASK_ALLOCATION_SIZE     (5)
    53 #define CONFIGURE_MAXIMUM_TASKS  rtems_resource_unlimited(TASK_ALLOCATION_SIZE)
     53#define CONFIGURE_UNLIMITED_OBJECTS
     54#define CONFIGURE_UNLIMITED_ALLOCATION_SIZE TASK_ALLOCATION_SIZE
    5455#define CONFIGURE_INIT_TASK_STACK_SIZE (8 * 1024)
    5556
Note: See TracChangeset for help on using the changeset viewer.