32 #include <rtems/config.h> 34 #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) 40 #if defined(RTEMS_SMP) 47 unsigned int pin_level;
53 && ( pin_level & THREAD_PIN_PREEMPTION ) == 0
80 if ( home_scheduler != pinned_scheduler ) {
129 scheduler_node = SCHEDULER_NODE_OF_THREAD_SCHEDULER_NODE( node );
145 }
while ( node != tail );
148 static bool _Thread_Can_ask_for_help(
const Thread_Control *executing )
155 static ISR_Level _Thread_Preemption_intervention(
161 #if defined(RTEMS_SMP) 164 level = _Thread_Check_pinning( executing, cpu_self, level );
166 _Per_CPU_Acquire( cpu_self, &lock_context );
176 _Per_CPU_Release( cpu_self, &lock_context );
179 _Thread_Ask_for_help( the_thread );
182 _Per_CPU_Acquire( cpu_self, &lock_context );
185 _Per_CPU_Release( cpu_self, &lock_context );
193 static void _Thread_Post_switch_cleanup(
Thread_Control *executing )
195 #if defined(RTEMS_SMP) 199 if ( !_Thread_Can_ask_for_help( executing ) ) {
211 scheduler_node = SCHEDULER_NODE_OF_THREAD_SCHEDULER_NODE( node );
223 }
while ( node != tail );
233 Chain_Control *chain = &executing->Post_switch_actions.Chain;
238 static void _Thread_Run_post_switch_actions(
Thread_Control *executing )
244 _Thread_Post_switch_cleanup( executing );
245 action = _Thread_Get_post_switch_action( executing );
247 while ( action != NULL ) {
250 ( *action->handler )( executing, action, &lock_context );
253 action = _Thread_Get_post_switch_action( executing );
265 #if defined(RTEMS_SCORE_ROBUST_THREAD_DISPATCH) 268 #
if defined(RTEMS_SMP) && CPU_ENABLE_ROBUST_THREAD_DISPATCH ==
FALSE 281 level = _Thread_Preemption_intervention( executing, cpu_self, level );
289 if ( heir == executing )
296 if ( heir->
budget_algorithm == THREAD_CPU_BUDGET_ALGORITHM_RESET_TIMESLICE )
301 #if !defined(RTEMS_SMP) 307 #if defined(RTEMS_SMP) 316 cpu_self = _Per_CPU_Get();
328 _Thread_Run_post_switch_actions( executing );
338 cpu_self = _Per_CPU_Get();
366 if ( disable_level == 1 ) {
static __inline__ const Scheduler_Control * _Scheduler_Get_by_CPU(const Per_CPU_Control *cpu)
Gets the scheduler for the cpu.
static __inline__ Chain_Node * _Chain_First(const Chain_Control *the_chain)
Returns pointer to chain's first node.
#define rtems_configuration_get_ticks_per_timeslice()
Returns the clock ticks per timeslice configured for this application.
static __inline__ void _Scheduler_Acquire_critical(const Scheduler_Control *scheduler, ISR_lock_Context *lock_context)
Acquires the scheduler instance inside a critical section (interrupts disabled).
#define _ISR_Local_disable(_level)
Disables interrupts on this processor.
static __inline__ Scheduler_Node * _Thread_Scheduler_get_node_by_index(const Thread_Control *the_thread, size_t scheduler_index)
Gets the thread's scheduler node by index.
void(* reconsider_help_request)(const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
Reconsider help operation.
void _Thread_Dispatch_direct(Per_CPU_Control *cpu_self)
Directly do a thread dispatch.
struct _Thread_Control * executing
This is the thread executing on this processor.
static __inline__ const Scheduler_Control * _Thread_Scheduler_get_home(const Thread_Control *the_thread)
Gets the home scheduler of the thread.
#define RTEMS_PREDICT_FALSE(_exp)
Returns the value of the specified integral expression and tells the compiler that the predicted valu...
static __inline__ const bool _SMP_Need_inter_processor_interrupts(void)
Indicate if inter-processor interrupts are needed.
Data Related to the Management of Processor Interrupt Levels.
Inlined Routines Associated with the Manipulation of the Scheduler.
Constants and Structures Related with Thread Dispatch.
#define _ISR_Is_enabled(_level)
Returns true if interrupts are enabled in the specified interrupt level, otherwise returns false...
This header file defines parts of the application configuration information API.
#define CHAIN_DEFINE_EMPTY(name)
Chain definition for an empty chain with designator name.
static __inline__ Chain_Node * _Chain_Get_first_unprotected(Chain_Control *the_chain)
Gets the first node (unprotected).
static void _Profiling_Thread_dispatch_enable(Per_CPU_Control *cpu, uint32_t new_thread_dispatch_disable_level)
Enables the thread dispatch.
Thread_Scheduler_control Scheduler
Scheduler related control.
Chain_Control _User_extensions_Switches_list
List of active task switch extensions.
void _Thread_Do_dispatch(Per_CPU_Control *cpu_self, ISR_Level level)
Performs a thread dispatch on the current processor.
User Extension Handler API.
static __inline__ void _Thread_State_release(Thread_Control *the_thread, ISR_lock_Context *lock_context)
Releases the lock context and enables interrupts.
struct Scheduler_Node::@19 Thread
Block to register and manage this scheduler node in the thread control block of the owner of this sch...
Chain_Control Threads_in_need_for_help
Chain of threads in need for help.
static __inline__ void _Thread_Restore_fp(Thread_Control *executing)
Restores the executing thread's floating point area.
size_t helping_nodes
Count of nodes scheduler nodes minus one.
static void _User_extensions_Thread_switch(Thread_Control *executing, Thread_Control *heir)
Switches the thread from the executing to the heir.
Information for the Assert Handler.
static __inline__ void _Scheduler_Release_critical(const Scheduler_Control *scheduler, ISR_lock_Context *lock_context)
Releases the scheduler instance inside a critical section (interrupts disabled).
Thread_CPU_budget_algorithms budget_algorithm
static __inline__ void _Thread_Save_fp(Thread_Control *executing)
Checks if the floating point context of the thread is currently loaded in the floating point unit...
static __inline__ void _Chain_Prepend_unprotected(Chain_Control *the_chain, Chain_Node *the_node)
Prepends a node (unprotected).
int pin_level
The thread pinning to current processor level.
static __inline__ Chain_Node * _Chain_Next(const Chain_Node *the_node)
Returns pointer to the next node from this node.
#define _ISR_Local_enable(_level)
Enables interrupts on this processor.
#define THREAD_OF_SCHEDULER_HELP_NODE(node)
static __inline__ void _Chain_Extract_unprotected(Chain_Node *the_node)
Extracts this node (unprotected).
void(* unblock)(const Scheduler_Control *, Thread_Control *, Scheduler_Node *)
static __inline__ void _Scheduler_Block(Thread_Control *the_thread)
Blocks a thread with respect to the scheduler.
void _Thread_Dispatch_enable(Per_CPU_Control *cpu_self)
Enables thread dispatching.
const struct _Scheduler_Control * pinned_scheduler
The pinned scheduler of this thread.
volatile bool dispatch_necessary
This is set to true when this processor needs to run the thread dispatcher.
Chain_Control Scheduler_nodes
Scheduler nodes immediately available to the schedulers for this thread.
#define _Context_Switch(_executing, _heir)
Perform context switch.
static __inline__ const Scheduler_Control * _Scheduler_Node_get_scheduler(const Scheduler_Node *node)
Gets the scheduler of the node.
void _Thread_Dispatch(void)
Performs a thread dispatch if necessary.
static void _Profiling_Thread_dispatch_disable(Per_CPU_Control *cpu, uint32_t previous_thread_dispatch_disable_level)
Disables the thread dispatch if the previous thread dispatch disable level is zero.
#define RTEMS_SCORE_ROBUST_THREAD_DISPATCH
Enables a robust thread dispatch.
Scheduler_Operations Operations
The scheduler operations.
Scheduler node for per-thread data.
volatile uint32_t thread_dispatch_disable_level
The thread dispatch critical section nesting counter which is used to prevent context switches at ino...
void _Internal_error(Internal_errors_Core_list core_error) RTEMS_NO_RETURN
Terminates the system with an INTERNAL_ERROR_CORE fatal source and the specified core error code...
Inlined Routines from the Thread Handler.
void(* pin)(const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node, struct Per_CPU_Control *cpu)
Pin thread operation.
bool(* ask_for_help)(const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
Ask for help operation.
#define FALSE
If FALSE is undefined, then FALSE is defined to 0.
static __inline__ void _Chain_Set_off_chain(Chain_Node *node)
Sets off chain.
Local ISR lock context for acquire and release pairs.
static __inline__ bool _Thread_Is_ready(const Thread_Control *the_thread)
Checks if the thread is ready.
Context_Control Registers
static __inline__ bool _Chain_Is_empty(const Chain_Control *the_chain)
Checks if the chain is empty.
static __inline__ void _Thread_State_acquire(Thread_Control *the_thread, ISR_lock_Context *lock_context)
Disables interrupts and acquires the lock_context.
union Scheduler_Node::@19::@22 Scheduler_node
Node to add this scheduler node to Thread_Control::Scheduler::Scheduler_nodes or a temporary remove l...
Information Related to the RAM Workspace.
static __inline__ uint32_t _Scheduler_Get_index(const Scheduler_Control *scheduler)
Gets the index of the scheduler.
static __inline__ const Chain_Node * _Chain_Immutable_tail(const Chain_Control *the_chain)
Returns pointer to immutable chain tail.
#define _Assert(_e)
Assertion similar to assert() controlled via RTEMS_DEBUG instead of NDEBUG.
static __inline__ Thread_Control * _Thread_Get_heir_and_make_it_executing(Per_CPU_Control *cpu_self)
Gets the heir of the processor and makes it executing.
static __inline__ Chain_Node * _Chain_Get_unprotected(Chain_Control *the_chain)
Gets the first node (unprotected).