Changeset 1d40d81b in rtems


Ignore:
Timestamp:
May 3, 2016, 5:38:19 AM (3 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
0ab4fb7
Parents:
159b637
git-author:
Sebastian Huber <sebastian.huber@…> (05/03/16 05:38:19)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/04/16 05:24:30)
Message:

rtems: Remove task variables

Update #2494.
Update #2555.

Files:
8 deleted
11 edited

Legend:

Unmodified
Added
Removed
  • c/src/ada/rtems-tasks.adb

    r159b637 r1d40d81b  
    204204   end Mode;
    205205
    206    procedure Variable_Add
    207      (ID            : in RTEMS.ID;
    208       Task_Variable : in RTEMS.Address;
    209       Dtor          : in Variable_Dtor;
    210       Result        : out RTEMS.Status_Codes)
    211    is
    212       function Variable_Add_Base
    213         (ID            : RTEMS.ID;
    214          Task_Variable : RTEMS.Address;
    215          Dtor          : Variable_Dtor)
    216          return          RTEMS.Status_Codes;
    217       pragma Import (C, Variable_Add_Base, "rtems_task_variable_add");
    218    begin
    219 
    220       Result := Variable_Add_Base (ID, Task_Variable, Dtor);
    221 
    222    end Variable_Add;
    223 
    224    procedure Variable_Get
    225      (ID                  : in RTEMS.ID;
    226       Task_Variable       : out RTEMS.Address;
    227       Task_Variable_Value : out RTEMS.Address;
    228       Result              : out RTEMS.Status_Codes)
    229    is
    230       function Variable_Get_Base
    231         (ID                  : RTEMS.ID;
    232          Task_Variable       : access RTEMS.Address;
    233          Task_Variable_Value : access RTEMS.Address)
    234          return                RTEMS.Status_Codes;
    235       pragma Import (C, Variable_Get_Base, "rtems_task_variable_get");
    236       Task_Variable_Base       : aliased RTEMS.Address;
    237       Task_Variable_Value_Base : aliased RTEMS.Address;
    238    begin
    239 
    240       Result              :=
    241          Variable_Get_Base
    242            (ID,
    243             Task_Variable_Base'Access,
    244             Task_Variable_Value_Base'Access);
    245       Task_Variable       := Task_Variable_Base;
    246       Task_Variable_Value := Task_Variable_Value_Base;
    247 
    248    end Variable_Get;
    249 
    250    procedure Variable_Delete
    251      (ID            : in RTEMS.ID;
    252       Task_Variable : out RTEMS.Address;
    253       Result        : out RTEMS.Status_Codes)
    254    is
    255       function Variable_Delete_Base
    256         (ID            : RTEMS.ID;
    257          Task_Variable : access RTEMS.Address)
    258          return          RTEMS.Status_Codes;
    259       pragma Import
    260         (C,
    261          Variable_Delete_Base,
    262          "rtems_task_variable_delete");
    263       Task_Variable_Base : aliased RTEMS.Address;
    264    begin
    265 
    266       Result        := Variable_Delete_Base (ID, Task_Variable_Base'Access);
    267       Task_Variable := Task_Variable_Base;
    268 
    269    end Variable_Delete;
    270 
    271206   procedure Wake_When
    272207     (Time_Buffer : in RTEMS.Time_Of_Day;
  • c/src/ada/rtems-tasks.ads

    r159b637 r1d40d81b  
    118118   );
    119119
    120    type Variable_Dtor is access procedure (
    121       Argument : in     RTEMS.Address
    122    );
    123    pragma Convention (C, Variable_Dtor);
    124 
    125    procedure Variable_Add (
    126       ID            : in     RTEMS.ID;
    127       Task_Variable : in     RTEMS.Address;
    128       Dtor          : in     Variable_Dtor;
    129       Result        :    out RTEMS.Status_Codes
    130    );
    131 
    132    procedure Variable_Get (
    133       ID                  : in     RTEMS.ID;
    134       Task_Variable       :    out RTEMS.Address;
    135       Task_Variable_Value :    out RTEMS.Address;
    136       Result              :    out RTEMS.Status_Codes
    137    );
    138 
    139    procedure Variable_Delete (
    140       ID                  : in     RTEMS.ID;
    141       Task_Variable       :    out RTEMS.Address;
    142       Result              :    out RTEMS.Status_Codes
    143    );
    144 
    145120   procedure Wake_When (
    146121      Time_Buffer : in     RTEMS.Time_Of_Day;
  • cpukit/rtems/Makefile.am

    r159b637 r1d40d81b  
    105105librtems_a_SOURCES += src/taskwakeafter.c
    106106librtems_a_SOURCES += src/taskwakewhen.c
    107 if HAS_SMP
    108 else
    109 librtems_a_SOURCES += src/taskvariableadd.c
    110 librtems_a_SOURCES += src/taskvariabledelete.c
    111 librtems_a_SOURCES += src/taskvariableget.c
    112 librtems_a_SOURCES += src/taskvariable_invoke_dtor.c
    113 endif
    114107librtems_a_SOURCES += src/schedulergetprocessorset.c
    115108librtems_a_SOURCES += src/schedulerident.c
  • cpukit/rtems/include/rtems/rtems/tasks.h

    r159b637 r1d40d81b  
    373373);
    374374
    375 #if !defined(RTEMS_SMP)
    376 /**
    377  *  @brief RTEMS Add Task Variable
    378  *
    379  *  @deprecated Task variables are deprecated.
    380  *
    381  *  This directive adds a per task variable.
    382  *
    383  *  @note This service is not available in SMP configurations.
    384  */
    385 rtems_status_code rtems_task_variable_add(
    386   rtems_id  tid,
    387   void    **ptr,
    388   void    (*dtor)(void *)
    389 ) RTEMS_DEPRECATED;
    390 
    391 /**
    392  *  @brief Get a per-task variable
    393  *
    394  *  @deprecated Task variables are deprecated.
    395  *
    396  *  This directive gets the value of a task variable.
    397  *
    398  *  @note This service is not available in SMP configurations.
    399  */
    400 rtems_status_code rtems_task_variable_get(
    401   rtems_id tid,
    402   void **ptr,
    403   void **result
    404 ) RTEMS_DEPRECATED;
    405 
    406 /**
    407  *  @brief RTEMS Delete Task Variable
    408  *
    409  *  @deprecated Task variables are deprecated.
    410  *
    411  *  This directive removes a per task variable.
    412  *
    413  *  @note This service is not available in SMP configurations.
    414  */
    415 rtems_status_code rtems_task_variable_delete(
    416   rtems_id  tid,
    417   void    **ptr
    418 ) RTEMS_DEPRECATED;
    419 #endif
    420 
    421375#if defined(__RTEMS_HAVE_SYS_CPUSET_H__)
    422376/**
  • cpukit/rtems/include/rtems/rtems/tasksimpl.h

    r159b637 r1d40d81b  
    4747 */
    4848void _RTEMS_tasks_Initialize_user_tasks( void );
    49 
    50 #if !defined(RTEMS_SMP)
    51 /**
    52  *  @brief RTEMS Tasks Invoke Task Variable Destructor
    53  *
    54  *  @deprecated Task variables are deprecated.
    55  *
    56  *  This routine invokes the optional user provided destructor on the
    57  *  task variable and frees the memory for the task variable.
    58  */
    59 void _RTEMS_Tasks_Invoke_task_variable_dtor(
    60   Thread_Control        *the_thread,
    61   rtems_task_variable_t *tvp
    62 ) RTEMS_DEPRECATED;
    63 #endif
    6449
    6550RTEMS_INLINE_ROUTINE Thread_Control *_RTEMS_tasks_Allocate(void)
  • cpukit/rtems/mainpage.h

    r159b637 r1d40d81b  
    857857 * @section ClassicTasksSecPerTaskVariables Per Task Variables
    858858 *
    859  * Per task variables are used to support global variables whose value may be
    860  * unique to a task. After indicating that a variable should be treated as
    861  * private (i.e. per-task) the task can access and modify the variable, but the
    862  * modifications will not appear to other tasks, and other tasks' modifications
    863  * to that variable will not affect the value seen by the task. This is
    864  * accomplished by saving and restoring the variable's value each time a task
    865  * switch occurs to or from the calling task.
    866  *
    867  * The value seen by other tasks, including those which have not added the
    868  * variable to their set and are thus accessing the variable as a common
    869  * location shared among tasks, can not be affected by a task once it has added
    870  * a variable to its local set. Changes made to the variable by other tasks
    871  * will not affect the value seen by a task which has added the variable to its
    872  * private set.
    873  *
    874  * This feature can be used when a routine is to be spawned repeatedly as
    875  * several independent tasks. Although each task will have its own stack, and
    876  * thus separate stack variables, they will all share the same static and
    877  * global variables. To make a variable not shareable (i.e. a "global" variable
    878  * that is specific to a single task), the tasks can call
    879  * rtems_task_variable_add() to make a separate copy of the variable for each
    880  * task, but all at the same physical address.
    881  *
    882  * Task variables increase the context switch time to and from the tasks that
    883  * own them so it is desirable to minimize the number of task variables. One
    884  * efficient method is to have a single task variable that is a pointer to a
    885  * dynamically allocated structure containing the task's private "global" data.
    886  *
    887  * A critical point with per-task variables is that each task must separately
    888  * request that the same global variable is per-task private.
    889  *
    890  * @b {WARNING}: Per-task variables are fundamentally incorrect in SMP
    891  *               systems and should not be used in SMP applications. They
    892  *               are disabled.
     859 * Per task variables are no longer available.  In particular the
     860 * rtems_task_variable_add(), rtems_task_variable_get() and
     861 * rtems_task_variable_delete() functions are neither declared nor defined
     862 * anymore.  Use thread local storage or POSIX Keys instead.
    893863 *
    894864 * @section ClassicTasksSecBuildingTaskAttributeSet Building a Task Attribute Set
  • cpukit/rtems/src/tasks.c

    r159b637 r1d40d81b  
    1919#endif
    2020
    21 #include <rtems/system.h>
    2221#include <rtems/config.h>
    2322#include <rtems/sysinit.h>
    2423#include <rtems/rtems/asrimpl.h>
    2524#include <rtems/rtems/eventimpl.h>
    26 #include <rtems/rtems/signalimpl.h>
    27 #include <rtems/rtems/status.h>
    28 #include <rtems/rtems/support.h>
    29 #include <rtems/rtems/modes.h>
    3025#include <rtems/rtems/tasksimpl.h>
    31 #include <rtems/score/stack.h>
    3226#include <rtems/score/threadimpl.h>
    3327#include <rtems/score/userextimpl.h>
    34 #include <rtems/score/wkspace.h>
    3528
    3629Thread_Information _RTEMS_tasks_Information;
     
    9285}
    9386
    94 static void _RTEMS_tasks_Terminate_extension(
    95   Thread_Control *executing
    96 )
    97 {
    98   /*
    99    *  Free per task variable memory
    100    *
    101    *  Per Task Variables are only enabled in uniprocessor configurations.
    102    */
    103   #if !defined(RTEMS_SMP)
    104     /*
    105      * We know this is deprecated and don't want a warning on every BSP built.
    106      */
    107     #pragma GCC diagnostic push
    108     #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
    109     do {
    110       rtems_task_variable_t *tvp, *next;
    111 
    112       tvp = executing->task_variables;
    113       executing->task_variables = NULL;
    114       while (tvp) {
    115         next = (rtems_task_variable_t *)tvp->next;
    116         _RTEMS_Tasks_Invoke_task_variable_dtor( executing, tvp );
    117         tvp = next;
    118       }
    119     } while (0);
    120     #pragma GCC diagnostic pop
    121   #endif
    122 }
    123 
    124 #if !defined(RTEMS_SMP)
    125 /*
    126  *  _RTEMS_tasks_Switch_extension
    127  *
    128  *  This extension routine is invoked at each context switch.
    129  *
    130  *  @note Since this only needs to address per-task variables, it is
    131  *        disabled entirely for SMP configurations.
    132  */
    133 static void _RTEMS_tasks_Switch_extension(
    134   Thread_Control *executing,
    135   Thread_Control *heir
    136 )
    137 {
    138   rtems_task_variable_t *tvp;
    139 
    140   /*
    141    *  Per Task Variables are only enabled in uniprocessor configurations
    142    */
    143 
    144   tvp = executing->task_variables;
    145   while (tvp) {
    146     tvp->tval = *tvp->ptr;
    147     *tvp->ptr = tvp->gval;
    148     tvp = (rtems_task_variable_t *)tvp->next;
    149   }
    150 
    151   tvp = heir->task_variables;
    152   while (tvp) {
    153     tvp->gval = *tvp->ptr;
    154     *tvp->ptr = tvp->tval;
    155     tvp = (rtems_task_variable_t *)tvp->next;
    156   }
    157 }
    158 #define RTEMS_TASKS_SWITCH_EXTENSION _RTEMS_tasks_Switch_extension
    159 #else
    160 #define RTEMS_TASKS_SWITCH_EXTENSION NULL
    161 #endif
    162 
    16387User_extensions_Control _RTEMS_tasks_User_extensions = {
    164   { NULL, NULL },
    165   { { NULL, NULL }, RTEMS_TASKS_SWITCH_EXTENSION },
    166   { _RTEMS_tasks_Create_extension,            /* create */
    167     _RTEMS_tasks_Start_extension,             /* start */
    168     _RTEMS_tasks_Start_extension,             /* restart */
    169     _RTEMS_tasks_Delete_extension,            /* delete */
    170     RTEMS_TASKS_SWITCH_EXTENSION,             /* switch */
    171     NULL,                                     /* begin */
    172     NULL,                                     /* exitted */
    173     NULL,                                     /* fatal */
    174     _RTEMS_tasks_Terminate_extension          /* terminate */
     88  .Callouts = {
     89    .thread_create  = _RTEMS_tasks_Create_extension,
     90    .thread_start   = _RTEMS_tasks_Start_extension,
     91    .thread_restart = _RTEMS_tasks_Start_extension,
     92    .thread_delete  = _RTEMS_tasks_Delete_extension
    17593  }
    17694};
  • cpukit/sapi/include/confdefs.h

    r159b637 r1d40d81b  
    21012101    (CONFIGURE_MAXIMUM_TASKS + CONFIGURE_LIBBLOCK_TASKS)
    21022102
    2103   /**
    2104    * This macro calculates the memory required for task variables.
    2105    *
    2106    * @deprecated Task variables are deprecated.
    2107    *
    2108    * Each task variable is individually allocated from the Workspace.
    2109    * Hence, we do the multiplication on the configured size.
    2110    *
    2111    * @note Per-task variables are disabled for SMP configurations.
    2112    */
    2113   #if defined(RTEMS_SMP)
    2114     #ifdef CONFIGURE_MAXIMUM_TASK_VARIABLES
    2115       #warning "Per-Task Variables are deprecated and will be removed."
    2116       #error "Per-Task Variables are not safe for SMP systems and disabled."
    2117     #endif
    2118     #define CONFIGURE_MAXIMUM_TASK_VARIABLES                     0
    2119     #define CONFIGURE_MEMORY_FOR_TASK_VARIABLES(_task_variables) 0
    2120   #else
    2121     #ifndef CONFIGURE_MAXIMUM_TASK_VARIABLES
    2122       /** This macro specifies the maximum number of task variables. */
    2123       #define CONFIGURE_MAXIMUM_TASK_VARIABLES                     0
    2124       /**
    2125        * This macro is calculated to specify the memory required for task
    2126        * variables.
    2127        *
    2128        * This is an internal parameter.
    2129        */
    2130       #define CONFIGURE_MEMORY_FOR_TASK_VARIABLES(_task_variables) 0
    2131     #else
    2132       #warning "Per-Task Variables are deprecated and will be removed."
    2133       #define CONFIGURE_MEMORY_FOR_TASK_VARIABLES(_task_variables) \
    2134         (_task_variables) * \
    2135            _Configure_From_workspace(sizeof(rtems_task_variable_t))
    2136     #endif
    2137   #endif
    2138 
    21392103  #ifndef CONFIGURE_MAXIMUM_TIMERS
    21402104    /** This specifies the maximum number of Classic API timers. */
     
    28192783  #endif
    28202784
    2821   #define CONFIGURE_GOROUTINES_TASK_VARIABLES \
    2822     (2 * CONFIGURE_MAXIMUM_GOROUTINES)
    2823 
    28242785  #ifndef CONFIGURE_MAXIMUM_GO_CHANNELS
    28252786    #define CONFIGURE_MAXIMUM_GO_CHANNELS 500
     
    28452806  /** This specifies the maximum number of Go co-routines. */
    28462807  #define CONFIGURE_MAXIMUM_GOROUTINES          0
    2847 
    2848   /** This specifies the maximum number of Go per-task variables required. */
    2849   #define CONFIGURE_GOROUTINES_TASK_VARIABLES   0
    28502808
    28512809  /** This specifies the maximum number of Go channels required. */
     
    30693027 */
    30703028#define CONFIGURE_MEMORY_FOR_CLASSIC \
    3071   (CONFIGURE_MEMORY_FOR_TASK_VARIABLES(CONFIGURE_MAXIMUM_TASK_VARIABLES + \
    3072     CONFIGURE_GOROUTINES_TASK_VARIABLES) + \
    3073    CONFIGURE_MEMORY_FOR_TIMERS(CONFIGURE_MAXIMUM_TIMERS + \
     3029   (CONFIGURE_MEMORY_FOR_TIMERS(CONFIGURE_MAXIMUM_TIMERS + \
    30743030    CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER ) + \
    30753031   CONFIGURE_MEMORY_FOR_SEMAPHORES(CONFIGURE_SEMAPHORES) + \
     
    35823538    /* Classic API Pieces */
    35833539    uint32_t CLASSIC_TASKS;
    3584     uint32_t TASK_VARIABLES;
    35853540    uint32_t TIMERS;
    35863541    uint32_t SEMAPHORES;
     
    36363591    /* Classic API Pieces */
    36373592    CONFIGURE_MEMORY_FOR_TASKS(CONFIGURE_MAXIMUM_TASKS, 0),
    3638     CONFIGURE_MEMORY_FOR_TASK_VARIABLES(CONFIGURE_MAXIMUM_TASK_VARIABLES +
    3639       CONFIGURE_GOROUTINES_TASK_VARIABLES),
    36403593    CONFIGURE_MEMORY_FOR_TIMERS(CONFIGURE_MAXIMUM_TIMERS),
    36413594    CONFIGURE_MEMORY_FOR_SEMAPHORES(CONFIGURE_SEMAPHORES),
  • cpukit/score/include/rtems/score/thread.h

    r159b637 r1d40d81b  
    173173 */
    174174typedef void (*Thread_CPU_budget_algorithm_callout )( Thread_Control * );
    175 
    176 #if !defined(RTEMS_SMP)
    177 /**
    178  *  @brief Forward reference to the per task variable structure..
    179  *
    180  *  Forward reference to the per task variable structure.
    181  */
    182 struct rtems_task_variable_tt;
    183 
    184 /**
    185  *  @brief Internal structure used to manager per task variables.
    186  *
    187  *  This is the internal structure used to manager per Task Variables.
    188  */
    189 typedef struct {
    190   /** This field points to the next per task variable for this task. */
    191   struct rtems_task_variable_tt  *next;
    192   /** This field points to the physical memory location of this per
    193    *  task variable.
    194    */
    195   void                          **ptr;
    196   /** This field is to the global value for this per task variable. */
    197   void                           *gval;
    198   /** This field is to this thread's value for this per task variable. */
    199   void                           *tval;
    200   /** This field points to the destructor for this per task variable. */
    201   void                          (*dtor)(void *);
    202 } rtems_task_variable_t;
    203 #endif
    204175
    205176/**
     
    871842  void                                 *API_Extensions[ THREAD_API_LAST + 1 ];
    872843
    873 #if !defined(RTEMS_SMP)
    874   /** This field points to the set of per task variables. */
    875   rtems_task_variable_t                *task_variables;
    876 #endif
    877 
    878844  /**
    879845   * @brief The POSIX Keys information.
  • testsuites/psxtests/psxconfig01/init.c

    r159b637 r1d40d81b  
    5858#define CONFIGURE_MAXIMUM_SEMAPHORES 47
    5959#define CONFIGURE_MAXIMUM_TASKS 11
    60 #if !defined(RTEMS_SMP)
    61   #define CONFIGURE_MAXIMUM_TASK_VARIABLES 13
    62 #endif
    6360#define CONFIGURE_MAXIMUM_TIMERS 59
    6461#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 17
     
    203200static char posix_name [_POSIX_PATH_MAX + 1];
    204201
    205 #if !defined(RTEMS_SMP)
    206   static void *task_var;
    207 #endif
    208 
    209202static char *get_posix_name(char a, char b, char c, int i)
    210203{
     
    216209  return posix_name;
    217210}
    218 
    219 #if !defined(RTEMS_SMP)
    220 static void task_var_dtor(void *var RTEMS_UNUSED)
    221 {
    222   /* Do nothing */
    223 }
    224 #endif
    225211
    226212static void *posix_thread(void *arg RTEMS_UNUSED)
     
    436422#endif
    437423
    438 #if !defined(RTEMS_SMP)
    439 #ifdef CONFIGURE_MAXIMUM_TASK_VARIABLES
    440   /*
    441    * We know this is deprecated and don't want a warning on every BSP built.
    442    */
    443   #pragma GCC diagnostic push
    444   #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
    445     for (i = 0; i < CONFIGURE_MAXIMUM_TASK_VARIABLES; ++i) {
    446       sc = rtems_task_variable_add(RTEMS_SELF, &task_var, task_var_dtor);
    447       directive_failed(sc, "rtems_task_variable_add");
    448     }
    449   #pragma GCC diagnostic pop
    450 #endif
    451 #endif
    452 
    453424#ifdef CONFIGURE_MAXIMUM_TIMERS
    454425  for (i = 0; i < CONFIGURE_MAXIMUM_TIMERS; ++i) {
  • testsuites/sptests/configure.ac

    r159b637 r1d40d81b  
    108108sp27/Makefile
    109109sp27a/Makefile
    110 sp28/Makefile
    111110sp29/Makefile
    112111sp30/Makefile
Note: See TracChangeset for help on using the changeset viewer.