Changeset f39f667a in rtems
- Timestamp:
- 05/14/14 11:50:48 (10 years ago)
- Branches:
- 4.11, 5, master
- Children:
- 3733b224
- Parents:
- 2369b10
- git-author:
- Sebastian Huber <sebastian.huber@…> (05/14/14 11:50:48)
- git-committer:
- Sebastian Huber <sebastian.huber@…> (05/15/14 10:18:44)
- Files:
-
- 1 added
- 14 deleted
- 32 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
cpukit/libmisc/capture/capture.c
r2369b10 rf39f667a 914 914 915 915 916 if (_States_Is_transient (current_task->current_state) 917 || _States_Is_dormant (current_task->current_state)) 916 if (_States_Is_dormant (current_task->current_state)) 918 917 { 919 918 rtems_id ct_id = current_task->Object.id; -
cpukit/libmisc/monitor/mon-prmisc.c
r2369b10 rf39f667a 117 117 { "DORM", STATES_DORMANT, 0 }, 118 118 { "SUSP", STATES_SUSPENDED, 0 }, 119 { "TRANS", STATES_TRANSIENT, 0 },120 119 { "DELAY", STATES_DELAYING, 0 }, 121 120 { "Wtime", STATES_WAITING_FOR_TIME, 0 }, -
cpukit/posix/src/pthreadexit.c
r2369b10 rf39f667a 55 55 } while ( (unblocked = _Thread_queue_Dequeue( &api->Join_List )) ); 56 56 } else { 57 _Thread_Set_state( 58 the_thread, 59 STATES_WAITING_FOR_JOIN_AT_EXIT | STATES_TRANSIENT 60 ); 57 _Thread_Set_state( the_thread, STATES_WAITING_FOR_JOIN_AT_EXIT ); 61 58 _Thread_Enable_dispatch(); 62 59 /* now waiting for thread to arrive */ -
cpukit/posix/src/pthreadjoin.c
r2369b10 rf39f667a 62 62 */ 63 63 64 if ( the_thread->current_state == 65 (STATES_WAITING_FOR_JOIN_AT_EXIT | STATES_TRANSIENT) ) { 64 if ( the_thread->current_state == STATES_WAITING_FOR_JOIN_AT_EXIT ) { 66 65 return_pointer = the_thread->Wait.return_argument; 67 _Thread_Clear_state( 68 the_thread, 69 (STATES_WAITING_FOR_JOIN_AT_EXIT | STATES_TRANSIENT) 70 ); 66 _Thread_Clear_state( the_thread, STATES_WAITING_FOR_JOIN_AT_EXIT ); 71 67 } else { 72 68 executing->Wait.return_argument = &return_pointer; -
cpukit/score/Makefile.am
r2369b10 rf39f667a 209 209 libscore_a_SOURCES += src/schedulerpriority.c \ 210 210 src/schedulerpriorityblock.c \ 211 src/schedulerpriorityenqueue.c \ 212 src/schedulerpriorityenqueuefirst.c \ 213 src/schedulerpriorityextract.c \ 211 src/schedulerprioritychangepriority.c \ 214 212 src/schedulerpriorityprioritycompare.c \ 215 213 src/schedulerpriorityschedule.c \ … … 221 219 libscore_a_SOURCES += src/schedulersimple.c \ 222 220 src/schedulersimpleblock.c \ 223 src/schedulersimpleenqueue.c \ 224 src/schedulersimpleenqueuefirst.c \ 225 src/schedulersimpleextract.c \ 226 src/schedulersimplereadyqueueenqueue.c \ 227 src/schedulersimplereadyqueueenqueuefirst.c \ 221 src/schedulersimplechangepriority.c \ 228 222 src/schedulersimpleschedule.c \ 229 223 src/schedulersimpleunblock.c \ … … 234 228 src/scheduleredfallocate.c \ 235 229 src/scheduleredfblock.c \ 236 src/scheduleredfenqueue.c \ 237 src/scheduleredfenqueuefirst.c \ 238 src/scheduleredfextract.c \ 230 src/scheduleredfchangepriority.c \ 239 231 src/scheduleredfprioritycompare.c \ 240 232 src/scheduleredfreleasejob.c \ … … 283 275 src/threadloadenv.c src/threadready.c \ 284 276 src/threadrestart.c src/threadsetpriority.c \ 285 src/threadsetstate.c src/threadsettransient.c\277 src/threadsetstate.c \ 286 278 src/threadstackallocate.c src/threadstackfree.c src/threadstart.c \ 287 279 src/threadstartmultitasking.c src/iterateoverthreads.c \ -
cpukit/score/include/rtems/score/scheduler.h
r2369b10 rf39f667a 64 64 void ( *unblock )( const Scheduler_Control *, Thread_Control * ); 65 65 66 /** @see _Scheduler_Change_priority() */ 67 void ( *change_priority )( 68 const Scheduler_Control *, 69 Thread_Control *, 70 Priority_Control, 71 bool 72 ); 73 66 74 /** @see _Scheduler_Allocate() */ 67 75 bool ( *allocate )( const Scheduler_Control *, Thread_Control * ); … … 72 80 /** @see _Scheduler_Update() */ 73 81 void ( *update )( const Scheduler_Control *, Thread_Control * ); 74 75 /** @see _Scheduler_Enqueue() */76 void ( *enqueue )( const Scheduler_Control *, Thread_Control * );77 78 /** @see _Scheduler_Enqueue_first() */79 void ( *enqueue_first )( const Scheduler_Control *, Thread_Control * );80 81 /** @see _Scheduler_Extract() */82 void ( *extract )( const Scheduler_Control *, Thread_Control * );83 82 84 83 /** @see _Scheduler_Priority_compare() */ -
cpukit/score/include/rtems/score/schedulercbs.h
r2369b10 rf39f667a 53 53 _Scheduler_EDF_Block, /* block entry point */ \ 54 54 _Scheduler_CBS_Unblock, /* unblock entry point */ \ 55 _Scheduler_EDF_Change_priority, /* change priority entry point */ \ 55 56 _Scheduler_CBS_Allocate, /* allocate entry point */ \ 56 57 _Scheduler_default_Free, /* free entry point */ \ 57 58 _Scheduler_EDF_Update, /* update entry point */ \ 58 _Scheduler_EDF_Enqueue, /* enqueue entry point */ \59 _Scheduler_EDF_Enqueue_first, /* enqueue_first entry point */ \60 _Scheduler_EDF_Extract, /* extract entry point */ \61 59 _Scheduler_EDF_Priority_compare, /* compares two priorities */ \ 62 60 _Scheduler_CBS_Release_job, /* new period of task */ \ -
cpukit/score/include/rtems/score/scheduleredf.h
r2369b10 rf39f667a 46 46 _Scheduler_EDF_Block, /* block entry point */ \ 47 47 _Scheduler_EDF_Unblock, /* unblock entry point */ \ 48 _Scheduler_EDF_Change_priority, /* change priority entry point */ \ 48 49 _Scheduler_EDF_Allocate, /* allocate entry point */ \ 49 50 _Scheduler_default_Free, /* free entry point */ \ 50 51 _Scheduler_EDF_Update, /* update entry point */ \ 51 _Scheduler_EDF_Enqueue, /* enqueue entry point */ \52 _Scheduler_EDF_Enqueue_first, /* enqueue_first entry point */ \53 _Scheduler_EDF_Extract, /* extract entry point */ \54 52 _Scheduler_EDF_Priority_compare, /* compares two priorities */ \ 55 53 _Scheduler_EDF_Release_job, /* new period of task */ \ … … 188 186 ); 189 187 188 void _Scheduler_EDF_Change_priority( 189 const Scheduler_Control *scheduler, 190 Thread_Control *the_thread, 191 Priority_Control new_priority, 192 bool prepend_it 193 ); 194 190 195 /** 191 196 * @brief invoked when a thread wishes to voluntarily … … 204 209 */ 205 210 void _Scheduler_EDF_Yield( 206 const Scheduler_Control *scheduler,207 Thread_Control *the_thread208 );209 210 /**211 * @brief Put @a the_thread to the rbtree ready queue.212 *213 * This routine puts @a the_thread to the rbtree ready queue.214 *215 * @param[in] the_thread will be enqueued to the ready queue.216 */217 void _Scheduler_EDF_Enqueue(218 const Scheduler_Control *scheduler,219 Thread_Control *the_thread220 );221 222 /**223 * @brief Enqueue a thread to the ready queue.224 *225 * This routine puts @a the_thread to the rbtree ready queue.226 * For the EDF scheduler this is the same as @a _Scheduler_EDF_Enqueue.227 *228 * @param[in] the_thread will be enqueued to the ready queue.229 */230 void _Scheduler_EDF_Enqueue_first(231 const Scheduler_Control *scheduler,232 Thread_Control *the_thread233 );234 235 /**236 * @brief Remove a specific thread from the scheduler's set237 * of ready threads.238 *239 * This routine removes a specific thread from the scheduler's set240 * of ready threads.241 *242 * @param[in] the_thread will be extracted from the ready set.243 */244 void _Scheduler_EDF_Extract(245 211 const Scheduler_Control *scheduler, 246 212 Thread_Control *the_thread -
cpukit/score/include/rtems/score/scheduleredfimpl.h
r2369b10 rf39f667a 45 45 } 46 46 47 RTEMS_INLINE_ROUTINE void _Scheduler_EDF_Enqueue( 48 const Scheduler_Control *scheduler, 49 Thread_Control *the_thread 50 ) 51 { 52 Scheduler_EDF_Context *context = 53 _Scheduler_EDF_Get_context( scheduler ); 54 Scheduler_EDF_Node *node = _Scheduler_EDF_Node_get( the_thread ); 55 56 _RBTree_Insert( &context->Ready, &node->Node ); 57 node->queue_state = SCHEDULER_EDF_QUEUE_STATE_YES; 58 } 59 60 RTEMS_INLINE_ROUTINE void _Scheduler_EDF_Extract( 61 const Scheduler_Control *scheduler, 62 Thread_Control *the_thread 63 ) 64 { 65 Scheduler_EDF_Context *context = 66 _Scheduler_EDF_Get_context( scheduler ); 67 Scheduler_EDF_Node *node = _Scheduler_EDF_Node_get( the_thread ); 68 69 _RBTree_Extract( &context->Ready, &node->Node ); 70 } 71 47 72 RTEMS_INLINE_ROUTINE void _Scheduler_EDF_Schedule_body( 48 73 const Scheduler_Control *scheduler, -
cpukit/score/include/rtems/score/schedulerimpl.h
r2369b10 rf39f667a 145 145 146 146 /** 147 * @brief Propagates a priority change of a thread to the scheduler. 148 * 149 * The caller must ensure that the thread is in the ready state. The caller 150 * must ensure that the priority value actually changed and is not equal to the 151 * current priority value. 152 * 153 * @param[in] scheduler The scheduler instance. 154 * @param[in] the_thread The thread changing its priority. 155 * @param[in] new_priority The new thread priority. 156 * @param[in] prepend_it In case this is true, then enqueue the thread as the 157 * first of its priority group, otherwise enqueue the thread as the last of its 158 * priority group. 159 */ 160 RTEMS_INLINE_ROUTINE void _Scheduler_Change_priority( 161 const Scheduler_Control *scheduler, 162 Thread_Control *the_thread, 163 Priority_Control new_priority, 164 bool prepend_it 165 ) 166 { 167 ( *scheduler->Operations.change_priority )( 168 scheduler, 169 the_thread, 170 new_priority, 171 prepend_it 172 ); 173 } 174 175 /** 147 176 * @brief Scheduler allocate. 148 177 * … … 181 210 { 182 211 ( *scheduler->Operations.update )( scheduler, the_thread ); 183 }184 185 /**186 * @brief Enqueues a thread as the last of its priority group.187 *188 * @param[in] scheduler The scheduler instance.189 * @param[in] the_thread The thread to enqueue.190 */191 RTEMS_INLINE_ROUTINE void _Scheduler_Enqueue(192 const Scheduler_Control *scheduler,193 Thread_Control *the_thread194 )195 {196 ( *scheduler->Operations.enqueue )( scheduler, the_thread );197 }198 199 /**200 * @brief Enqueues a thread as the first of its priority group.201 *202 * @param[in] scheduler The scheduler instance.203 * @param[in] the_thread The thread to enqueue.204 */205 RTEMS_INLINE_ROUTINE void _Scheduler_Enqueue_first(206 const Scheduler_Control *scheduler,207 Thread_Control *the_thread208 )209 {210 ( *scheduler->Operations.enqueue_first )( scheduler, the_thread );211 }212 213 /**214 * @brief Scheduler extract.215 *216 * This routine extract @a the_thread->scheduler217 */218 RTEMS_INLINE_ROUTINE void _Scheduler_Extract(219 const Scheduler_Control *scheduler,220 Thread_Control *the_thread221 )222 {223 ( *scheduler->Operations.extract )( scheduler, the_thread );224 212 } 225 213 -
cpukit/score/include/rtems/score/schedulerpriority.h
r2369b10 rf39f667a 53 53 _Scheduler_priority_Block, /* block entry point */ \ 54 54 _Scheduler_priority_Unblock, /* unblock entry point */ \ 55 _Scheduler_default_Allocate, /* allocate entry point */ \ 56 _Scheduler_default_Free, /* free entry point */ \ 55 _Scheduler_priority_Change_priority, /* change priority entry point */ \ 56 _Scheduler_default_Allocate, /* allocate entry point */ \ 57 _Scheduler_default_Free, /* free entry point */ \ 57 58 _Scheduler_priority_Update, /* update entry point */ \ 58 _Scheduler_priority_Enqueue, /* enqueue entry point */ \59 _Scheduler_priority_Enqueue_first, /* enqueue_first entry point */ \60 _Scheduler_priority_Extract, /* extract entry point */ \61 59 _Scheduler_priority_Priority_compare, /* compares two priorities */ \ 62 60 _Scheduler_default_Release_job, /* new period of task */ \ … … 168 166 ); 169 167 168 void _Scheduler_priority_Change_priority( 169 const Scheduler_Control *scheduler, 170 Thread_Control *the_thread, 171 Priority_Control new_priority, 172 bool prepend_it 173 ); 174 170 175 /** 171 176 * @brief The specified THREAD yields. … … 193 198 194 199 /** 195 * @brief Puts @a the_thread on to the priority-based ready queue.196 *197 * This routine puts @a the_thread on to the priority-based ready queue.198 *199 * @param[in] the_thread will be enqueued at the TAIL of its priority.200 */201 void _Scheduler_priority_Enqueue(202 const Scheduler_Control *scheduler,203 Thread_Control *the_thread204 );205 206 /**207 * @brief Puts @a the_thread to the head of the ready queue.208 *209 * This routine puts @a the_thread to the head of the ready queue.210 * For priority-based ready queues, the thread will be the first thread211 * at its priority level.212 *213 * @param[in] the_thread will be enqueued at the HEAD of its priority.214 */215 void _Scheduler_priority_Enqueue_first(216 const Scheduler_Control *scheduler,217 Thread_Control *the_thread218 );219 220 /**221 * @brief Remove a specific thread from scheduler.222 *223 * This routine removes a specific thread from the scheduler's set224 * of ready threads.225 *226 * @param[in] the_thread will be extracted from the ready set.227 */228 void _Scheduler_priority_Extract(229 const Scheduler_Control *scheduler,230 Thread_Control *the_thread231 );232 233 /**234 200 * @brief Compare two priorities. 235 201 * -
cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
r2369b10 rf39f667a 54 54 _Scheduler_priority_SMP_Yield, \ 55 55 _Scheduler_priority_SMP_Block, \ 56 _Scheduler_priority_SMP_Enqueue_fifo, \ 56 _Scheduler_priority_SMP_Unblock, \ 57 _Scheduler_priority_SMP_Change_priority, \ 57 58 _Scheduler_priority_affinity_SMP_Allocate, \ 58 59 _Scheduler_default_Free, \ 59 60 _Scheduler_priority_SMP_Update, \ 60 _Scheduler_priority_SMP_Enqueue_fifo, \61 _Scheduler_priority_SMP_Enqueue_lifo, \62 _Scheduler_priority_SMP_Extract, \63 61 _Scheduler_priority_Priority_compare, \ 64 62 _Scheduler_default_Release_job, \ -
cpukit/score/include/rtems/score/schedulerpriorityimpl.h
r2369b10 rf39f667a 197 197 198 198 /** 199 * @brief Updates the specified ready queue data according to the current200 * priority of the thread.201 * 202 * @param[in] the_thread The thread.203 * @param[in] ready_queue The ready queue.199 * @brief Updates the specified ready queue data according to the new priority 200 * value. 201 * 202 * @param[in] ready_queue The ready queue. 203 * @param[in] new_priority The new priority. 204 204 * @param[in] bit_map The priority bit map of the scheduler instance. 205 205 * @param[in] ready_queues The ready queues of the scheduler instance. 206 206 */ 207 207 RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_update( 208 Thread_Control *the_thread,209 Scheduler_priority_Ready_queue *ready_queue,208 Scheduler_priority_Ready_queue *ready_queue, 209 Priority_Control new_priority, 210 210 Priority_bit_map_Control *bit_map, 211 211 Chain_Control *ready_queues 212 212 ) 213 213 { 214 Priority_Control priority = the_thread->current_priority; 215 ready_queue->ready_chain = &ready_queues[ priority ]; 214 ready_queue->ready_chain = &ready_queues[ new_priority ]; 216 215 217 216 _Priority_bit_map_Initialize_information( 218 217 bit_map, 219 218 &ready_queue->Priority_map, 220 priority219 new_priority 221 220 ); 222 221 } -
cpukit/score/include/rtems/score/schedulerprioritysmp.h
r2369b10 rf39f667a 8 8 9 9 /* 10 * Copyright (c) 2013 embedded brains GmbH. All rights reserved.10 * Copyright (c) 2013-2014 embedded brains GmbH. All rights reserved. 11 11 * 12 12 * embedded brains GmbH … … 83 83 _Scheduler_priority_SMP_Yield, \ 84 84 _Scheduler_priority_SMP_Block, \ 85 _Scheduler_priority_SMP_Enqueue_fifo, \ 85 _Scheduler_priority_SMP_Unblock, \ 86 _Scheduler_priority_SMP_Change_priority, \ 86 87 _Scheduler_priority_SMP_Allocate, \ 87 88 _Scheduler_default_Free, \ 88 89 _Scheduler_priority_SMP_Update, \ 89 _Scheduler_priority_SMP_Enqueue_fifo, \90 _Scheduler_priority_SMP_Enqueue_lifo, \91 _Scheduler_priority_SMP_Extract, \92 90 _Scheduler_priority_Priority_compare, \ 93 91 _Scheduler_default_Release_job, \ … … 115 113 ); 116 114 117 void _Scheduler_priority_SMP_U pdate(115 void _Scheduler_priority_SMP_Unblock( 118 116 const Scheduler_Control *scheduler, 119 117 Thread_Control *thread 120 118 ); 121 119 122 void _Scheduler_priority_SMP_ Enqueue_fifo(120 void _Scheduler_priority_SMP_Change_priority( 123 121 const Scheduler_Control *scheduler, 124 Thread_Control *thread 122 Thread_Control *the_thread, 123 Priority_Control new_priority, 124 bool prepend_it 125 125 ); 126 126 127 void _Scheduler_priority_SMP_Enqueue_lifo( 128 const Scheduler_Control *scheduler, 129 Thread_Control *thread 130 ); 131 132 void _Scheduler_priority_SMP_Extract( 127 void _Scheduler_priority_SMP_Update( 133 128 const Scheduler_Control *scheduler, 134 129 Thread_Control *thread -
cpukit/score/include/rtems/score/schedulersimple.h
r2369b10 rf39f667a 43 43 _Scheduler_simple_Block, /* block entry point */ \ 44 44 _Scheduler_simple_Unblock, /* unblock entry point */ \ 45 _Scheduler_simple_Change_priority, /* change priority entry point */ \ 45 46 _Scheduler_default_Allocate, /* allocate entry point */ \ 46 47 _Scheduler_default_Free, /* free entry point */ \ 47 48 _Scheduler_default_Update, /* update entry point */ \ 48 _Scheduler_simple_Enqueue, /* enqueue entry point */ \49 _Scheduler_simple_Enqueue_first, /* enqueue_first entry point */ \50 _Scheduler_simple_Extract, /* extract entry point */ \51 49 _Scheduler_priority_Priority_compare, /* compares two priorities */ \ 52 50 _Scheduler_default_Release_job, /* new period of task */ \ … … 137 135 ); 138 136 139 /** 140 * @brief Removes a simple-priority-based thread from a simple queue. 141 * 142 * This routine removes a specific thread from the specified 143 * simple-based ready queue. 144 * 145 * @param[in] the_thread is the thread to be blocked 146 */ 147 void _Scheduler_simple_Extract( 137 void _Scheduler_simple_Change_priority( 148 138 const Scheduler_Control *scheduler, 149 Thread_Control *the_thread 150 ); 151 152 /** 153 * @brief Puts simple-priority-based thread onto the ready queue. 154 * 155 * This routine puts @a the_thread on to the ready queue. 156 * 157 * @param[in] the_thread is the thread to be enqueued 158 */ 159 void _Scheduler_simple_Enqueue( 160 const Scheduler_Control *scheduler, 161 Thread_Control *the_thread 162 ); 163 164 /** 165 * @brief Put simple-priority-based @a the_thread to 166 * the head of the ready queue. 167 * 168 * This routine puts @a the_thread to the head of the ready queue. 169 * The thread will be the first thread at its priority level. 170 * 171 * @param[in] the_thread is the thread to be blocked 172 */ 173 void _Scheduler_simple_Enqueue_first( 174 const Scheduler_Control *scheduler, 175 Thread_Control *the_thread 176 ); 177 178 /** 179 * _Scheduler_simple_Ready_queue_enqueue 180 * 181 * This routine puts @a the_thread on the ready queue 182 * at the end of its priority group. 183 * 184 * @param[in] the_thread - pointer to a thread control block 185 */ 186 void _Scheduler_simple_Ready_queue_enqueue( 187 const Scheduler_Control *scheduler, 188 Thread_Control *the_thread 189 ); 190 191 /** 192 * @brief Puts simple-priority-based @a the_thread on to the ready queue 193 * at the beginning of its priority group. 194 * 195 * This routine puts @a the_thread on to the ready queue 196 * at the beginning of its priority group. 197 * 198 * @param[in] the_thread - pointer to a thread control block 199 */ 200 void _Scheduler_simple_Ready_queue_enqueue_first( 201 const Scheduler_Control *scheduler, 202 Thread_Control *the_thread 139 Thread_Control *the_thread, 140 Priority_Control new_priority, 141 bool prepend_it 203 142 ); 204 143 -
cpukit/score/include/rtems/score/schedulersimpleimpl.h
r2369b10 rf39f667a 37 37 { 38 38 return (Scheduler_simple_Context *) _Scheduler_Get_context( scheduler ); 39 }40 41 /**42 * This routine puts @a the_thread on to the ready queue.43 *44 * @param[in] the_ready_queue is a pointer to the ready queue head45 * @param[in] the_thread is the thread to be blocked46 */47 RTEMS_INLINE_ROUTINE void _Scheduler_simple_Ready_queue_requeue(48 const Scheduler_Control *scheduler,49 Thread_Control *the_thread50 )51 {52 /* extract */53 _Chain_Extract_unprotected( &the_thread->Object.Node );54 55 /* enqueue */56 _Scheduler_simple_Ready_queue_enqueue( scheduler, the_thread );57 39 } 58 40 … … 103 85 } 104 86 87 RTEMS_INLINE_ROUTINE void _Scheduler_simple_Extract( 88 const Scheduler_Control *scheduler, 89 Thread_Control *the_thread 90 ) 91 { 92 (void) scheduler; 93 94 _Chain_Extract_unprotected( &the_thread->Object.Node ); 95 } 96 105 97 RTEMS_INLINE_ROUTINE void _Scheduler_simple_Schedule_body( 106 98 const Scheduler_Control *scheduler, -
cpukit/score/include/rtems/score/schedulersimplesmp.h
r2369b10 rf39f667a 64 64 _Scheduler_simple_SMP_Yield, \ 65 65 _Scheduler_simple_SMP_Block, \ 66 _Scheduler_simple_SMP_Enqueue_priority_fifo, \ 66 _Scheduler_simple_SMP_Unblock, \ 67 _Scheduler_simple_SMP_Change_priority, \ 67 68 _Scheduler_simple_SMP_Allocate, \ 68 69 _Scheduler_default_Free, \ 69 70 _Scheduler_default_Update, \ 70 _Scheduler_simple_SMP_Enqueue_priority_fifo, \71 _Scheduler_simple_SMP_Enqueue_priority_lifo, \72 _Scheduler_simple_SMP_Extract, \73 71 _Scheduler_priority_Priority_compare, \ 74 72 _Scheduler_default_Release_job, \ … … 91 89 ); 92 90 93 void _Scheduler_simple_SMP_ Enqueue_priority_fifo(91 void _Scheduler_simple_SMP_Unblock( 94 92 const Scheduler_Control *scheduler, 95 93 Thread_Control *thread 96 94 ); 97 95 98 void _Scheduler_simple_SMP_ Enqueue_priority_lifo(96 void _Scheduler_simple_SMP_Change_priority( 99 97 const Scheduler_Control *scheduler, 100 Thread_Control *thread 101 ); 102 103 void _Scheduler_simple_SMP_Extract( 104 const Scheduler_Control *scheduler, 105 Thread_Control *thread 98 Thread_Control *the_thread, 99 Priority_Control new_priority, 100 bool prepend_it 106 101 ); 107 102 -
cpukit/score/include/rtems/score/schedulersmp.h
r2369b10 rf39f667a 70 70 * A scheduler node is scheduled if the corresponding thread is ready and the 71 71 * scheduler allocated a processor for it. A scheduled node is assigned to 72 * exactly one processor. The sum of scheduled and in the air nodes equals73 * the processor count owned by ascheduler instance.72 * exactly one processor. The count of scheduled nodes in this scheduler 73 * instance equals the processor count owned by the scheduler instance. 74 74 */ 75 75 SCHEDULER_SMP_NODE_SCHEDULED, … … 81 81 * scheduler did not allocate a processor for it. 82 82 */ 83 SCHEDULER_SMP_NODE_READY, 84 85 /** 86 * @brief This scheduler node is in the air. 87 * 88 * A scheduled node is in the air if it has an allocated processor and the 89 * corresponding thread is in a transient state. Such a node is not an 90 * element of the set of scheduled nodes. The extract operation on a 91 * scheduled node will produce a scheduler node in the air (see also 92 * _Thread_Set_transient()). The next enqueue or schedule operation will 93 * decide what to do based on this state indication. It can either place the 94 * scheduler node back on the set of scheduled nodes and the thread can keep 95 * its allocated processor, or it can take the processor away from the thread 96 * and give the processor to another thread of higher priority. 97 */ 98 SCHEDULER_SMP_NODE_IN_THE_AIR 83 SCHEDULER_SMP_NODE_READY 99 84 } Scheduler_SMP_Node_state; 100 85 -
cpukit/score/include/rtems/score/schedulersmpimpl.h
r2369b10 rf39f667a 38 38 * The scheduler nodes can be in four states 39 39 * - @ref SCHEDULER_SMP_NODE_BLOCKED, 40 * - @ref SCHEDULER_SMP_NODE_SCHEDULED, 41 * - @ref SCHEDULER_SMP_NODE_READY, and 42 * - @ref SCHEDULER_SMP_NODE_IN_THE_AIR. 43 * 44 * State transitions are triggered via basic three operations 45 * - _Scheduler_SMP_Enqueue_ordered(), 46 * - _Scheduler_SMP_Extract(), and 47 * - _Scheduler_SMP_Schedule(). 40 * - @ref SCHEDULER_SMP_NODE_SCHEDULED, and 41 * - @ref SCHEDULER_SMP_NODE_READY. 42 * 43 * State transitions are triggered via basic operations 44 * - _Scheduler_SMP_Enqueue_ordered(), and 45 * - _Scheduler_SMP_Block(). 48 46 * 49 47 * @dot … … 54 52 * ss [label="SCHEDULED", fillcolor="green"]; 55 53 * rs [label="READY", fillcolor="red"]; 56 * as [label="IN THE AIR", fillcolor="orange"];57 54 * 58 55 * edge [label="enqueue"]; … … 60 57 * 61 58 * bs -> ss; 62 * as -> ss; 63 * 64 * edge [label="enqueue"]; 59 * 65 60 * edge [fontcolor="red", color="red"]; 66 61 * 67 62 * bs -> rs; 68 * as -> rs;69 63 * 70 64 * edge [label="enqueue other"]; … … 72 66 * ss -> rs; 73 67 * 74 * edge [label=" schedule"];68 * edge [label="block"]; 75 69 * edge [fontcolor="black", color="black"]; 76 70 * 77 * as -> bs;78 *79 * edge [label="extract"];80 * edge [fontcolor="brown", color="brown"];81 *82 * ss -> as;83 *84 * edge [fontcolor="black", color="black"];85 *86 71 * rs -> bs; 87 72 * 88 * edge [label=" enqueue other\nscheduleother"];73 * edge [label="block other"]; 89 74 * edge [fontcolor="darkgreen", color="darkgreen"]; 90 75 * … … 217 202 * @enddot 218 203 * 219 * Lets do something with A. This can be a blocking operation or a priority 220 * change. For this an extract operation is performed first. 221 * 222 * @dot 223 * digraph { 224 * node [style="filled"]; 225 * edge [dir="none"]; 226 * 227 * subgraph { 228 * rank = same; 229 * 230 * b [label="B (2)", fillcolor="green"]; 231 * a [label="A (1)", fillcolor="orange"]; 232 * c [label="C (3)", fillcolor="red"]; 233 * i [label="I (5)", fillcolor="red"]; 234 * j [label="J (5)", fillcolor="red"]; 235 * c -> i -> j; 236 * } 237 * 238 * subgraph { 239 * rank = same; 240 * 241 * p0 [label="PROCESSOR 0", shape="box"]; 242 * p1 [label="PROCESSOR 1", shape="box"]; 243 * } 244 * 245 * b -> p0; 246 * a -> p1; 247 * } 248 * @enddot 249 * 250 * Lets change the priority of thread A to 4 and enqueue it. 204 * Lets change the priority of thread A to 4. 251 205 * 252 206 * @dot … … 279 233 * @enddot 280 234 * 281 * Alternatively we can also do a blocking operation with thread A. In this 282 * case schedule will be called. 235 * Now perform a blocking operation with thread B. Please note that thread A 236 * migrated now from processor 0 to processor 1 and thread C still executes on 237 * processor 1. 283 238 * 284 239 * @dot … … 290 245 * rank = same; 291 246 * 292 * b [label="B (2)", fillcolor="green"];293 247 * c [label="C (3)", fillcolor="green"]; 248 * a [label="A (4)", fillcolor="green"]; 294 249 * i [label="I (5)", fillcolor="red"]; 295 250 * j [label="J (5)", fillcolor="red"]; 296 * a [label="A (1)"];297 * b -> c;251 * b [label="B (2)"]; 252 * c -> a; 298 253 * i -> j; 299 254 * } … … 306 261 * } 307 262 * 308 * b-> p0;263 * a -> p0; 309 264 * c -> p1; 310 265 * } … … 333 288 ); 334 289 290 typedef void ( *Scheduler_SMP_Update )( 291 Scheduler_Context *context, 292 Scheduler_Node *node, 293 Priority_Control new_priority 294 ); 295 296 typedef void ( *Scheduler_SMP_Enqueue )( 297 Scheduler_Context *context, 298 Thread_Control *thread_to_enqueue, 299 bool has_processor_allocated 300 ); 301 335 302 static inline Scheduler_SMP_Context *_Scheduler_SMP_Get_self( 336 303 Scheduler_Context *context … … 361 328 } 362 329 363 extern const bool _Scheduler_SMP_Node_valid_state_changes[ 4 ][ 4];330 extern const bool _Scheduler_SMP_Node_valid_state_changes[ 3 ][ 3 ]; 364 331 365 332 static inline void _Scheduler_SMP_Node_change_state( … … 468 435 * @param[in] context The scheduler instance context. 469 436 * @param[in] thread The thread to enqueue. 437 * @param[in] has_processor_allocated The thread has a processor allocated. 470 438 * @param[in] order The order function. 471 439 * @param[in] get_highest_ready Function to get the highest ready node. … … 482 450 Scheduler_Context *context, 483 451 Thread_Control *thread, 452 bool has_processor_allocated, 484 453 Chain_Node_order order, 485 454 Scheduler_SMP_Get_highest_ready get_highest_ready, … … 493 462 Scheduler_SMP_Node *node = _Scheduler_SMP_Node_get( thread ); 494 463 495 if ( node->state == SCHEDULER_SMP_NODE_IN_THE_AIR) {464 if ( has_processor_allocated) { 496 465 Thread_Control *highest_ready = ( *get_highest_ready )( &self->Base ); 466 467 _Assert( highest_ready != NULL); 497 468 498 469 /* … … 502 473 * NOTE: Do not exchange parameters to do the negation of the order check. 503 474 */ 504 if ( 505 highest_ready != NULL 506 && !( *order )( &thread->Object.Node, &highest_ready->Object.Node ) 507 ) { 475 if ( !( *order )( &thread->Object.Node, &highest_ready->Object.Node ) ) { 508 476 _Scheduler_SMP_Node_change_state( node, SCHEDULER_SMP_NODE_READY ); 509 477 _Scheduler_SMP_Allocate_processor( self, highest_ready, thread ); … … 518 486 _Scheduler_SMP_Get_lowest_scheduled( self ); 519 487 520 /* 521 * The scheduled chain is empty if nested interrupts change the priority of 522 * all scheduled threads. These threads are in the air. 523 */ 524 if ( 525 lowest_scheduled != NULL 526 && ( *order )( &thread->Object.Node, &lowest_scheduled->Object.Node ) 527 ) { 488 _Assert( lowest_scheduled != NULL); 489 490 if ( ( *order )( &thread->Object.Node, &lowest_scheduled->Object.Node ) ) { 528 491 Scheduler_SMP_Node *lowest_scheduled_node = 529 492 _Scheduler_SMP_Node_get( lowest_scheduled ); … … 543 506 } 544 507 508 static inline void _Scheduler_SMP_Extract_from_scheduled( Thread_Control *thread ) 509 { 510 _Chain_Extract_unprotected( &thread->Object.Node ); 511 } 512 545 513 static inline void _Scheduler_SMP_Schedule_highest_ready( 546 514 Scheduler_Context *context, … … 559 527 560 528 /** 561 * @brief Finalize a scheduling operation.529 * @brief Blocks a thread. 562 530 * 563 531 * @param[in] context The scheduler instance context. 564 532 * @param[in] thread The thread of the scheduling operation. 533 * @param[in] extract_from_ready Function to extract a node from the set of 534 * ready nodes. 565 535 * @param[in] get_highest_ready Function to get the highest ready node. 566 536 * @param[in] move_from_ready_to_scheduled Function to move a node from the set 567 537 * of ready nodes to the set of scheduled nodes. 568 538 */ 569 static inline void _Scheduler_SMP_ Schedule(539 static inline void _Scheduler_SMP_Block( 570 540 Scheduler_Context *context, 571 541 Thread_Control *thread, 542 Scheduler_SMP_Extract extract_from_ready, 572 543 Scheduler_SMP_Get_highest_ready get_highest_ready, 573 544 Scheduler_SMP_Move move_from_ready_to_scheduled … … 575 546 { 576 547 Scheduler_SMP_Node *node = _Scheduler_SMP_Node_get( thread ); 577 578 if ( node->state == SCHEDULER_SMP_NODE_IN_THE_AIR ) { 579 _Scheduler_SMP_Node_change_state( node, SCHEDULER_SMP_NODE_BLOCKED ); 548 bool is_scheduled = node->state == SCHEDULER_SMP_NODE_SCHEDULED; 549 550 _Scheduler_SMP_Node_change_state( node, SCHEDULER_SMP_NODE_BLOCKED ); 551 552 if ( is_scheduled ) { 553 _Scheduler_SMP_Extract_from_scheduled( thread ); 580 554 581 555 _Scheduler_SMP_Schedule_highest_ready( … … 585 559 move_from_ready_to_scheduled 586 560 ); 587 } 588 } 589 590 static inline void _Scheduler_SMP_Block( 561 } else { 562 ( *extract_from_ready )( context, thread ); 563 } 564 } 565 566 static inline void _Scheduler_SMP_Change_priority( 591 567 Scheduler_Context *context, 592 568 Thread_Control *thread, 593 Scheduler_SMP_Extract extract, 594 Scheduler_SMP_Get_highest_ready get_highest_ready, 595 Scheduler_SMP_Move move_from_ready_to_scheduled 596 ) 597 { 598 ( *extract )( context, thread ); 599 600 _Scheduler_SMP_Schedule( 601 context, 602 thread, 603 get_highest_ready, 604 move_from_ready_to_scheduled 605 ); 606 } 607 608 /** 609 * @brief Extracts a thread from the set of scheduled or ready nodes. 610 * 611 * @param[in] context The scheduler instance context. 612 * @param[in] thread The thread to extract. 613 * @param[in] extract Function to extract a node from the set of scheduled or 614 * ready nodes. 615 */ 616 static inline void _Scheduler_SMP_Extract( 617 Scheduler_Context *context, 618 Thread_Control *thread, 619 Scheduler_SMP_Extract extract 620 ) 621 { 622 ( *extract )( context, thread ); 569 Priority_Control new_priority, 570 bool prepend_it, 571 Scheduler_SMP_Extract extract_from_ready, 572 Scheduler_SMP_Update update, 573 Scheduler_SMP_Enqueue enqueue_fifo, 574 Scheduler_SMP_Enqueue enqueue_lifo 575 ) 576 { 577 Scheduler_SMP_Node *node = _Scheduler_SMP_Node_get( thread ); 578 bool has_processor_allocated = node->state == SCHEDULER_SMP_NODE_SCHEDULED; 579 580 if ( has_processor_allocated ) { 581 _Scheduler_SMP_Extract_from_scheduled( thread ); 582 } else { 583 ( *extract_from_ready )( context, thread ); 584 } 585 586 ( *update )( context, &node->Base, new_priority ); 587 588 if ( prepend_it ) { 589 ( *enqueue_lifo )( context, thread, has_processor_allocated ); 590 } else { 591 ( *enqueue_fifo )( context, thread, has_processor_allocated ); 592 } 623 593 } 624 594 -
cpukit/score/include/rtems/score/statesimpl.h
r2369b10 rf39f667a 43 43 /** This macro corresponds to a task being suspended. */ 44 44 #define STATES_SUSPENDED 0x00002 45 /** This macro corresponds to a task being in an internal state transition. */46 #define STATES_TRANSIENT 0x0000447 45 /** This macro corresponds to a task which is waiting for a timeout. */ 48 46 #define STATES_DELAYING 0x00008 … … 216 214 217 215 /** 218 * This function returns true if the TRANSIENT state is set in219 * the_states, and false otherwise.220 *221 * @param[in] the_states is the task state set to test222 *223 * @return This method returns true if the desired state condition is set.224 */225 RTEMS_INLINE_ROUTINE bool _States_Is_transient (226 States_Control the_states227 )228 {229 return (the_states & STATES_TRANSIENT);230 }231 232 /**233 216 * This function returns true if the DELAYING state is set in 234 217 * the_states, and false otherwise. -
cpukit/score/src/schedulercbsunblock.c
r2369b10 rf39f667a 21 21 22 22 #include <rtems/score/schedulercbsimpl.h> 23 #include <rtems/score/scheduleredfimpl.h> 23 24 #include <rtems/score/schedulerimpl.h> 24 25 #include <rtems/score/threadimpl.h> -
cpukit/score/src/scheduleredfchangepriority.c
r2369b10 rf39f667a 21 21 #include <rtems/score/scheduleredfimpl.h> 22 22 23 void _Scheduler_EDF_ Extract(23 void _Scheduler_EDF_Change_priority( 24 24 const Scheduler_Control *scheduler, 25 Thread_Control *the_thread 25 Thread_Control *the_thread, 26 Priority_Control new_priority, 27 bool prepend_it 26 28 ) 27 29 { … … 31 33 32 34 _RBTree_Extract( &context->Ready, &node->Node ); 33 node->queue_state = SCHEDULER_EDF_QUEUE_STATE_NOT_PRESENTLY;35 _RBTree_Insert( &context->Ready, &node->Node ); 34 36 } -
cpukit/score/src/scheduleredfunblock.c
r2369b10 rf39f667a 19 19 #endif 20 20 21 #include <rtems/score/scheduleredf .h>21 #include <rtems/score/scheduleredfimpl.h> 22 22 #include <rtems/score/schedulerimpl.h> 23 23 #include <rtems/score/thread.h> -
cpukit/score/src/schedulerprioritysmp.c
r2369b10 rf39f667a 28 28 #include <rtems/score/schedulerpriorityimpl.h> 29 29 #include <rtems/score/schedulersmpimpl.h> 30 #include <rtems/score/wkspace.h>31 30 32 31 static Scheduler_priority_SMP_Context * … … 47 46 { 48 47 return (Scheduler_priority_SMP_Node *) _Scheduler_Node_get( thread ); 48 } 49 50 static Scheduler_priority_SMP_Node *_Scheduler_priority_SMP_Node_downcast( 51 Scheduler_Node *node 52 ) 53 { 54 return (Scheduler_priority_SMP_Node *) node; 49 55 } 50 56 … … 71 77 } 72 78 73 void _Scheduler_priority_SMP_Update( 74 const Scheduler_Control *scheduler, 75 Thread_Control *thread 76 ) 77 { 78 Scheduler_priority_SMP_Context *self = 79 _Scheduler_priority_SMP_Get_context( scheduler ); 80 Scheduler_priority_SMP_Node *node = 81 _Scheduler_priority_SMP_Node_get( thread ); 79 static void _Scheduler_priority_SMP_Do_update( 80 Scheduler_Context *context, 81 Scheduler_Node *base_node, 82 Priority_Control new_priority 83 ) 84 { 85 Scheduler_priority_SMP_Context *self = 86 _Scheduler_priority_SMP_Get_self( context ); 87 Scheduler_priority_SMP_Node *node = 88 _Scheduler_priority_SMP_Node_downcast( base_node ); 82 89 83 90 _Scheduler_priority_Ready_queue_update( 84 thread,85 &node->Ready_queue,91 &node->Ready_queue, 92 new_priority, 86 93 &self->Bit_map, 87 94 &self->Ready[ 0 ] … … 89 96 } 90 97 98 void _Scheduler_priority_SMP_Update( 99 const Scheduler_Control *scheduler, 100 Thread_Control *thread 101 ) 102 { 103 Scheduler_Context *context = _Scheduler_Get_context( scheduler ); 104 Scheduler_Node *node = _Scheduler_Node_get( thread ); 105 106 _Scheduler_priority_SMP_Do_update( context, node, thread->current_priority ); 107 } 108 91 109 static Thread_Control *_Scheduler_priority_SMP_Get_highest_ready( 92 110 Scheduler_Context *context … … 95 113 Scheduler_priority_SMP_Context *self = 96 114 _Scheduler_priority_SMP_Get_self( context ); 97 Thread_Control *highest_ready = NULL; 98 99 if ( !_Priority_bit_map_Is_empty( &self->Bit_map ) ) { 100 highest_ready = _Scheduler_priority_Ready_queue_first( 101 &self->Bit_map, 102 &self->Ready[ 0 ] 103 ); 104 } 105 106 return highest_ready; 115 116 return _Scheduler_priority_Ready_queue_first( 117 &self->Bit_map, 118 &self->Ready[ 0 ] 119 ); 107 120 } 108 121 … … 180 193 } 181 194 182 static void _Scheduler_priority_SMP_ Do_extract(195 static void _Scheduler_priority_SMP_Extract_from_ready( 183 196 Scheduler_Context *context, 184 197 Thread_Control *thread … … 190 203 _Scheduler_priority_SMP_Node_get( thread ); 191 204 192 if ( node->Base.state == SCHEDULER_SMP_NODE_SCHEDULED ) { 193 _Scheduler_SMP_Node_change_state( 194 &node->Base, 195 SCHEDULER_SMP_NODE_IN_THE_AIR 196 ); 197 _Chain_Extract_unprotected( &thread->Object.Node ); 198 } else { 199 _Scheduler_SMP_Node_change_state( 200 &node->Base, 201 SCHEDULER_SMP_NODE_BLOCKED 202 ); 203 _Scheduler_priority_Ready_queue_extract( 204 thread, 205 &node->Ready_queue, 206 &self->Bit_map 207 ); 208 } 205 _Scheduler_priority_Ready_queue_extract( 206 thread, 207 &node->Ready_queue, 208 &self->Bit_map 209 ); 209 210 } 210 211 … … 214 215 ) 215 216 { 216 Scheduler_priority_SMP_Context *self = 217 _Scheduler_priority_SMP_Get_context( scheduler ); 217 Scheduler_Context *context = _Scheduler_Get_context( scheduler ); 218 218 219 219 _Scheduler_SMP_Block( 220 &self->Base.Base,221 thread, 222 _Scheduler_priority_SMP_ Do_extract,220 context, 221 thread, 222 _Scheduler_priority_SMP_Extract_from_ready, 223 223 _Scheduler_priority_SMP_Get_highest_ready, 224 224 _Scheduler_priority_SMP_Move_from_ready_to_scheduled … … 229 229 Scheduler_Context *context, 230 230 Thread_Control *thread, 231 bool has_processor_allocated, 231 232 Chain_Node_order order, 232 233 Scheduler_SMP_Insert insert_ready, … … 237 238 context, 238 239 thread, 240 has_processor_allocated, 239 241 order, 240 242 _Scheduler_priority_SMP_Get_highest_ready, … … 246 248 } 247 249 248 void _Scheduler_priority_SMP_Enqueue_lifo( 249 const Scheduler_Control *scheduler, 250 Thread_Control *thread 251 ) 252 { 253 Scheduler_priority_SMP_Context *self = 254 _Scheduler_priority_SMP_Get_context( scheduler ); 255 250 static void _Scheduler_priority_SMP_Enqueue_lifo( 251 Scheduler_Context *context, 252 Thread_Control *thread, 253 bool has_processor_allocated 254 ) 255 { 256 256 _Scheduler_priority_SMP_Enqueue_ordered( 257 &self->Base.Base, 258 thread, 257 context, 258 thread, 259 has_processor_allocated, 259 260 _Scheduler_simple_Insert_priority_lifo_order, 260 261 _Scheduler_priority_SMP_Insert_ready_lifo, … … 263 264 } 264 265 265 void _Scheduler_priority_SMP_Enqueue_fifo( 266 const Scheduler_Control *scheduler, 267 Thread_Control *thread 268 ) 269 { 270 Scheduler_priority_SMP_Context *self = 271 _Scheduler_priority_SMP_Get_context( scheduler ); 272 266 static void _Scheduler_priority_SMP_Enqueue_fifo( 267 Scheduler_Context *context, 268 Thread_Control *thread, 269 bool has_processor_allocated 270 ) 271 { 273 272 _Scheduler_priority_SMP_Enqueue_ordered( 274 &self->Base.Base, 275 thread, 273 context, 274 thread, 275 has_processor_allocated, 276 276 _Scheduler_simple_Insert_priority_fifo_order, 277 277 _Scheduler_priority_SMP_Insert_ready_fifo, … … 280 280 } 281 281 282 void _Scheduler_priority_SMP_Extract( 283 const Scheduler_Control *scheduler, 284 Thread_Control *thread 285 ) 286 { 287 Scheduler_priority_SMP_Context *self = 288 _Scheduler_priority_SMP_Get_context( scheduler ); 289 290 _Scheduler_SMP_Extract( 291 &self->Base.Base, 292 thread, 293 _Scheduler_priority_SMP_Do_extract 282 void _Scheduler_priority_SMP_Unblock( 283 const Scheduler_Control *scheduler, 284 Thread_Control *thread 285 ) 286 { 287 Scheduler_Context *context = _Scheduler_Get_context( scheduler ); 288 289 _Scheduler_priority_SMP_Enqueue_fifo( context, thread, false ); 290 } 291 292 void _Scheduler_priority_SMP_Change_priority( 293 const Scheduler_Control *scheduler, 294 Thread_Control *thread, 295 Priority_Control new_priority, 296 bool prepend_it 297 ) 298 { 299 Scheduler_Context *context = _Scheduler_Get_context( scheduler ); 300 301 _Scheduler_SMP_Change_priority( 302 context, 303 thread, 304 new_priority, 305 prepend_it, 306 _Scheduler_priority_SMP_Extract_from_ready, 307 _Scheduler_priority_SMP_Do_update, 308 _Scheduler_priority_SMP_Enqueue_fifo, 309 _Scheduler_priority_SMP_Enqueue_lifo 294 310 ); 295 311 } … … 300 316 ) 301 317 { 318 Scheduler_Context *context = _Scheduler_Get_context( scheduler ); 302 319 ISR_Level level; 303 320 304 321 _ISR_Disable( level ); 305 322 306 _Scheduler_ priority_SMP_Extract( scheduler,thread );307 _Scheduler_priority_SMP_Enqueue_fifo( scheduler, thread);323 _Scheduler_SMP_Extract_from_scheduled( thread ); 324 _Scheduler_priority_SMP_Enqueue_fifo( context, thread, true ); 308 325 309 326 _ISR_Enable( level ); … … 315 332 ) 316 333 { 317 Scheduler_priority_SMP_Context *self = 318 _Scheduler_priority_SMP_Get_context( scheduler ); 319 320 _Scheduler_SMP_Schedule( 321 &self->Base.Base, 322 thread, 323 _Scheduler_priority_SMP_Get_highest_ready, 324 _Scheduler_priority_SMP_Move_from_ready_to_scheduled 325 ); 334 (void) scheduler; 335 (void) thread; 326 336 } 327 337 … … 332 342 ) 333 343 { 334 Scheduler_priority_SMP_Context *self = 335 _Scheduler_priority_SMP_Get_context( scheduler ); 336 337 _Scheduler_SMP_Start_idle( &self->Base.Base, thread, cpu ); 338 } 344 Scheduler_Context *context = _Scheduler_Get_context( scheduler ); 345 346 _Scheduler_SMP_Start_idle( context, thread, cpu ); 347 } -
cpukit/score/src/schedulerpriorityupdate.c
r2369b10 rf39f667a 31 31 32 32 _Scheduler_priority_Ready_queue_update( 33 the_thread,34 33 &node->Ready_queue, 34 the_thread->current_priority, 35 35 &context->Bit_map, 36 36 &context->Ready[ 0 ] -
cpukit/score/src/schedulersimplechangepriority.c
r2369b10 rf39f667a 2 2 * @file 3 3 * 4 * @brief Scheduler Simple Priority Enqueue Ready Thread 4 * @brief Removes a Thread from the Simple Queue 5 * 5 6 * @ingroup ScoreScheduler 6 7 */ … … 21 22 #include <rtems/score/schedulersimpleimpl.h> 22 23 23 void _Scheduler_simple_ Ready_queue_enqueue(24 void _Scheduler_simple_Change_priority( 24 25 const Scheduler_Control *scheduler, 25 Thread_Control *the_thread 26 Thread_Control *the_thread, 27 Priority_Control new_priority, 28 bool prepend_it 26 29 ) 27 30 { … … 29 32 _Scheduler_simple_Get_context( scheduler ); 30 33 31 _Scheduler_simple_Insert_priority_fifo( &context->Ready, the_thread ); 34 _Scheduler_simple_Extract( scheduler, the_thread ); 35 36 if ( prepend_it ) { 37 _Scheduler_simple_Insert_priority_lifo( &context->Ready, the_thread ); 38 } else { 39 _Scheduler_simple_Insert_priority_fifo( &context->Ready, the_thread ); 40 } 32 41 } -
cpukit/score/src/schedulersimplesmp.c
r2369b10 rf39f667a 21 21 #include <rtems/score/schedulersimplesmp.h> 22 22 #include <rtems/score/schedulersmpimpl.h> 23 #include <rtems/score/wkspace.h>24 23 25 24 static Scheduler_simple_SMP_Context * … … 56 55 } 57 56 57 static void _Scheduler_simple_SMP_Do_update( 58 Scheduler_Context *context, 59 Scheduler_Node *node, 60 Priority_Control new_priority 61 ) 62 { 63 (void) context; 64 (void) node; 65 (void) new_priority; 66 } 67 58 68 static Thread_Control *_Scheduler_simple_SMP_Get_highest_ready( 59 69 Scheduler_Context *context … … 62 72 Scheduler_simple_SMP_Context *self = 63 73 _Scheduler_simple_SMP_Get_self( context ); 64 Thread_Control *highest_ready = NULL; 65 Chain_Control *ready = &self->Ready; 66 67 if ( !_Chain_Is_empty( ready ) ) { 68 highest_ready = (Thread_Control *) _Chain_First( ready ); 69 } 70 71 return highest_ready; 74 75 return (Thread_Control *) _Chain_First( &self->Ready ); 72 76 } 73 77 … … 132 136 } 133 137 134 static void _Scheduler_simple_SMP_Do_extract( 135 Scheduler_Context *context, 136 Thread_Control *thread 137 ) 138 { 139 Scheduler_SMP_Node *node = _Scheduler_SMP_Node_get( thread ); 140 138 static void _Scheduler_simple_SMP_Extract_from_ready( 139 Scheduler_Context *context, 140 Thread_Control *thread 141 ) 142 { 141 143 (void) context; 142 144 143 if ( node->state == SCHEDULER_SMP_NODE_SCHEDULED ) {144 _Scheduler_SMP_Node_change_state( node, SCHEDULER_SMP_NODE_IN_THE_AIR );145 } else {146 _Scheduler_SMP_Node_change_state( node, SCHEDULER_SMP_NODE_BLOCKED );147 }148 149 145 _Chain_Extract_unprotected( &thread->Object.Node ); 150 146 } … … 155 151 ) 156 152 { 157 Scheduler_simple_SMP_Context *self = 158 _Scheduler_simple_SMP_Get_context( scheduler ); 153 Scheduler_Context *context = _Scheduler_Get_context( scheduler ); 159 154 160 155 _Scheduler_SMP_Block( 161 &self->Base.Base,162 thread, 163 _Scheduler_simple_SMP_ Do_extract,156 context, 157 thread, 158 _Scheduler_simple_SMP_Extract_from_ready, 164 159 _Scheduler_simple_SMP_Get_highest_ready, 165 160 _Scheduler_simple_SMP_Move_from_ready_to_scheduled … … 170 165 Scheduler_Context *context, 171 166 Thread_Control *thread, 167 bool has_processor_allocated, 172 168 Chain_Node_order order, 173 169 Scheduler_SMP_Insert insert_ready, … … 178 174 context, 179 175 thread, 176 has_processor_allocated, 180 177 order, 181 178 _Scheduler_simple_SMP_Get_highest_ready, … … 187 184 } 188 185 189 void _Scheduler_simple_SMP_Enqueue_priority_lifo( 190 const Scheduler_Control *scheduler, 191 Thread_Control *thread 192 ) 193 { 194 Scheduler_simple_SMP_Context *self = 195 _Scheduler_simple_SMP_Get_context( scheduler ); 196 186 static void _Scheduler_simple_SMP_Enqueue_lifo( 187 Scheduler_Context *context, 188 Thread_Control *thread, 189 bool has_processor_allocated 190 ) 191 { 197 192 _Scheduler_simple_SMP_Enqueue_ordered( 198 &self->Base.Base, 199 thread, 193 context, 194 thread, 195 has_processor_allocated, 200 196 _Scheduler_simple_Insert_priority_lifo_order, 201 197 _Scheduler_simple_SMP_Insert_ready_lifo, … … 204 200 } 205 201 206 void _Scheduler_simple_SMP_Enqueue_priority_fifo( 207 const Scheduler_Control *scheduler, 208 Thread_Control *thread 209 ) 210 { 211 Scheduler_simple_SMP_Context *self = 212 _Scheduler_simple_SMP_Get_context( scheduler ); 213 202 static void _Scheduler_simple_SMP_Enqueue_fifo( 203 Scheduler_Context *context, 204 Thread_Control *thread, 205 bool has_processor_allocated 206 ) 207 { 214 208 _Scheduler_simple_SMP_Enqueue_ordered( 215 &self->Base.Base, 216 thread, 209 context, 210 thread, 211 has_processor_allocated, 217 212 _Scheduler_simple_Insert_priority_fifo_order, 218 213 _Scheduler_simple_SMP_Insert_ready_fifo, … … 221 216 } 222 217 223 void _Scheduler_simple_SMP_Extract( 224 const Scheduler_Control *scheduler, 225 Thread_Control *thread 226 ) 227 { 228 Scheduler_simple_SMP_Context *self = 229 _Scheduler_simple_SMP_Get_context( scheduler ); 230 231 _Scheduler_SMP_Extract( 232 &self->Base.Base, 233 thread, 234 _Scheduler_simple_SMP_Do_extract 218 void _Scheduler_simple_SMP_Unblock( 219 const Scheduler_Control *scheduler, 220 Thread_Control *thread 221 ) 222 { 223 Scheduler_Context *context = _Scheduler_Get_context( scheduler ); 224 225 _Scheduler_simple_SMP_Enqueue_fifo( context, thread, false ); 226 } 227 228 void _Scheduler_simple_SMP_Change_priority( 229 const Scheduler_Control *scheduler, 230 Thread_Control *thread, 231 Priority_Control new_priority, 232 bool prepend_it 233 ) 234 { 235 Scheduler_Context *context = _Scheduler_Get_context( scheduler ); 236 237 _Scheduler_SMP_Change_priority( 238 context, 239 thread, 240 new_priority, 241 prepend_it, 242 _Scheduler_simple_SMP_Extract_from_ready, 243 _Scheduler_simple_SMP_Do_update, 244 _Scheduler_simple_SMP_Enqueue_fifo, 245 _Scheduler_simple_SMP_Enqueue_lifo 235 246 ); 236 247 } … … 241 252 ) 242 253 { 254 Scheduler_Context *context = _Scheduler_Get_context( scheduler ); 243 255 ISR_Level level; 244 256 245 257 _ISR_Disable( level ); 246 258 247 _Scheduler_ simple_SMP_Extract( scheduler,thread );248 _Scheduler_simple_SMP_Enqueue_ priority_fifo( scheduler, thread);259 _Scheduler_SMP_Extract_from_scheduled( thread ); 260 _Scheduler_simple_SMP_Enqueue_fifo( context, thread, true ); 249 261 250 262 _ISR_Enable( level ); … … 256 268 ) 257 269 { 258 Scheduler_simple_SMP_Context *self = 259 _Scheduler_simple_SMP_Get_context( scheduler ); 260 261 _Scheduler_SMP_Schedule( 262 &self->Base.Base, 263 thread, 264 _Scheduler_simple_SMP_Get_highest_ready, 265 _Scheduler_simple_SMP_Move_from_ready_to_scheduled 266 ); 270 (void) scheduler; 271 (void) thread; 267 272 } 268 273 … … 273 278 ) 274 279 { 275 Scheduler_simple_SMP_Context *self = 276 _Scheduler_simple_SMP_Get_context( scheduler ); 277 278 _Scheduler_SMP_Start_idle( &self->Base.Base, thread, cpu ); 279 } 280 Scheduler_Context *context = _Scheduler_Get_context( scheduler ); 281 282 _Scheduler_SMP_Start_idle( context, thread, cpu ); 283 } -
cpukit/score/src/schedulersimpleunblock.c
r2369b10 rf39f667a 27 27 ) 28 28 { 29 _Scheduler_simple_Ready_queue_enqueue( scheduler, the_thread ); 29 Scheduler_simple_Context *context = 30 _Scheduler_simple_Get_context( scheduler ); 31 32 _Scheduler_simple_Insert_priority_fifo( &context->Ready, the_thread ); 30 33 31 34 /* -
cpukit/score/src/schedulersimpleyield.c
r2369b10 rf39f667a 27 27 ) 28 28 { 29 Scheduler_simple_Context *context = 30 _Scheduler_simple_Get_context( scheduler ); 29 31 ISR_Level level; 30 32 31 33 _ISR_Disable( level ); 32 34 33 _Scheduler_simple_Ready_queue_requeue( scheduler, the_thread ); 35 _Chain_Extract_unprotected( &the_thread->Object.Node ); 36 _Scheduler_simple_Insert_priority_fifo( &context->Ready, the_thread ); 34 37 35 38 _ISR_Flash( level ); -
cpukit/score/src/schedulersmpvalidstatechanges.c
r2369b10 rf39f667a 31 31 * _Scheduler_SMP_Node_change_state() in case RTEMS_DEBUG is defined. 32 32 */ 33 const bool _Scheduler_SMP_Node_valid_state_changes[ 4 ][ 4 ] = { 34 /* BLOCKED SCHEDULED READY IN THE AIR */ 35 /* BLOCKED */ { false, true, true, false }, 36 /* SCHEDULED */ { false, false, true, true }, 37 /* READY */ { true, true, false, false }, 38 /* IN THE AIR */ { true, true, true, false } 33 const bool _Scheduler_SMP_Node_valid_state_changes[ 3 ][ 3 ] = { 34 /* FROM / TO BLOCKED SCHEDULED READY */ 35 /* BLOCKED */ { false, true, true }, 36 /* SCHEDULED */ { true, false, true }, 37 /* READY */ { true, true, false } 39 38 }; -
cpukit/score/src/threadchangepriority.c
r2369b10 rf39f667a 30 30 ) 31 31 { 32 const Scheduler_Control *scheduler = _Scheduler_Get( the_thread );33 ISR_Level level;34 States_Control state, original_state;35 36 /*37 * Save original state38 */39 original_state = the_thread->current_state;40 41 /*42 * Set a transient state for the thread so it is pulled off the Ready chains.43 * This will prevent it from being scheduled no matter what happens in an44 * ISR.45 */46 _Thread_Set_transient( the_thread );47 48 32 /* 49 33 * Do not bother recomputing all the priority related information if 50 34 * we are not REALLY changing priority. 51 35 */ 52 if ( the_thread->current_priority != new_priority ) 53 _Thread_Set_priority( the_thread, new_priority ); 36 if ( the_thread->current_priority != new_priority ) { 37 ISR_Level level; 38 const Scheduler_Control *scheduler; 54 39 55 _ISR_Disable( level );40 _ISR_Disable( level ); 56 41 57 /* 58 * If the thread has more than STATES_TRANSIENT set, then it is blocked, 59 * If it is blocked on a thread queue, then we need to requeue it. 60 */ 61 state = the_thread->current_state; 62 if ( state != STATES_TRANSIENT ) { 63 /* Only clear the transient state if it wasn't set already */ 64 if ( ! _States_Is_transient( original_state ) ) 65 the_thread->current_state = _States_Clear( STATES_TRANSIENT, state ); 42 scheduler = _Scheduler_Get( the_thread ); 43 the_thread->current_priority = new_priority; 66 44 67 /*68 * The thread may have new blocking states added by interrupt service69 * routines after the change into the transient state. This will not70 * result in a _Scheduler_Block() operation. Make sure we select an heir71 * now.72 */73 _Scheduler_Schedule( scheduler, the_thread);45 if ( _States_Is_ready( the_thread->current_state ) ) { 46 _Scheduler_Change_priority( 47 scheduler, 48 the_thread, 49 new_priority, 50 prepend_it 51 ); 74 52 53 _ISR_Flash( level ); 54 55 /* 56 * We altered the set of thread priorities. So let's figure out 57 * who is the heir and if we need to switch to them. 58 */ 59 scheduler = _Scheduler_Get( the_thread ); 60 _Scheduler_Schedule( scheduler, the_thread ); 61 } else { 62 _Scheduler_Update( scheduler, the_thread ); 63 } 75 64 _ISR_Enable( level ); 76 if ( _States_Is_waiting_on_thread_queue( state ) ) { 77 _Thread_queue_Requeue( the_thread->Wait.queue, the_thread ); 78 } 79 return; 65 66 _Thread_queue_Requeue( the_thread->Wait.queue, the_thread ); 80 67 } 81 82 /* Only clear the transient state if it wasn't set already */83 if ( ! _States_Is_transient( original_state ) ) {84 /*85 * Interrupts are STILL disabled.86 * We now know the thread will be in the READY state when we remove87 * the TRANSIENT state. So we have to place it on the appropriate88 * Ready Queue with interrupts off.89 */90 the_thread->current_state = _States_Clear( STATES_TRANSIENT, state );91 92 if ( prepend_it )93 _Scheduler_Enqueue_first( scheduler, the_thread );94 else95 _Scheduler_Enqueue( scheduler, the_thread );96 }97 98 _ISR_Flash( level );99 100 /*101 * We altered the set of thread priorities. So let's figure out102 * who is the heir and if we need to switch to them.103 */104 _Scheduler_Schedule( scheduler, the_thread );105 106 _ISR_Enable( level );107 68 } -
doc/user/glossary.texi
r2369b10 rf39f667a 278 278 A special low priority task which assumes 279 279 control of the CPU when no other task is able to execute. 280 281 @item in the air task282 A task is @dfn{in the air} if it is in a transient state and has a processor283 assigned. The next scheduler operation will turn it into a blocked, ready or284 scheduled task. This state is specific to SMP configurations.285 280 286 281 @item interface -
testsuites/sptests/Makefile.am
r2369b10 rf39f667a 51 51 _SUBDIRS += sptls01 52 52 _SUBDIRS += spintrcritical20 53 _SUBDIRS += spintrcritical1954 53 _SUBDIRS += spcontext01 55 54 _SUBDIRS += spfatal26 -
testsuites/sptests/configure.ac
r2369b10 rf39f667a 51 51 sptls01/Makefile 52 52 spintrcritical20/Makefile 53 spintrcritical19/Makefile54 53 spcontext01/Makefile 55 54 spfatal26/Makefile
Note: See TracChangeset
for help on using the changeset viewer.