source: rtems/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h @ beab7329

4.115
Last change on this file since beab7329 was beab7329, checked in by Sebastian Huber <sebastian.huber@…>, on 05/13/14 at 14:03:05

score: Introduce scheduler nodes

Rename scheduler per-thread information into scheduler nodes using
Scheduler_Node as the base type. Use inheritance for specialized
schedulers.

Move the scheduler specific states from the thread control block into
the scheduler node structure.

Validate the SMP scheduler node state transitions in case RTEMS_DEBUG is
defined.

  • Property mode set to 100644
File size: 4.1 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup ScoreSchedulerPriorityAffinitySMP
5 *
6 * @brief Deterministic Priority Affinity SMP Scheduler API
7 */
8
9/*
10 *  COPYRIGHT (c) 2014.
11 *  On-Line Applications Research Corporation (OAR).
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.rtems.org/license/LICENSE.
16 */
17
18#ifndef _RTEMS_SCORE_SCHEDULERPRIORITYAFFINITYSMP_H
19#define _RTEMS_SCORE_SCHEDULERPRIORITYAFFINITYSMP_H
20
21#include <rtems/score/scheduler.h>
22#include <rtems/score/schedulerpriority.h>
23#include <rtems/score/schedulersmp.h>
24#include <rtems/score/schedulerprioritysmp.h>
25#include <rtems/score/cpuset.h>
26
27#ifdef __cplusplus
28extern "C" {
29#endif /* __cplusplus */
30
31/**
32 * @defgroup ScoreSchedulerPriorityAffinitySMP Deterministic Priority Affinity SMP Scheduler
33 *
34 * @ingroup ScoreSchedulerPrioritySMP
35 *
36 * This is an extension of the Deterministic Priority SMP Scheduler. which
37 * is an implementation of the global fixed priority scheduler (G-FP).
38 * It adds thread to core affinity support.
39 *
40 * @note This is the first iteration of this scheduler. It currently tracks
41 *       the requested affinity to exercise the Scheduler Framework but it
42 *       does not honor that affinity in assigning threads to cores. This
43 *       will be added in a subsequent revision.
44 * @{
45 */
46
47/**
48 * @brief Entry points for the Deterministic Priority Affinity SMP Scheduler.
49 */
50#define SCHEDULER_PRIORITY_AFFINITY_SMP_ENTRY_POINTS \
51  { \
52    _Scheduler_priority_SMP_Initialize, \
53    _Scheduler_priority_SMP_Schedule, \
54    _Scheduler_priority_SMP_Yield, \
55    _Scheduler_priority_SMP_Block, \
56    _Scheduler_priority_SMP_Enqueue_fifo, \
57    _Scheduler_priority_affinity_SMP_Allocate, \
58    _Scheduler_default_Free, \
59    _Scheduler_priority_SMP_Update, \
60    _Scheduler_priority_SMP_Enqueue_fifo, \
61    _Scheduler_priority_SMP_Enqueue_lifo, \
62    _Scheduler_priority_SMP_Extract, \
63    _Scheduler_priority_Priority_compare, \
64    _Scheduler_default_Release_job, \
65    _Scheduler_default_Tick, \
66    _Scheduler_priority_SMP_Start_idle, \
67    _Scheduler_priority_affinity_SMP_Get_affinity, \
68    _Scheduler_priority_affinity_SMP_Set_affinity \
69  }
70
71/**
72 *  @brief Allocates @a the_thread->scheduler.
73 *
74 *  This routine allocates @a the_thread->scheduler.
75 *
76 *  @param[in] scheduler points to the scheduler specific information.
77 *  @param[in] the_thread is the thread the scheduler is allocating
78 *             management memory for.
79 */
80bool _Scheduler_priority_affinity_SMP_Allocate(
81  const Scheduler_Control *scheduler,
82  Thread_Control          *the_thread
83);
84
85/**
86 * @brief Get affinity for the priority affinity smp scheduler.
87 *
88 * @param[in] scheduler The scheduler of the thread.
89 * @param[in] thread The associated thread.
90 * @param[in] cpusetsize The size of the cpuset.
91 * @param[in,out] cpuset The associated affinity set.
92 *
93 * @retval 0 Successfully got cpuset
94 * @retval -1 The cpusetsize is invalid for the system
95 */
96bool _Scheduler_priority_affinity_SMP_Get_affinity(
97  const Scheduler_Control *scheduler,
98  Thread_Control          *thread,
99  size_t                   cpusetsize,
100  cpu_set_t               *cpuset
101);
102
103/**
104 * @brief Set affinity for the priority affinity smp scheduler.
105 *
106 * @param[in] scheduler The scheduler of the thread.
107 * @param[in] thread The associated thread.
108 * @param[in] cpusetsize The size of the cpuset.
109 * @param[in] cpuset Affinity new affinity set.
110 *
111 * @retval 0 Successful
112 */
113bool _Scheduler_priority_affinity_SMP_Set_affinity(
114  const Scheduler_Control *scheduler,
115  Thread_Control          *thread,
116  size_t                   cpusetsize,
117  cpu_set_t               *cpuset
118);
119
120/**
121 * @brief Scheduler node specialization for Deterministic Priority Affinity SMP
122 * schedulers.
123 */
124typedef struct {
125  /**
126   * @brief SMP priority scheduler node.
127   */
128  Scheduler_priority_SMP_Node Base;
129
130  /**
131   * Structure containing affinity set data and size
132   */
133  CPU_set_Control Affinity;
134} Scheduler_priority_affinity_SMP_Node;
135
136/** @} */
137
138#ifdef __cplusplus
139}
140#endif /* __cplusplus */
141
142#endif /* _RTEMS_SCORE_SCHEDULERPRIORITYSMP_H */
Note: See TracBrowser for help on using the repository browser.