Changeset b6911069 in rtems


Ignore:
Timestamp:
May 29, 2012, 4:02:52 PM (8 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
40284de
Parents:
bb08c0c8
git-author:
Sebastian Huber <sebastian.huber@…> (05/29/12 16:02:52)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/31/12 09:05:48)
Message:

libblock: Add task stack size bdbuf configuration

The task stack size for the swap-out and worker tasks is now
configurable. The bdbuf task resources are now included in the work
space size estimate.

Files:
14 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libblock/include/rtems/bdbuf.h

    rbb08c0c8 rb6911069  
    364364  rtems_task_priority swapout_priority;        /**< Priority of the swap out
    365365                                                * task. */
    366   uint32_t            swapout_period;          /**< Period swapout checks buf
     366  uint32_t            swapout_period;          /**< Period swap-out checks buf
    367367                                                * timers. */
    368368  uint32_t            swap_block_hold;         /**< Period a buffer is held. */
    369369  size_t              swapout_workers;         /**< The number of worker
    370                                                 * threads for the swapout
     370                                                * threads for the swap-out
    371371                                                * task. */
    372372  rtems_task_priority swapout_worker_priority; /**< Priority of the swap out
    373373                                                * task. */
     374  size_t              task_stack_size;         /**< Task stack size for swap-out
     375                                                * task and worker threads. */
    374376  size_t              size;                    /**< Size of memory in the
    375377                                                * cache */
     
    419421
    420422/**
    421  * Default swap-out worker task priority. The same as the swapout task.
     423 * Default swap-out worker task priority. The same as the swap-out task.
    422424 */
    423425#define RTEMS_BDBUF_SWAPOUT_WORKER_TASK_PRIORITY_DEFAULT \
    424426                             RTEMS_BDBUF_SWAPOUT_TASK_PRIORITY_DEFAULT
     427
     428/**
     429 * Default task stack size for swap-out and worker tasks.
     430 */
     431#define RTEMS_BDBUF_TASK_STACK_SIZE_DEFAULT RTEMS_MINIMUM_STACK_SIZE
    425432
    426433/**
  • cpukit/libblock/src/bdbuf.c

    rbb08c0c8 rb6911069  
    174174#define RTEMS_BLKDEV_FATAL_BDBUF_SO_NOMEM      RTEMS_BLKDEV_FATAL_ERROR(21)
    175175#define RTEMS_BLKDEV_FATAL_BDBUF_SO_WK_CREATE  RTEMS_BLKDEV_FATAL_ERROR(22)
    176 #define RTEMS_BLKDEV_FATAL_BDBUF_SO_WK_START   RTEMS_BLKDEV_FATAL_ERROR(23)
    177176#define BLKDEV_FATAL_BDBUF_SWAPOUT_RE          RTEMS_BLKDEV_FATAL_ERROR(24)
    178177#define BLKDEV_FATAL_BDBUF_SWAPOUT_TS          RTEMS_BLKDEV_FATAL_ERROR(25)
     
    189188#define RTEMS_BDBUF_TRANSFER_SYNC  RTEMS_EVENT_1
    190189#define RTEMS_BDBUF_SWAPOUT_SYNC   RTEMS_EVENT_2
    191 
    192 /**
    193  * The swap out task size. Should be more than enough for most drivers with
    194  * tracing turned on.
    195  */
    196 #define SWAPOUT_TASK_STACK_SIZE (8 * 1024)
    197190
    198191/**
     
    12881281}
    12891282
     1283static rtems_status_code
     1284rtems_bdbuf_create_task(
     1285  rtems_name name,
     1286  rtems_task_priority priority,
     1287  rtems_task_priority default_priority,
     1288  rtems_task_entry entry,
     1289  rtems_task_argument arg,
     1290  rtems_id *id
     1291)
     1292{
     1293  rtems_status_code sc;
     1294  size_t stack_size = bdbuf_config.task_stack_size ?
     1295    bdbuf_config.task_stack_size : RTEMS_BDBUF_TASK_STACK_SIZE_DEFAULT;
     1296
     1297  priority = priority != 0 ? priority : default_priority;
     1298
     1299  sc = rtems_task_create (name,
     1300                          priority,
     1301                          stack_size,
     1302                          RTEMS_PREEMPT | RTEMS_NO_TIMESLICE | RTEMS_NO_ASR,
     1303                          RTEMS_LOCAL | RTEMS_NO_FLOATING_POINT,
     1304                          id);
     1305
     1306  if (sc == RTEMS_SUCCESSFUL)
     1307    sc = rtems_task_start (*id, entry, arg);
     1308
     1309  return sc;
     1310}
     1311
    12901312/**
    12911313 * Initialise the cache.
     
    14571479  bdbuf_cache.swapout_enabled = true;
    14581480
    1459   sc = rtems_task_create (rtems_build_name('B', 'S', 'W', 'P'),
    1460                           bdbuf_config.swapout_priority ?
    1461                             bdbuf_config.swapout_priority :
    1462                             RTEMS_BDBUF_SWAPOUT_TASK_PRIORITY_DEFAULT,
    1463                           SWAPOUT_TASK_STACK_SIZE,
    1464                           RTEMS_PREEMPT | RTEMS_NO_TIMESLICE | RTEMS_NO_ASR,
    1465                           RTEMS_LOCAL | RTEMS_NO_FLOATING_POINT,
    1466                           &bdbuf_cache.swapout);
    1467   if (sc != RTEMS_SUCCESSFUL)
    1468     goto error;
    1469 
    1470   sc = rtems_task_start (bdbuf_cache.swapout,
    1471                          rtems_bdbuf_swapout_task,
    1472                          (rtems_task_argument) &bdbuf_cache);
     1481  sc = rtems_bdbuf_create_task (rtems_build_name('B', 'S', 'W', 'P'),
     1482                                bdbuf_config.swapout_priority,
     1483                                RTEMS_BDBUF_SWAPOUT_TASK_PRIORITY_DEFAULT,
     1484                                rtems_bdbuf_swapout_task,
     1485                                0,
     1486                                &bdbuf_cache.swapout);
    14731487  if (sc != RTEMS_SUCCESSFUL)
    14741488    goto error;
     
    26402654    worker->transfer.dd = BDBUF_INVALID_DEV;
    26412655
    2642     sc = rtems_task_create (rtems_build_name('B', 'D', 'o', 'a' + w),
    2643                             (bdbuf_config.swapout_priority ?
    2644                              bdbuf_config.swapout_priority :
    2645                              RTEMS_BDBUF_SWAPOUT_TASK_PRIORITY_DEFAULT),
    2646                             SWAPOUT_TASK_STACK_SIZE,
    2647                             RTEMS_PREEMPT | RTEMS_NO_TIMESLICE | RTEMS_NO_ASR,
    2648                             RTEMS_LOCAL | RTEMS_NO_FLOATING_POINT,
    2649                             &worker->id);
     2656    sc = rtems_bdbuf_create_task (rtems_build_name('B', 'D', 'o', 'a' + w),
     2657                                  bdbuf_config.swapout_worker_priority,
     2658                                  RTEMS_BDBUF_SWAPOUT_WORKER_TASK_PRIORITY_DEFAULT,
     2659                                  rtems_bdbuf_swapout_worker_task,
     2660                                  (rtems_task_argument) worker,
     2661                                  &worker->id);
    26502662    if (sc != RTEMS_SUCCESSFUL)
    26512663      rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_SO_WK_CREATE);
    2652 
    2653     sc = rtems_task_start (worker->id,
    2654                            rtems_bdbuf_swapout_worker_task,
    2655                            (rtems_task_argument) worker);
    2656     if (sc != RTEMS_SUCCESSFUL)
    2657       rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_SO_WK_START);
    26582664  }
    26592665
  • cpukit/sapi/include/confdefs.h

    rbb08c0c8 rb6911069  
    12261226                              RTEMS_BDBUF_SWAPOUT_WORKER_TASK_PRIORITY_DEFAULT
    12271227  #endif
     1228  #ifndef CONFIGURE_BDBUF_TASK_STACK_SIZE
     1229    #define CONFIGURE_BDBUF_TASK_STACK_SIZE \
     1230                              RTEMS_BDBUF_TASK_STACK_SIZE_DEFAULT
     1231  #endif
    12281232  #ifndef CONFIGURE_BDBUF_CACHE_MEMORY_SIZE
    12291233    #define CONFIGURE_BDBUF_CACHE_MEMORY_SIZE \
     
    12471251      CONFIGURE_SWAPOUT_WORKER_TASKS,
    12481252      CONFIGURE_SWAPOUT_WORKER_TASK_PRIORITY,
     1253      CONFIGURE_BDBUF_TASK_STACK_SIZE,
    12491254      CONFIGURE_BDBUF_CACHE_MEMORY_SIZE,
    12501255      CONFIGURE_BDBUF_BUFFER_MIN_SIZE,
     
    12521257    };
    12531258  #endif
     1259
     1260  #define CONFIGURE_LIBBLOCK_TASKS (1 + CONFIGURE_SWAPOUT_WORKER_TASKS)
     1261
     1262  #define CONFIGURE_LIBBLOCK_TASK_EXTRA_STACKS \
     1263    (CONFIGURE_LIBBLOCK_TASKS * \
     1264    (CONFIGURE_BDBUF_TASK_STACK_SIZE <= CONFIGURE_MINIMUM_TASK_STACK_SIZE ? \
     1265    0 : CONFIGURE_BDBUF_TASK_STACK_SIZE - CONFIGURE_MINIMUM_TASK_STACK_SIZE))
    12541266
    12551267  /*
     
    12701282  #endif
    12711283#else
     1284  #define CONFIGURE_LIBBLOCK_TASKS 0
     1285  #define CONFIGURE_LIBBLOCK_TASK_EXTRA_STACKS 0
    12721286  #define CONFIGURE_LIBBLOCK_SEMAPHORES 0
    12731287#endif /* CONFIGURE_APPLICATION_NEEDS_LIBBLOCK */
     
    14561470    #define CONFIGURE_MAXIMUM_TASKS               0
    14571471  #endif
     1472
     1473  #define CONFIGURE_TASKS \
     1474    (CONFIGURE_MAXIMUM_TASKS + CONFIGURE_LIBBLOCK_TASKS)
    14581475
    14591476  #ifndef CONFIGURE_DISABLE_CLASSIC_API_NOTEPADS
     
    20742091 */
    20752092#define CONFIGURE_TOTAL_TASKS_AND_THREADS \
    2076    (CONFIGURE_MAXIMUM_TASKS + \
     2093   (CONFIGURE_TASKS + \
    20772094    CONFIGURE_MAXIMUM_POSIX_THREADS + CONFIGURE_MAXIMUM_ADA_TASKS + \
    20782095    CONFIGURE_MAXIMUM_GOROUTINES)
     
    21772194
    21782195#define CONFIGURE_TASKS_STACK \
    2179   (_Configure_Max_Objects( CONFIGURE_MAXIMUM_TASKS ) * \
     2196  (_Configure_Max_Objects( CONFIGURE_TASKS ) * \
    21802197    _Configure_From_stackspace( CONFIGURE_MINIMUM_TASK_STACK_SIZE ) )
    21812198
     
    22202237    CONFIGURE_ADA_TASKS_STACK + \
    22212238    CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK + \
     2239    CONFIGURE_LIBBLOCK_TASK_EXTRA_STACKS + \
    22222240    CONFIGURE_EXTRA_TASK_STACKS \
    22232241  )
     
    22282246   */
    22292247  rtems_api_configuration_table Configuration_RTEMS_API = {
    2230     CONFIGURE_MAXIMUM_TASKS,
     2248    CONFIGURE_TASKS,
    22312249    CONFIGURE_NOTEPADS_ENABLED,
    22322250    CONFIGURE_MAXIMUM_TIMERS + CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER,
  • testsuites/libtests/block01/init.c

    rbb08c0c8 rb6911069  
    254254#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 4
    255255
    256 #define CONFIGURE_MAXIMUM_TASKS 2
     256#define CONFIGURE_MAXIMUM_TASKS 1
    257257#define CONFIGURE_MAXIMUM_DRIVERS 2
    258 #define CONFIGURE_EXTRA_TASK_STACKS (8 * 1024)
    259258
    260259#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
  • testsuites/libtests/block02/init.c

    rbb08c0c8 rb6911069  
    200200#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
    201201
    202 #define CONFIGURE_MAXIMUM_TASKS 5
     202#define CONFIGURE_MAXIMUM_TASKS 3
    203203#define CONFIGURE_MAXIMUM_DRIVERS 3
    204204
  • testsuites/libtests/block03/init.c

    rbb08c0c8 rb6911069  
    187187#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
    188188
    189 #define CONFIGURE_MAXIMUM_TASKS 5
     189#define CONFIGURE_MAXIMUM_TASKS 3
    190190#define CONFIGURE_MAXIMUM_DRIVERS 2
    191191
  • testsuites/libtests/block04/init.c

    rbb08c0c8 rb6911069  
    159159#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
    160160
    161 #define CONFIGURE_MAXIMUM_TASKS 5
     161#define CONFIGURE_MAXIMUM_TASKS 3
    162162#define CONFIGURE_MAXIMUM_DRIVERS 2
    163163
  • testsuites/libtests/block05/init.c

    rbb08c0c8 rb6911069  
    517517#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
    518518
    519 #define CONFIGURE_MAXIMUM_TASKS 6
     519#define CONFIGURE_MAXIMUM_TASKS 4
    520520#define CONFIGURE_MAXIMUM_DRIVERS 4
    521521
  • testsuites/libtests/block06/init.c

    rbb08c0c8 rb6911069  
    113113
    114114#define BDBUF_TEST_TASKS (3)
     115
     116#define BDBUF_TEST_STACK_SIZE (2 * RTEMS_MINIMUM_STACK_SIZE)
    115117
    116118/**
     
    650652                                            tc->name[2], tc->name[3]),
    651653                          priority,
    652                           8 * 1024,
     654                          BDBUF_TEST_STACK_SIZE,
    653655                          RTEMS_NO_FLOATING_POINT | RTEMS_LOCAL,
    654656                          RTEMS_PREEMPT | RTEMS_NO_TIMESLICE | RTEMS_NO_ASR,
     
    18431845#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
    18441846
    1845 #define CONFIGURE_MAXIMUM_TASKS 8
     1847#define CONFIGURE_MAXIMUM_TASKS (1 + BDBUF_TEST_TASKS)
    18461848#define CONFIGURE_MAXIMUM_DRIVERS 3
    18471849#define CONFIGURE_MAXIMUM_SEMAPHORES 2
    18481850
    1849 #define CONFIGURE_INIT_TASK_STACK_SIZE (2 * RTEMS_MINIMUM_STACK_SIZE)
    1850 
     1851#define CONFIGURE_EXTRA_TASK_STACKS \
     1852  (BDBUF_TEST_TASKS * BDBUF_TEST_STACK_SIZE)
     1853
     1854#define CONFIGURE_INIT_TASK_STACK_SIZE BDBUF_TEST_STACK_SIZE
    18511855#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
    18521856
  • testsuites/libtests/block07/init.c

    rbb08c0c8 rb6911069  
    263263#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 4
    264264
    265 #define CONFIGURE_MAXIMUM_TASKS 6
     265#define CONFIGURE_MAXIMUM_TASKS 4
    266266#define CONFIGURE_MAXIMUM_DRIVERS 2
    267267
  • testsuites/libtests/block09/init.c

    rbb08c0c8 rb6911069  
    229229#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
    230230
    231 #define CONFIGURE_MAXIMUM_TASKS 3
     231#define CONFIGURE_MAXIMUM_TASKS 1
    232232#define CONFIGURE_MAXIMUM_DRIVERS 4
    233233
  • testsuites/libtests/block10/init.c

    rbb08c0c8 rb6911069  
    474474#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
    475475
    476 #define CONFIGURE_MAXIMUM_TASKS 5
     476#define CONFIGURE_MAXIMUM_TASKS 3
    477477#define CONFIGURE_MAXIMUM_DRIVERS 4
    478478
  • testsuites/libtests/block11/init.c

    rbb08c0c8 rb6911069  
    397397#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 5
    398398
    399 #define CONFIGURE_MAXIMUM_TASKS 2
     399#define CONFIGURE_MAXIMUM_TASKS 1
    400400#define CONFIGURE_MAXIMUM_DRIVERS 2
    401 #define CONFIGURE_EXTRA_TASK_STACKS (8 * 1024)
    402401
    403402#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
  • testsuites/libtests/block12/init.c

    rbb08c0c8 rb6911069  
    143143#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
    144144
    145 #define CONFIGURE_MAXIMUM_TASKS 2
    146 
    147 #define CONFIGURE_EXTRA_TASK_STACKS (8 * 1024)
     145#define CONFIGURE_MAXIMUM_TASKS 1
    148146
    149147#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
Note: See TracChangeset for help on using the changeset viewer.