summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src (follow)
Commit message (Collapse)AuthorAgeFilesLines
* score: Rename SMP broadcast message functionDaniel Cederman2014-08-221-1/+1
| | | | Change message type to unsigned long to match other SMP message functions.
* score: Add function to send a SMP message to a set of CPUsDaniel Cederman2014-08-221-0/+16
|
* score: PR2179: Fix initially locked PI mutexSebastian Huber2014-08-201-4/+11
|
* rbtree: Simplify _RBTree_Extract()Sebastian Huber2014-08-071-8/+10
|
* rbtree: Simplify insert and extractSebastian Huber2014-08-072-25/+39
| | | | | | | Simplify _RBTree_Insert() and _RBTree_Extract(). Remove more superfluous NULL pointer checks. Change _RBTree_Is_root() to use only the node. Add parent parameter to _RBTree_Sibling(). Delete _RBTree_Grandparent() and _RBTree_Parent_sibling().
* rbtree: Add and use RBTree_Compare_resultSebastian Huber2014-08-054-5/+16
|
* Add and use RTEMS_CONTAINER_OF()Sebastian Huber2014-08-056-18/+19
|
* rbtree: Update maximum node in LIFO orderSebastian Huber2014-07-261-2/+2
| | | | | | The test sptests/sp35 showed a NULL pointer access due to an invalid maximum node field (e.g. a tree with one element and NULL as the maximum node).
* coretod*.c: Fix Doxygen group and comment formattingJoel Sherrill2014-07-235-14/+14
|
* Add _TOD_Adjust to SCORE TOD Handler.Joel Sherrill2014-07-231-0/+51
| | | | | | | | This lays the proper structure for doing future work on time adjustment algorithms. Any TOD adjustments should be requested at the API level and performed at the SCORE level. Additionally updated a test.
* rbtree: Do not set node off-tree in extractSebastian Huber2014-07-221-3/+0
|
* rbtree: Remove superfluous NULL pointer checksSebastian Huber2014-07-223-19/+0
|
* rbtree: FormatSebastian Huber2014-07-226-117/+147
|
* Use Shared Method for Thread Unblock CleanupJoel Sherrill2014-07-153-60/+45
| | | | | | | | | | | When a thread is removed from a thread queue or is unblocked by receiving an event, the same actions are required. + timeout watchdog canceled, + thread must be unblocked, and + (MP only) proxy cleaned up This patch makes sure there is only one copy of this code.
* Thread Queue: Merge discipline subroutines into main methodsJoel Sherrill2014-07-1514-539/+216
| | | | | | | | | | | There was a lot of duplication between the discipline subroutines. With the transition to RBTrees for priority discipline, there were only a few lines of source code manipulating the data structure for FIFO and priority. Thus is made sense to fold these back into the main methods. As part of doing this all of the tests for discipline were changed to be in the same order.
* Thread Queue Priority Discipline Reimplemented with RBTreeJoel Sherrill2014-07-156-259/+69
|
* rbtree: Reduce RBTree_Control sizeSebastian Huber2014-07-156-51/+45
| | | | | | | | | | | | Remove compare function and is unique indicator from the control structure. Rename RBTree_Compare_function to RBTree_Compare. Rename rtems_rbtree_compare_function to rtems_rbtree_compare. Provide C++ compatible initializers. Add compare function and is unique indicator to _RBTree_Find(), _RBTree_Insert(), rtems_rbtree_find() and rtems_rbtree_insert(). Remove _RBTree_Is_unique() and rtems_rbtree_is_unique(). Remove compare function and is unique indicator from _RBTree_Initialize_empty() and rtems_rbtree_initialize_empty().
* scheduleredfunblock.c: Correct spacingJoel Sherrill2014-07-141-1/+1
|
* score: Scheduler helping proto for affinity schedSebastian Huber2014-07-111-0/+12
| | | | | | | | | | | The priority affinity scheduler has the nice property that it can produce more than one scheduled to ready state change in one operation. Each scheduled to ready state change may lead to one thread in need for help. Since it is currently only possible to return at most one thread in need for help, we have a problem here. A solution might be to move the check for migrations into the ask for help mechanism.
* score: Fix scheduler helping implementationSebastian Huber2014-07-103-57/+16
| | | | | Do not extract the idle threads from the ready set so that there is always a thread available for comparison.
* score: Fix assertionsSebastian Huber2014-07-101-1/+4
|
* score: Implement scheduler helping protocolSebastian Huber2014-07-0911-22/+266
| | | | | | | | | | | | | | | | | | | | | | | | | The following scheduler operations return a thread in need for help - unblock, - change priority, and - yield. A thread in need for help is a thread that encounters a scheduler state change from scheduled to ready or a thread that cannot be scheduled in an unblock operation. Such a thread can ask threads which depend on resources owned by this thread for help. Add a new ask for help scheduler operation. This operation is used by _Scheduler_Ask_for_help() to help threads in need for help returned by the operations mentioned above. This operation is also used by _Scheduler_Thread_change_resource_root() in case the root of a resource sub-tree changes. A use case is the ownership change of a resource. In case it is not possible to schedule a thread in need for help, then the corresponding scheduler node will be placed into the set of ready scheduler nodes of the scheduler instance. Once a state change from ready to scheduled happens for this scheduler node it may be used to schedule the thread in need for help.
* schedulerpriorityaffinitysmp.c: Add period at end of sentenceJoel Sherrill2014-07-081-1/+1
|
* score: Need for help indicator for scheduler opsSebastian Huber2014-07-0813-76/+121
| | | | | | | | | | | | | Return a thread in need for help for the following scheduler operations - unblock, - change priority, and - yield. A thread in need for help is a thread that encounters a scheduler state change from scheduled to ready or a thread that cannot be scheduled in an unblock operation. Such a thread can ask threads which depend on resources owned by this thread for help.
* score: Rename *_Node_get() to *_Thread_get_node()Sebastian Huber2014-07-0818-25/+25
| | | | | | This emphasizes that the scheduler node of a thread is returned and this is not a function working with scheduler nodes like the other *_Node_*() functions.
* score: Simplify SMP processor allocationSebastian Huber2014-07-083-21/+16
| | | | Avoid copy and paste and set the scheduler node state in one place.
* score: Rename _Scheduler_SMP_Update_heir()Sebastian Huber2014-07-081-1/+1
| | | | | | Rename and move _Scheduler_SMP_Update_heir() to _Thread_Dispatch_update_heir() since this function is not scheduler specific.
* score: Add PER_CPU_OFFSET_EXECUTINGSebastian Huber2014-07-011-0/+10
| | | | | Add PER_CPU_OFFSET_HEIR. Move Per_CPU_Control::executing and Per_CPU_Control::heir for easy offset calculation.
* score: Fix _Thread_Start_multitasking() on SMPSebastian Huber2014-06-241-0/+13
| | | | | | | | | | The _CPU_Context_Restart_self() implementations usually assume that self context is executing. FIXME: We have a race condition in _Thread_Start_multitasking() in case another thread already performed scheduler operations and moved the heir thread to another processor. The time frame for this is likely too small to be practically relevant.
* score: Fix thread deletion on SMPSebastian Huber2014-06-231-5/+5
| | | | | | Close the thread object in _Thread_Make_zombie() so that all blocking operations that use _Thread_Get() in the corresponding release directive can find a terminating thread and can complete the operation.
* score: Decouple thread and scheduler nodes on SMPSebastian Huber2014-06-234-147/+171
| | | | | | | Add a chain node to the scheduler node to decouple the thread and scheduler nodes. It is now possible to enqueue a thread in a thread wait queue and use its scheduler node at the same for other threads, e.g. a resouce owner.
* score: Use chain nodes for ready queue supportSebastian Huber2014-06-233-5/+5
| | | | | This reduces the API to the minimum data structures to maximize the re-usability.
* score: Collect scheduler related fields in TCBSebastian Huber2014-06-231-3/+2
| | | | | Add Thread_Scheduler_control to collect scheduler related fields of the TCB.
* score: Remove scheduler parameter from most opsSebastian Huber2014-06-237-17/+10
| | | | | | | | | | | | | Remove the scheduler parameter from most high level scheduler operations like - _Scheduler_Block(), - _Scheduler_Unblock(), - _Scheduler_Change_priority(), - _Scheduler_Update_priority(), - _Scheduler_Release_job(), and - _Scheduler_Yield(). This simplifies the scheduler operations usage.
* score: Fix statement with no effectSebastian Huber2014-06-201-1/+1
|
* score: Fix _Thread_Delay_ended() on SMPSebastian Huber2014-06-201-20/+10
| | | | | | | | | | | | | | | | Suppose we have two tasks A and B and two processors. Task A is about to delete task B. Now task B calls rtems_task_wake_after(1) on the other processor. Task B will block on the Giant lock. Task A progresses with the task B deletion until it has to wait for termination. Now task B obtains the Giant lock, sets its state to STATES_DELAYING, initializes its watchdog timer and waits. Eventually _Thread_Delay_ended() is called, but now _Thread_Get() returned NULL since the thread is already marked as deleted. Thus task B remained forever in the STATES_DELAYING state. Instead of passing the thread identifier use the thread control block directly via the watchdog user argument. This makes _Thread_Delay_ended() also a bit more efficient.
* score: PR2181: Add _Thread_Yield()Sebastian Huber2014-06-127-48/+70
| | | | | | | | | | | | | | | | | | | The _Scheduler_Yield() was called by the executing thread with thread dispatching disabled and interrupts enabled. The rtems_task_suspend() is explicitly allowed in ISRs: http://rtems.org/onlinedocs/doc-current/share/rtems/html/c_user/Interrupt-Manager-Directives-Allowed-from-an-ISR.html#Interrupt-Manager-Directives-Allowed-from-an-ISR Unlike the other scheduler operations the locking was performed inside the operation. This lead to the following race condition. Suppose a ISR suspends the executing thread right before the yield scheduler operation. Now the executing thread is not longer in the set of ready threads. The typical scheduler operations did not check the thread state and will now extract the thread again and enqueue it. This corrupted data structures. Add _Thread_Yield() and do the scheduler yield operation with interrupts disabled. This has a negligible effect on the interrupt latency.
* score: Make functions inlineSebastian Huber2014-06-121-132/+0
| | | | | | These functions are used only via the function pointers in the generic SMP scheduler implementation. Provide them as static inline so that the compiler can optimize more easily.
* score: Move NULL pointer check to order functionSebastian Huber2014-06-121-2/+26
| | | | This helps to avoid untestable code for the normal SMP schedulers.
* score: Fix warningsSebastian Huber2014-06-121-2/+1
|
* Add SMP Priority Scheduler with AffinityJoel Sherrill2014-06-113-32/+520
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This scheduler attempts to account for needed thread migrations caused as a side-effect of a thread state, affinity, or priority change operation. This scheduler has its own allocate_processor handler named _Scheduler_SMP_Allocate_processor_exact() because _Scheduler_SMP_Allocate_processor() attempts to prevent an executing thread from moving off its current CPU without considering affinity. Without this, the scheduler makes all the right decisions and then they are discarded at the end. ==Side Effects of Adding This Scheduler== Added Thread_Control * parameter to Scheduler_SMP_Get_highest_ready type so methods looking for the highest ready thread can filter by the processor on which the thread blocking resides. This allows affinity to be considered. Simple Priority SMP and Priority SMP ignore this parameter. + Added get_lowest_scheduled argument to _Scheduler_SMP_Enqueue_ordered(). + Added allocate_processor argument to the following methods: - _Scheduler_SMP_Block() - _Scheduler_SMP_Enqueue_scheduled_ordered() - _Scheduler_SMP_Enqueue_scheduled_ordered() + schedulerprioritysmpimpl.h is a new file with prototypes for methods which were formerly static in schedulerprioritysmp.c but now need to be public to be shared with this scheduler. NOTE: _Scheduler_SMP_Get_lowest_ready() appears to have a path which would allow it to return a NULL. Previously, _Scheduler_SMP_Enqueue_ordered() would have asserted on it. If it cannot return a NULL, _Scheduler_SMP_Get_lowest_ready() should have an assertions.
* score: _Per_CPU_State_wait_for_non_initial_state()Sebastian Huber2014-06-051-0/+56
| | | | | Replace _Per_CPU_State_wait_for_ready_to_start_multitasking() with _Per_CPU_State_wait_for_non_initial_state(). Implement this function.
* score: Rename _Scheduler_Update()Sebastian Huber2014-06-046-14/+24
| | | | | | Rename _Scheduler_Update() to _Scheduler_Update_priority(). Add parameter for the new thread priority to avoid direct usage of Thread_Control::current_priority in the scheduler operation.
* score: Replace _Scheduler_Allocate/Free()Sebastian Huber2014-06-049-39/+47
| | | | | | | | Replace _Scheduler_Allocate() with _Scheduler_Node_initialize(). Remove the return status and thus the node initialization must be always successful. Rename _Scheduler_Free() to _Scheduler_Node_destroy().
* score: Add resource node to thread control blockSebastian Huber2014-06-031-0/+2
|
* score: Add and use _Thread_Owns_resources()Sebastian Huber2014-06-032-2/+2
|
* score: Add Resource HandlerSebastian Huber2014-06-031-0/+106
| | | | | | | | | | A resource is something that has at most one owner at a time and may have multiple rivals in case an owner is present. The owner and rivals are impersonated via resource nodes. A resource is represented via the resource control structure. The resource controls and nodes are organized as trees. It is possible to detect deadlocks via such a resource tree. The _Resource_Iterate() function can be used to iterate through such a resource tree starting at a top node.
* score: _Scheduler_Set_affinity()Sebastian Huber2014-06-021-35/+17
| | | | | Do not change the scheduler with this function. Documentation. Coding style.
* score: _Scheduler_Get_affinity()Sebastian Huber2014-06-021-23/+21
| | | | Drop scheduler parameter. Coding style.
* score: Fix race condition in SMP startupSebastian Huber2014-05-261-1/+8
| | | | | | | | | | | | | | Do not use the Per_CPU_Control::started in _SMP_Start_multitasking_on_secondary_processor() since this field may be not up to date when a secondary processor reads it. Use the read-only scheduler assignment instead. Add a new fatal error SMP_FATAL_MULTITASKING_START_ON_INVALID_PROCESSOR. This prevents out-of-bounds access. It is currently not possible to test these fatal errors. One option would be to fake values of the _CPU_SMP_Get_current_processor(), but unfortunately this function is inline on some architectures.