Changeset 7fe6d60 in rtems
- Timestamp:
- 07/15/22 07:16:04 (9 months ago)
- Branches:
- master
- Children:
- 4f94d47
- Parents:
- 0a1d2d7
- git-author:
- Sebastian Huber <sebastian.huber@…> (07/15/22 07:16:04)
- git-committer:
- Sebastian Huber <sebastian.huber@…> (07/26/22 09:26:22)
- Files:
-
- 1 added
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
cpukit/include/rtems/posix/priorityimpl.h
r0a1d2d7 r7fe6d60 85 85 * 86 86 * Let N be the maximum priority of this scheduler instance. The SuperCore 87 * priority zero is system reserved (PRIORITY_ PSEUDO_ISR). There are only87 * priority zero is system reserved (PRIORITY_MINIMUM). There are only 88 88 * N - 1 POSIX API priority levels since a thread at SuperCore priority N would 89 89 * never run because of the idle threads. This is necessary because GNAT maps -
cpukit/include/rtems/score/priority.h
r0a1d2d7 r7fe6d60 97 97 98 98 /** 99 * @brief The priority value of pseudo-ISR threads.100 *101 * Examples are the MPCI and timer server threads.102 */103 #define PRIORITY_PSEUDO_ISR PRIORITY_MINIMUM104 105 /**106 99 * @brief The default lowest (least important) thread priority value. 107 100 * -
cpukit/include/rtems/score/scheduleredfimpl.h
r0a1d2d7 r7fe6d60 40 40 41 41 #include <rtems/score/scheduleredf.h> 42 #include <rtems/score/scheduler impl.h>42 #include <rtems/score/scheduleruniimpl.h> 43 43 44 44 #ifdef __cplusplus … … 217 217 218 218 /** 219 * @brief Schedules the next ready thread as the heir. 220 * 221 * @param scheduler The scheduler instance to schedule the minimum of the context of. 222 * @param the_thread This parameter is not used. 223 * @param force_dispatch Indicates whether the current heir is blocked even if it is 224 * not set as preemptible. 225 */ 226 RTEMS_INLINE_ROUTINE void _Scheduler_EDF_Schedule_body( 227 const Scheduler_Control *scheduler, 228 Thread_Control *the_thread, 229 bool force_dispatch 219 * @brief Gets the highest priority ready thread of the scheduler. 220 * 221 * @param scheduler is the scheduler. 222 */ 223 RTEMS_INLINE_ROUTINE Thread_Control *_Scheduler_EDF_Get_highest_ready( 224 const Scheduler_Control *scheduler 230 225 ) 231 226 { … … 234 229 Scheduler_EDF_Node *node; 235 230 236 (void) the_thread;237 238 231 context = _Scheduler_EDF_Get_context( scheduler ); 239 232 first = _RBTree_Minimum( &context->Ready ); 240 233 node = RTEMS_CONTAINER_OF( first, Scheduler_EDF_Node, Node ); 241 234 242 _Scheduler_Update_heir( node->Base.owner, force_dispatch );235 return node->Base.owner; 243 236 } 244 237 -
cpukit/include/rtems/score/schedulerimpl.h
r0a1d2d7 r7fe6d60 670 670 671 671 /** 672 * @brief Blocks the thread.673 *674 * @param scheduler The scheduler instance.675 * @param the_thread The thread to block.676 * @param node The corresponding scheduler node.677 * @param extract Method to extract the thread.678 * @param schedule Method for scheduling threads.679 */680 RTEMS_INLINE_ROUTINE void _Scheduler_Generic_block(681 const Scheduler_Control *scheduler,682 Thread_Control *the_thread,683 Scheduler_Node *node,684 void ( *extract )(685 const Scheduler_Control *,686 Thread_Control *,687 Scheduler_Node *688 ),689 void ( *schedule )(690 const Scheduler_Control *,691 Thread_Control *,692 bool693 )694 )695 {696 ( *extract )( scheduler, the_thread, node );697 698 /* TODO: flash critical section? */699 700 if ( _Thread_Is_heir( the_thread ) ) {701 ( *schedule )( scheduler, the_thread, true );702 }703 }704 705 /**706 672 * @brief Gets the number of processors of the scheduler. 707 673 * … … 951 917 } 952 918 #endif 953 954 /**955 * @brief Updates the heir.956 *957 * @param[in, out] new_heir The new heir.958 * @param force_dispatch Indicates whether the dispatch happens also if the959 * currently running thread is set as not preemptible.960 */961 RTEMS_INLINE_ROUTINE void _Scheduler_Update_heir(962 Thread_Control *new_heir,963 bool force_dispatch964 )965 {966 Thread_Control *heir = _Thread_Heir;967 968 if ( heir != new_heir && ( heir->is_preemptible || force_dispatch ) ) {969 #if defined(RTEMS_SMP)970 /*971 * We need this state only for _Thread_Get_CPU_time_used_locked(). Cannot972 * use _Scheduler_Thread_change_state() since THREAD_SCHEDULER_BLOCKED to973 * THREAD_SCHEDULER_BLOCKED state changes are illegal for the real SMP974 * schedulers.975 */976 heir->Scheduler.state = THREAD_SCHEDULER_BLOCKED;977 new_heir->Scheduler.state = THREAD_SCHEDULER_SCHEDULED;978 #endif979 _Thread_Update_CPU_time_used( heir, _Thread_Get_CPU( heir ) );980 _Thread_Heir = new_heir;981 _Thread_Dispatch_necessary = true;982 }983 }984 919 985 920 /** -
cpukit/include/rtems/score/schedulerpriorityimpl.h
r0a1d2d7 r7fe6d60 42 42 #include <rtems/score/chainimpl.h> 43 43 #include <rtems/score/prioritybitmapimpl.h> 44 #include <rtems/score/scheduler impl.h>44 #include <rtems/score/scheduleruniimpl.h> 45 45 #include <rtems/score/thread.h> 46 46 … … 232 232 233 233 /** 234 * @brief Scheduling decision logic. 235 * 236 * This kernel routine implements scheduling decision logic 237 * for priority-based scheduling. 238 * 239 * @param[in, out] scheduler The scheduler instance. 240 * @param the_thread This parameter is unused. 241 * @param force_dispatch Indicates whether the dispatch happens also if 242 * the currently executing thread is set as not preemptible. 243 */ 244 RTEMS_INLINE_ROUTINE void _Scheduler_priority_Schedule_body( 245 const Scheduler_Control *scheduler, 246 Thread_Control *the_thread, 247 bool force_dispatch 234 * @brief Gets the highest priority ready thread of the scheduler. 235 * 236 * @param scheduler is the scheduler. 237 */ 238 RTEMS_INLINE_ROUTINE Thread_Control *_Scheduler_priority_Get_highest_ready( 239 const Scheduler_Control *scheduler 248 240 ) 249 241 { 250 242 Scheduler_priority_Context *context = 251 243 _Scheduler_priority_Get_context( scheduler ); 252 Thread_Control *heir = (Thread_Control *) 253 _Scheduler_priority_Ready_queue_first( 254 &context->Bit_map, 255 &context->Ready[ 0 ] 256 ); 257 258 ( void ) the_thread; 259 260 _Scheduler_Update_heir( heir, force_dispatch ); 244 245 return (Thread_Control *) _Scheduler_priority_Ready_queue_first( 246 &context->Bit_map, 247 &context->Ready[ 0 ] 248 ); 261 249 } 262 250 -
cpukit/include/rtems/score/schedulersimpleimpl.h
r0a1d2d7 r7fe6d60 40 40 #include <rtems/score/schedulersimple.h> 41 41 #include <rtems/score/chainimpl.h> 42 #include <rtems/score/scheduler impl.h>42 #include <rtems/score/scheduleruniimpl.h> 43 43 44 44 #ifdef __cplusplus … … 134 134 135 135 /** 136 * @brief Scheduling decision logic.136 * @brief Gets the highest priority ready thread of the scheduler. 137 137 * 138 * This kernel routine implements scheduling decision logic for the simple scheduler. 139 * 140 * @param[in, out] scheduler The scheduler instance. 141 * @param the_thread This parameter is unused. 142 * @param force_dispatch Indicates whether the dispatch happens also if 143 * the currently executing thread is set as not preemptible. 138 * @param scheduler is the scheduler. 144 139 */ 145 RTEMS_INLINE_ROUTINE void _Scheduler_simple_Schedule_body( 146 const Scheduler_Control *scheduler, 147 Thread_Control *the_thread, 148 bool force_dispatch 140 RTEMS_INLINE_ROUTINE Thread_Control *_Scheduler_simple_Get_highest_ready( 141 const Scheduler_Control *scheduler 149 142 ) 150 143 { 151 144 Scheduler_simple_Context *context = 152 145 _Scheduler_simple_Get_context( scheduler ); 153 Thread_Control *heir = (Thread_Control *) _Chain_First( &context->Ready );154 146 155 ( void ) the_thread; 156 157 _Scheduler_Update_heir( heir, force_dispatch ); 147 return (Thread_Control *) _Chain_First( &context->Ready ); 158 148 } 159 149 -
cpukit/rtems/src/timerserver.c
r0a1d2d7 r7fe6d60 174 174 175 175 if ( priority == RTEMS_TIMER_SERVER_DEFAULT_PRIORITY ) { 176 priority = PRIORITY_ PSEUDO_ISR;176 priority = PRIORITY_MINIMUM; 177 177 } 178 178 -
cpukit/score/src/mpci.c
r0a1d2d7 r7fe6d60 163 163 config.scheduler = &_Scheduler_Table[ 0 ]; 164 164 config.name = _Objects_Build_name( 'M', 'P', 'C', 'I' ); 165 config.priority = PRIORITY_ PSEUDO_ISR;165 config.priority = PRIORITY_MINIMUM; 166 166 config.is_fp = CPU_ALL_TASKS_ARE_FP; 167 167 config.stack_size = _Stack_Minimum() -
cpukit/score/src/scheduleredfblock.c
r0a1d2d7 r7fe6d60 48 48 ) 49 49 { 50 _Scheduler_ Generic_block(50 _Scheduler_uniprocessor_Block( 51 51 scheduler, 52 52 the_thread, 53 53 node, 54 54 _Scheduler_EDF_Extract_body, 55 _Scheduler_EDF_ Schedule_body55 _Scheduler_EDF_Get_highest_ready 56 56 ); 57 57 } -
cpukit/score/src/scheduleredfchangepriority.c
r0a1d2d7 r7fe6d60 72 72 _Scheduler_EDF_Extract( context, the_node ); 73 73 _Scheduler_EDF_Enqueue( context, the_node, insert_priority ); 74 _Scheduler_EDF_Schedule_body( scheduler, the_thread, false ); 74 _Scheduler_uniprocessor_Schedule( 75 scheduler, 76 _Scheduler_EDF_Get_highest_ready 77 ); 75 78 } -
cpukit/score/src/scheduleredfschedule.c
r0a1d2d7 r7fe6d60 47 47 ) 48 48 { 49 _Scheduler_EDF_Schedule_body( scheduler, the_thread, false ); 49 _Scheduler_uniprocessor_Schedule( 50 scheduler, 51 _Scheduler_EDF_Get_highest_ready 52 ); 50 53 } -
cpukit/score/src/scheduleredfunblock.c
r0a1d2d7 r7fe6d60 63 63 the_node->priority = priority; 64 64 _Scheduler_EDF_Enqueue( context, the_node, insert_priority ); 65 66 /* 67 * If the thread that was unblocked is more important than the heir, 68 * then we have a new heir. This may or may not result in a 69 * context switch. 70 * 71 * Normal case: 72 * If the current thread is preemptible, then we need to do 73 * a context switch. 74 * Pseudo-ISR case: 75 * Even if the thread isn't preemptible, if the new heir is 76 * a pseudo-ISR system task, we need to do a context switch. 77 */ 78 if ( priority < _Thread_Get_priority( _Thread_Heir ) ) { 79 _Scheduler_Update_heir( 80 the_thread, 81 priority == ( SCHEDULER_EDF_PRIO_MSB | PRIORITY_PSEUDO_ISR ) 82 ); 83 } 65 _Scheduler_uniprocessor_Unblock( scheduler, the_thread, priority ); 84 66 } -
cpukit/score/src/scheduleredfyield.c
r0a1d2d7 r7fe6d60 56 56 _Scheduler_EDF_Extract( context, the_node ); 57 57 _Scheduler_EDF_Enqueue( context, the_node, the_node->priority ); 58 _Scheduler_ EDF_Schedule_body( scheduler, the_thread, true);58 _Scheduler_uniprocessor_Yield( scheduler, _Scheduler_EDF_Get_highest_ready ); 59 59 } -
cpukit/score/src/schedulerpriorityblock.c
r0a1d2d7 r7fe6d60 50 50 ) 51 51 { 52 _Scheduler_ Generic_block(52 _Scheduler_uniprocessor_Block( 53 53 scheduler, 54 54 the_thread, 55 55 node, 56 56 _Scheduler_priority_Extract_body, 57 _Scheduler_priority_ Schedule_body57 _Scheduler_priority_Get_highest_ready 58 58 ); 59 59 } -
cpukit/score/src/schedulerprioritychangepriority.c
r0a1d2d7 r7fe6d60 97 97 } 98 98 99 _Scheduler_priority_Schedule_body( scheduler, the_thread, false ); 99 _Scheduler_uniprocessor_Schedule( 100 scheduler, 101 _Scheduler_priority_Get_highest_ready 102 ); 100 103 } -
cpukit/score/src/schedulerpriorityschedule.c
r0a1d2d7 r7fe6d60 47 47 ) 48 48 { 49 _Scheduler_priority_Schedule_body( scheduler, the_thread, false ); 49 _Scheduler_uniprocessor_Schedule( 50 scheduler, 51 _Scheduler_priority_Get_highest_ready 52 ); 50 53 } -
cpukit/score/src/schedulerpriorityunblock.c
r0a1d2d7 r7fe6d60 77 77 /* TODO: flash critical section? */ 78 78 79 /* 80 * If the thread that was unblocked is more important than the heir, 81 * then we have a new heir. This may or may not result in a 82 * context switch. 83 * 84 * Normal case: 85 * If the current thread is preemptible, then we need to do 86 * a context switch. 87 * Pseudo-ISR case: 88 * Even if the thread isn't preemptible, if the new heir is 89 * a pseudo-ISR system task, we need to do a context switch. 90 */ 91 if ( priority < _Thread_Get_priority( _Thread_Heir ) ) { 92 _Scheduler_Update_heir( the_thread, priority == PRIORITY_PSEUDO_ISR ); 93 } 79 _Scheduler_uniprocessor_Unblock( scheduler, the_thread, priority ); 94 80 } -
cpukit/score/src/schedulerpriorityyield.c
r0a1d2d7 r7fe6d60 60 60 } 61 61 62 _Scheduler_priority_Schedule_body( scheduler, the_thread, true ); 62 _Scheduler_uniprocessor_Yield( 63 scheduler, 64 _Scheduler_priority_Get_highest_ready 65 ); 63 66 } -
cpukit/score/src/schedulersimpleblock.c
r0a1d2d7 r7fe6d60 48 48 ) 49 49 { 50 _Scheduler_ Generic_block(50 _Scheduler_uniprocessor_Block( 51 51 scheduler, 52 52 the_thread, 53 53 node, 54 54 _Scheduler_simple_Extract, 55 _Scheduler_simple_ Schedule_body55 _Scheduler_simple_Get_highest_ready 56 56 ); 57 57 } -
cpukit/score/src/schedulersimplechangepriority.c
r0a1d2d7 r7fe6d60 61 61 _Scheduler_simple_Extract( scheduler, the_thread, node ); 62 62 _Scheduler_simple_Insert( &context->Ready, the_thread, new_priority ); 63 _Scheduler_simple_Schedule_body( scheduler, the_thread, false ); 63 _Scheduler_uniprocessor_Schedule( 64 scheduler, 65 _Scheduler_simple_Get_highest_ready 66 ); 64 67 } -
cpukit/score/src/schedulersimpleschedule.c
r0a1d2d7 r7fe6d60 47 47 ) 48 48 { 49 _Scheduler_simple_Schedule_body( scheduler, the_thread, false ); 49 _Scheduler_uniprocessor_Schedule( 50 scheduler, 51 _Scheduler_simple_Get_highest_ready 52 ); 50 53 } -
cpukit/score/src/schedulersimpleunblock.c
r0a1d2d7 r7fe6d60 59 59 insert_priority = SCHEDULER_PRIORITY_APPEND( priority ); 60 60 _Scheduler_simple_Insert( &context->Ready, the_thread, insert_priority ); 61 62 /* 63 * If the thread that was unblocked is more important than the heir, 64 * then we have a new heir. This may or may not result in a 65 * context switch. 66 * 67 * Normal case: 68 * If the current thread is preemptible, then we need to do 69 * a context switch. 70 * Pseudo-ISR case: 71 * Even if the thread isn't preemptible, if the new heir is 72 * a pseudo-ISR system task, we need to do a context switch. 73 */ 74 if ( priority < _Thread_Get_priority( _Thread_Heir ) ) { 75 _Scheduler_Update_heir( 76 the_thread, 77 priority == PRIORITY_PSEUDO_ISR 78 ); 79 } 61 _Scheduler_uniprocessor_Unblock( scheduler, the_thread, priority ); 80 62 } -
cpukit/score/src/schedulersimpleyield.c
r0a1d2d7 r7fe6d60 59 59 insert_priority = SCHEDULER_PRIORITY_APPEND( insert_priority ); 60 60 _Scheduler_simple_Insert( &context->Ready, the_thread, insert_priority ); 61 _Scheduler_simple_Schedule_body( scheduler, the_thread, false ); 61 _Scheduler_uniprocessor_Yield( 62 scheduler, 63 _Scheduler_simple_Get_highest_ready 64 ); 62 65 } -
spec/build/cpukit/librtemscpu.yml
r0a1d2d7 r7fe6d60 397 397 - cpukit/include/rtems/score/schedulersmpimpl.h 398 398 - cpukit/include/rtems/score/schedulerstrongapa.h 399 - cpukit/include/rtems/score/scheduleruniimpl.h 399 400 - cpukit/include/rtems/score/semaphoreimpl.h 400 401 - cpukit/include/rtems/score/smp.h -
testsuites/sptests/sptasknopreempt01/init.c
r0a1d2d7 r7fe6d60 2 2 3 3 /* 4 * Copyright ( c) 2015 embedded brains GmbH. All rights reserved.4 * Copyright (C) 2015, 2022 embedded brains GmbH 5 5 * 6 6 * Redistribution and use in source and binary forms, with or without … … 38 38 static void do_not_run(rtems_task_argument arg) 39 39 { 40 #if 041 40 rtems_test_assert(0); 42 #else43 did_run = true;44 rtems_task_suspend(RTEMS_SELF);45 #endif46 41 } 47 42 … … 65 60 66 61 /* 67 * This will start a pseudo interrupt task pre-empting the non-preemtive68 * executing task. Later the high priority do_not_run() task is scheduled.69 * See alsohttps://devel.rtems.org/ticket/2365.62 * This will start a task with a priority of PRIORITY_MINIMUM. Check that 63 * this task and the test task did not preempt the current task. See also 64 * https://devel.rtems.org/ticket/2365. 70 65 */ 71 66 sc = rtems_timer_initiate_server( … … 76 71 rtems_test_assert(sc == RTEMS_SUCCESSFUL); 77 72 78 /* This is probably a bug and not a feature */ 79 rtems_test_assert(did_run); 73 rtems_test_assert(!did_run); 80 74 81 75 sc = rtems_task_delete(task); … … 100 94 #define CONFIGURE_INIT_TASK_PRIORITY 2 101 95 96 #define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_NO_PREEMPT 97 102 98 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION 103 99
Note: See TracChangeset
for help on using the changeset viewer.