source: rtems/cpukit/include/rtems/score/schedulerprioritysmp.h @ 21275b58

5
Last change on this file since 21275b58 was 7097962, checked in by Sebastian Huber <sebastian.huber@…>, on 08/29/18 at 07:43:44

score: Add thread pin/unpin support

Add support to temporarily pin a thread to its current processor. This
may be used to access per-processor data structures in critical sections
with enabled thread dispatching, e.g. a pinned thread is allowed to
block.

Update #3508.

  • Property mode set to 100644
File size: 4.5 KB
RevLine 
[99b3505]1/**
2 * @file
3 *
4 * @ingroup ScoreSchedulerPrioritySMP
5 *
6 * @brief Deterministic Priority SMP Scheduler API
7 */
8
9/*
[7097962]10 * Copyright (c) 2013, 2018 embedded brains GmbH.  All rights reserved.
[99b3505]11 *
12 *  embedded brains GmbH
13 *  Dornierstr. 4
14 *  82178 Puchheim
15 *  Germany
16 *  <rtems@embedded-brains.de>
17 *
18 * The license and distribution terms for this file may be
19 * found in the file LICENSE in this distribution or at
[c499856]20 * http://www.rtems.org/license/LICENSE.
[99b3505]21 */
22
23#ifndef _RTEMS_SCORE_SCHEDULERPRIORITYSMP_H
24#define _RTEMS_SCORE_SCHEDULERPRIORITYSMP_H
25
26#include <rtems/score/scheduler.h>
27#include <rtems/score/schedulerpriority.h>
28#include <rtems/score/schedulersmp.h>
29
30#ifdef __cplusplus
31extern "C" {
32#endif /* __cplusplus */
33
34/**
35 * @defgroup ScoreSchedulerPrioritySMP Deterministic Priority SMP Scheduler
36 *
[5b1ff71a]37 * @ingroup ScoreSchedulerSMP
[99b3505]38 *
39 * This is an implementation of the global fixed priority scheduler (G-FP).  It
40 * uses one ready chain per priority to ensure constant time insert operations.
41 * The scheduled chain uses linear insert operations and has at most processor
42 * count entries.  Since the processor and priority count are constants all
43 * scheduler operations complete in a bounded execution time.
44 *
45 * The thread preempt mode will be ignored.
46 *
47 * @{
48 */
49
[beab7329]50/**
51 * @brief Scheduler context specialization for Deterministic Priority SMP
52 * schedulers.
53 */
[e1598a6]54typedef struct {
55  Scheduler_SMP_Context    Base;
56  Priority_bit_map_Control Bit_map;
[beab7329]57  Chain_Control            Ready[ RTEMS_ZERO_LENGTH_ARRAY ];
[e1598a6]58} Scheduler_priority_SMP_Context;
59
[beab7329]60/**
61 * @brief Scheduler node specialization for Deterministic Priority SMP
62 * schedulers.
63 */
64typedef struct {
65  /**
66   * @brief SMP scheduler node.
67   */
68  Scheduler_SMP_Node Base;
69
70  /**
71   * @brief The associated ready queue of this node.
72   */
73  Scheduler_priority_Ready_queue Ready_queue;
74} Scheduler_priority_SMP_Node;
75
[99b3505]76/**
[cfe457f]77 * @brief Entry points for the Priority SMP Scheduler.
[99b3505]78 */
79#define SCHEDULER_PRIORITY_SMP_ENTRY_POINTS \
80  { \
81    _Scheduler_priority_SMP_Initialize, \
[3733b224]82    _Scheduler_default_Schedule, \
[99b3505]83    _Scheduler_priority_SMP_Yield, \
84    _Scheduler_priority_SMP_Block, \
[f39f667a]85    _Scheduler_priority_SMP_Unblock, \
[9bfad8c]86    _Scheduler_priority_SMP_Update_priority, \
[77ff5599]87    _Scheduler_default_Map_priority, \
88    _Scheduler_default_Unmap_priority, \
[351c14d]89    _Scheduler_priority_SMP_Ask_for_help, \
90    _Scheduler_priority_SMP_Reconsider_help_request, \
91    _Scheduler_priority_SMP_Withdraw_node, \
[7097962]92    _Scheduler_default_Pin_or_unpin, \
93    _Scheduler_default_Pin_or_unpin, \
[05ca53d]94    _Scheduler_priority_SMP_Add_processor, \
95    _Scheduler_priority_SMP_Remove_processor, \
[8e467384]96    _Scheduler_priority_SMP_Node_initialize, \
97    _Scheduler_default_Node_destroy, \
[99b3505]98    _Scheduler_default_Release_job, \
[21bdca4]99    _Scheduler_default_Cancel_job, \
[99b3505]100    _Scheduler_default_Tick, \
[bd1431a]101    _Scheduler_SMP_Start_idle \
102    SCHEDULER_OPERATION_DEFAULT_GET_SET_AFFINITY \
[99b3505]103  }
104
[e1598a6]105void _Scheduler_priority_SMP_Initialize( const Scheduler_Control *scheduler );
[99b3505]106
[8e467384]107void _Scheduler_priority_SMP_Node_initialize(
[beab7329]108  const Scheduler_Control *scheduler,
[df2177ab]109  Scheduler_Node          *node,
[9bfad8c]110  Thread_Control          *the_thread,
111  Priority_Control         priority
[beab7329]112);
113
[24934e36]114void _Scheduler_priority_SMP_Block(
[e1598a6]115  const Scheduler_Control *scheduler,
[e382a1b]116  Thread_Control          *thread,
117  Scheduler_Node          *node
[24934e36]118);
[99b3505]119
[ca1e546e]120void _Scheduler_priority_SMP_Unblock(
[e1598a6]121  const Scheduler_Control *scheduler,
[72e0bdb]122  Thread_Control          *thread,
123  Scheduler_Node          *node
[24934e36]124);
[99b3505]125
[9c238e1]126void _Scheduler_priority_SMP_Update_priority(
[e1598a6]127  const Scheduler_Control *scheduler,
[501043a]128  Thread_Control          *the_thread,
129  Scheduler_Node          *node
[24934e36]130);
[99b3505]131
[351c14d]132bool _Scheduler_priority_SMP_Ask_for_help(
133  const Scheduler_Control *scheduler,
134  Thread_Control          *the_thread,
135  Scheduler_Node          *node
136);
137
138void _Scheduler_priority_SMP_Reconsider_help_request(
139  const Scheduler_Control *scheduler,
140  Thread_Control          *the_thread,
141  Scheduler_Node          *node
142);
143
144void _Scheduler_priority_SMP_Withdraw_node(
145  const Scheduler_Control *scheduler,
146  Thread_Control          *the_thread,
147  Scheduler_Node          *node,
148  Thread_Scheduler_state   next_state
149);
150
[05ca53d]151void _Scheduler_priority_SMP_Add_processor(
152  const Scheduler_Control *scheduler,
153  Thread_Control          *idle
154);
155
156Thread_Control *_Scheduler_priority_SMP_Remove_processor(
157  const Scheduler_Control *scheduler,
158  struct Per_CPU_Control  *cpu
159);
160
[ca1e546e]161void _Scheduler_priority_SMP_Yield(
[e1598a6]162  const Scheduler_Control *scheduler,
[2df4abc]163  Thread_Control          *thread,
164  Scheduler_Node          *node
[24934e36]165);
[99b3505]166
167/** @} */
168
169#ifdef __cplusplus
170}
171#endif /* __cplusplus */
172
173#endif /* _RTEMS_SCORE_SCHEDULERPRIORITYSMP_H */
Note: See TracBrowser for help on using the repository browser.