Changeset e27421f in rtems


Ignore:
Timestamp:
Aug 1, 2016, 9:12:52 AM (3 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
15b5678d
Parents:
1f210ac1
git-author:
Sebastian Huber <sebastian.huber@…> (08/01/16 09:12:52)
git-committer:
Sebastian Huber <sebastian.huber@…> (09/08/16 07:55:27)
Message:

score: Move scheduler node to own header file

This makes it possible to add scheduler nodes to structures defined in
<rtems/score/thread.h>.

Update #2556.

Location:
cpukit/score
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/Makefile.am

    r1f210ac1 re27421f  
    7373include_rtems_score_HEADERS += include/rtems/score/scheduleredf.h
    7474include_rtems_score_HEADERS += include/rtems/score/scheduleredfimpl.h
     75include_rtems_score_HEADERS += include/rtems/score/schedulernode.h
    7576include_rtems_score_HEADERS += include/rtems/score/schedulerpriority.h
    7677include_rtems_score_HEADERS += include/rtems/score/schedulerpriorityimpl.h
  • cpukit/score/include/rtems/score/scheduler.h

    r1f210ac1 re27421f  
    2020#define _RTEMS_SCORE_SCHEDULER_H
    2121
    22 #include <rtems/score/priority.h>
    23 #include <rtems/score/smplockseq.h>
    2422#include <rtems/score/thread.h>
    2523#if defined(__RTEMS_HAVE_SYS_CPUSET_H__) && defined(RTEMS_SMP)
     
    4442
    4543typedef struct Scheduler_Control Scheduler_Control;
    46 
    47 typedef struct Scheduler_Node Scheduler_Node;
    4844
    4945#if defined(RTEMS_SMP)
     
    222218   */
    223219  uint32_t name;
    224 };
    225 
    226 #if defined(RTEMS_SMP)
    227 /**
    228  * @brief State to indicate potential help for other threads.
    229  *
    230  * @dot
    231  * digraph state {
    232  *   y [label="HELP YOURSELF"];
    233  *   ao [label="HELP ACTIVE OWNER"];
    234  *   ar [label="HELP ACTIVE RIVAL"];
    235  *
    236  *   y -> ao [label="obtain"];
    237  *   y -> ar [label="wait for obtain"];
    238  *   ao -> y [label="last release"];
    239  *   ao -> r [label="wait for obtain"];
    240  *   ar -> r [label="timeout"];
    241  *   ar -> ao [label="timeout"];
    242  * }
    243  * @enddot
    244  */
    245 typedef enum {
    246   /**
    247    * @brief This scheduler node is solely used by the owner thread.
    248    *
    249    * This thread owns no resources using a helping protocol and thus does not
    250    * take part in the scheduler helping protocol.  No help will be provided for
    251    * other thread.
    252    */
    253   SCHEDULER_HELP_YOURSELF,
    254 
    255   /**
    256    * @brief This scheduler node is owned by a thread actively owning a resource.
    257    *
    258    * This scheduler node can be used to help out threads.
    259    *
    260    * In case this scheduler node changes its state from ready to scheduled and
    261    * the thread executes using another node, then an idle thread will be
    262    * provided as a user of this node to temporarily execute on behalf of the
    263    * owner thread.  Thus lower priority threads are denied access to the
    264    * processors of this scheduler instance.
    265    *
    266    * In case a thread actively owning a resource performs a blocking operation,
    267    * then an idle thread will be used also in case this node is in the
    268    * scheduled state.
    269    */
    270   SCHEDULER_HELP_ACTIVE_OWNER,
    271 
    272   /**
    273    * @brief This scheduler node is owned by a thread actively obtaining a
    274    * resource currently owned by another thread.
    275    *
    276    * This scheduler node can be used to help out threads.
    277    *
    278    * The thread owning this node is ready and will give away its processor in
    279    * case the thread owning the resource asks for help.
    280    */
    281   SCHEDULER_HELP_ACTIVE_RIVAL,
    282 
    283   /**
    284    * @brief This scheduler node is owned by a thread obtaining a
    285    * resource currently owned by another thread.
    286    *
    287    * This scheduler node can be used to help out threads.
    288    *
    289    * The thread owning this node is blocked.
    290    */
    291   SCHEDULER_HELP_PASSIVE
    292 } Scheduler_Help_state;
    293 #endif
    294 
    295 /**
    296  * @brief Scheduler node for per-thread data.
    297  */
    298 struct Scheduler_Node {
    299 #if defined(RTEMS_SMP)
    300   /**
    301    * @brief Chain node for usage in various scheduler data structures.
    302    *
    303    * Strictly this is the wrong place for this field since the data structures
    304    * to manage scheduler nodes belong to the particular scheduler
    305    * implementation.  Currently all SMP scheduler implementations use chains.
    306    * The node is here to simplify things, just like the object node in the
    307    * thread control block.  It may be replaced with a union to add a red-black
    308    * tree node in the future.
    309    */
    310   Chain_Node Node;
    311 
    312   /**
    313    * @brief The thread using this node.
    314    */
    315   Thread_Control *user;
    316 
    317   /**
    318    * @brief The help state of this node.
    319    */
    320   Scheduler_Help_state help_state;
    321 
    322   /**
    323    * @brief The thread owning this node.
    324    */
    325   Thread_Control *owner;
    326 
    327   /**
    328    * @brief The idle thread claimed by this node in case the help state is
    329    * SCHEDULER_HELP_ACTIVE_OWNER.
    330    *
    331    * Active owners will lend their own node to an idle thread in case they
    332    * execute currently using another node or in case they perform a blocking
    333    * operation.  This is necessary to ensure the priority ceiling protocols
    334    * work across scheduler boundaries.
    335    */
    336   Thread_Control *idle;
    337 
    338   /**
    339    * @brief The thread accepting help by this node in case the help state is
    340    * not SCHEDULER_HELP_YOURSELF.
    341    */
    342   Thread_Control *accepts_help;
    343 #endif
    344 
    345   /**
    346    * @brief The thread priority information used by the scheduler.
    347    *
    348    * The thread priority is manifest in two independent areas.  One area is the
    349    * user visible thread priority along with a potential thread queue.  The
    350    * other is the scheduler.  During a thread priority change, the user visible
    351    * thread priority and the thread queue are first updated and the thread
    352    * priority value here is changed.  Once this is done the scheduler is
    353    * notified via the update priority operation, so that it can update its
    354    * internal state and honour a new thread priority value.
    355    */
    356   struct {
    357     /**
    358      * @brief The thread priority value of this scheduler node.
    359      *
    360      * The producer of this value is _Thread_Change_priority().  The consumer
    361      * is the scheduler via the unblock and update priority operations.
    362      */
    363     Priority_Control value;
    364 
    365 #if defined(RTEMS_SMP)
    366     /**
    367      * @brief Sequence lock to synchronize priority value updates.
    368      */
    369     SMP_sequence_lock_Control Lock;
    370 #endif
    371 
    372     /**
    373      * @brief In case a priority update is necessary and this is true, then
    374      * enqueue the thread as the first of its priority group, otherwise enqueue
    375      * the thread as the last of its priority group.
    376      */
    377     bool prepend_it;
    378   } Priority;
    379220};
    380221
  • cpukit/score/include/rtems/score/thread.h

    r1f210ac1 re27421f  
    3131#include <rtems/score/priority.h>
    3232#include <rtems/score/resource.h>
     33#include <rtems/score/schedulernode.h>
    3334#include <rtems/score/stack.h>
    3435#include <rtems/score/states.h>
     
    4647
    4748struct Scheduler_Control;
    48 
    49 struct Scheduler_Node;
    5049
    5150struct User_extensions_Iterator;
     
    654653   * priority and ask for help operations.
    655654   */
    656   struct Scheduler_Node *own_node;
     655  Scheduler_Node *own_node;
    657656#endif
    658657
     
    666665   * field.
    667666   */
    668   struct Scheduler_Node *node;
     667  Scheduler_Node *node;
    669668
    670669#if defined(RTEMS_SMP)
  • cpukit/score/preinstall.am

    r1f210ac1 re27421f  
    256256        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/scheduleredfimpl.h
    257257PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/scheduleredfimpl.h
     258
     259$(PROJECT_INCLUDE)/rtems/score/schedulernode.h: include/rtems/score/schedulernode.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
     260        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/schedulernode.h
     261PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/schedulernode.h
    258262
    259263$(PROJECT_INCLUDE)/rtems/score/schedulerpriority.h: include/rtems/score/schedulerpriority.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
Note: See TracChangeset for help on using the changeset viewer.