summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include/rtems/score/threadimpl.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* score: Rework thread priority managementSebastian Huber2016-09-211-94/+167
| | | | | | | | | | | | | | | | | | | | | | | | | Add priority nodes which contribute to the overall thread priority. The actual priority of a thread is now an aggregation of priority nodes. The thread priority aggregation for the home scheduler instance of a thread consists of at least one priority node, which is normally the real priority of the thread. The locking protocols (e.g. priority ceiling and priority inheritance), rate-monotonic period objects and the POSIX sporadic server add, change and remove priority nodes. A thread changes its priority now immediately, e.g. priority changes are not deferred until the thread releases its last resource. Replace the _Thread_Change_priority() function with * _Thread_Priority_perform_actions(), * _Thread_Priority_add(), * _Thread_Priority_remove(), * _Thread_Priority_change(), and * _Thread_Priority_update(). Update #2412. Update #2556.
* score: Introduce _Thread_Get_priority()Sebastian Huber2016-09-081-0/+18
| | | | Avoid direct access to thread internal data fields.
* score: Add scheduler node implementation headerSebastian Huber2016-09-081-0/+1
| | | | Update #2556.
* score: Move thread wait node to scheduler nodeSebastian Huber2016-09-081-6/+0
| | | | Update #2556.
* score: Introduce Thread_queue_Lock_contextSebastian Huber2016-09-081-35/+45
| | | | | | Introduce Thread_queue_Lock_context to contain the context necessary for thread queue lock and thread wait lock acquire/release operations to reduce the Thread_Control size.
* score: Simplify thread queue acquire/releaseSebastian Huber2016-09-081-4/+6
|
* score: Remove superfluous SMP debug supportSebastian Huber2016-09-071-13/+0
| | | | This information turned out to be useless in the last couple of months.
* score: Fix and simplify thread wait locksSebastian Huber2016-08-031-63/+72
| | | | | | | | | | There was a subtile race condition in _Thread_queue_Do_extract_locked(). It must first update the thread wait flags and then restore the default thread wait state. In the previous implementation this could lead under rare timing conditions to an ineffective _Thread_Wait_tranquilize() resulting to a corrupt system state. Update #2556.
* score: Turn thread lock into thread wait lockSebastian Huber2016-07-271-212/+306
| | | | | | | | | The _Thread_Lock_acquire() function had a potentially infinite run-time due to the lack of fairness at atomic operations level. Update #2412. Update #2556. Update #2765.
* score: Priority inherit thread queue operationsSebastian Huber2016-07-271-31/+0
| | | | | | | | | Move the priority change due to priority interitance to the thread queue enqueue operation to simplify the locking on SMP configurations. Update #2412. Update #2556. Update #2765.
* score: Split _Thread_Change_priority()Sebastian Huber2016-07-271-0/+10
| | | | | | Update #2412. Update #2556. Update #2765.
* score: FormatSebastian Huber2016-07-261-7/+6
|
* cpukit: Add and use Watchdog_Discipline.Gedare Bloom2016-07-251-4/+7
| | | | | | | | | Clock disciplines may be WATCHDOG_RELATIVE, WATCHDOG_ABSOLUTE, or WATCHDOG_NO_TIMEOUT. A discipline of WATCHDOG_RELATIVE with a timeout of WATCHDOG_NO_TIMEOUT is equivalent to a discipline of WATCHDOG_NO_TIMEOUT. updates #2732
* score: Next try to fix thread lock on SMPSebastian Huber2016-07-011-6/+16
|
* score: Avoid atomic fences for thread wait flagsSebastian Huber2016-06-301-12/+30
| | | | | The use of atomic fences is brittle and may break due to changes in different areas which is hard to manage.
* score: Fix thread lock on SMP configurationsSebastian Huber2016-06-301-8/+26
|
* score: Fix SMP message handlingSebastian Huber2016-06-291-14/+2
| | | | | | | | According to the C11 standard only atomic read-modify-write operations guarantee that the last value written in modification order is read, see "7.17.3 Order and consistency". Thus we must use a read-modify-write in _SMP_Inter_processor_interrupt_handler() to make sure we read an up-to-date message.
* score: Add thread priority to scheduler nodesSebastian Huber2016-06-221-0/+5
| | | | | | | | | | | | | | | | | | The thread priority is manifest in two independent areas. One area is the user visible thread priority along with a potential thread queue. The other is the scheduler. Currently, a thread priority update via _Thread_Change_priority() first updates the user visble thread priority and the thread queue, then the scheduler is notified if necessary. The priority is passed to the scheduler via a local variable. A generation counter ensures that the scheduler discards out-of-date priorities. This use of a local variable ties the update in these two areas close together. For later enhancements and the OMIP locking protocol implementation we need more flexibility. Add a thread priority information block to Scheduler_Node and synchronize priority value updates via a sequence lock on SMP configurations. Update #2556.
* score: Maybe fix _Thread_Lock_acquire()Sebastian Huber2016-06-021-37/+7
| | | | | | | The approach with the generation number was broken. The load/store of the current lock, the thread queue and the thread queue operations were not properly synchronized. Under certain conditions on a PowerPC T4240 old thread queue operations operated on a new thread queue (NULL pointer).
* score: Fix _Thread_Lock_acquire()Sebastian Huber2016-06-011-11/+12
| | | | | | | | | A read-modify-write operation is necessary to read the last value written. See for example C11 standard or Power ISA 2.07, Book II: Power ISA Virtual Environment Architecture, Section 1.6.3 Memory Coherence Required [Category: Memory Coherence] and Section 1.7.3 Atomic Update.
* score: _CORE_mutex_Check_dispatch_for_seize()Sebastian Huber2016-05-301-4/+4
| | | | | | | | | | | Move the safety check performed by _CORE_mutex_Check_dispatch_for_seize() out of the performance critical path and generalize it. Blocking on a thread queue with an unexpected thread dispatch disabled level is illegal in all system states. Add the expected thread dispatch disable level (which may be 1 or 2 depending on the operation) to Thread_queue_Context and use it in _Thread_queue_Enqueue_critical().
* score: Add Status_Control for all APIsSebastian Huber2016-05-261-14/+8
| | | | | | | | | | | Unify the status codes of the Classic and POSIX API to use the new enum Status_Control. This eliminates the Thread_Control::Wait::timeout_code field and the timeout parameter of _Thread_queue_Enqueue_critical() and _MPCI_Send_request_packet(). It gets rid of the status code translation tables and instead uses simple bit operations to get the status for a particular API. This enables translation of status code constants at compile time. Add _Thread_Wait_get_status() to avoid direct access of thread internal data structures.
* score: Move thread queue object supportSebastian Huber2016-05-251-20/+0
|
* mpci: Fix thread queue flush methodSebastian Huber2016-05-251-0/+19
| | | | | | | We must call the MP callout for proxies if we unblock them after a thread queue extraction. This was missing in _Thread_queue_Flush_critical(). Move thread remove timer and unblock code to new function _Thread_Remove_timer_and_unblock().
* Replace *_Get_interrupt_disable() with *_Get()Sebastian Huber2016-05-201-1/+1
| | | | | Uniformly use *_Get() to get an object by identifier with a lock context.
* score: Rename _Objects_Get_local()Sebastian Huber2016-05-201-1/+1
| | | | | | Rename _Objects_Get_local() into _Objects_Get(). Confusions with the previous _Objects_Get() function are avoided since the Objects_Locations parameter is gone.
* score: Rename _ISR_Disable() and _ISR_Enable()Sebastian Huber2016-05-201-1/+1
| | | | | | | | | Rename _ISR_Disable() into _ISR_Local_disable(). Rename _ISR_Enable() into _ISR_Local_enable(). Remove _Debug_Is_owner_of_giant(). This is a preparation to remove the Giant lock. Update #2555.
* score: Rename _ISR_Disable_without_giant()Sebastian Huber2016-05-201-2/+2
| | | | | | | | | Rename _ISR_Disable_without_giant() into _ISR_Local_disable(). Rename _ISR_Enable_without_giant() into _ISR_Local_enable(). This is a preparation to remove the Giant lock. Update #2555.
* score: Delete unused _Thread_Get()Sebastian Huber2016-05-201-26/+0
| | | | Update #2555.
* posix: Rework thread cancellationSebastian Huber2016-05-201-1/+8
| | | | | | | | Add Thread_Life_state::THREAD_LIFE_CHANGE_DEFERRED and rework the POSIX thread cancellation to use the thread life states. Update #2555. Update #2626.
* score: Avoid Giant lock for _Thread_Start()Sebastian Huber2016-05-201-16/+2
| | | | Update #2555.
* posix: Rework pthread_join()Sebastian Huber2016-05-201-2/+18
| | | | | | | | | Rework pthread_join() to use _Thread_Join(). Close #2402. Update #2555. Update #2626. Close #2714.
* score: Split _Thread_Restart()Sebastian Huber2016-05-201-27/+9
| | | | | | | | | | | Split _Thread_Restart() into _Thread_Restart_self() and _Thread_Restart_other(). Move content of existing _Thread_Restart_self() into new _Thread_Restart_self(). Avoid Giant lock for thread restart. _Thread_Restart_self() is a no-return function and used by _Thread_Global_construction(). Update #2555. Update #2626.
* score: Add _Thread_Clear_state_locked()Sebastian Huber2016-05-201-0/+5
| | | | | | | | This makes it possible to do thread state and thread life changes together under protection of the thread state lock. Update #2555. Update #2626.
* score: Add _Thread_Set_state_locked()Sebastian Huber2016-05-201-0/+5
| | | | | | | | This makes it possible to do thread state and thread life changes together under protection of the thread state lock. Update #2555. Update #2626.
* score: Add _Thread_Join() and _Thread_Cancel()Sebastian Huber2016-05-201-0/+9
| | | | | | | | Split _Thread_Close() into _Thread_Join() and _Thread_Cancel() to prepare for a re-use in pthread_join() and pthread_cancel(). Update #2555. Update #2626.
* score: Add Thread_Change_life()Sebastian Huber2016-05-201-3/+3
| | | | | | | | | Add _Thread_Change_life_locked() as a general function to alter the thread life state. Use it to implement _Thread_Set_life_protection() as a first step. Update #2555. Update #2626.
* score: Add _Thread_Exit()Sebastian Huber2016-05-201-0/+2
| | | | | | | | The goal is to make _Thread_Exit() a no-return function in follow up patches. Update #2555. Update #2626.
* score: Delete redundant thread life enumsSebastian Huber2016-05-201-1/+2
| | | | | | | This makes it easier to add more states in the future. Update #2555. Update #2626.
* score: Avoid Giant lock for scheduler set/getSebastian Huber2016-05-121-0/+8
| | | | Update #2555.
* score: Introduce thread state lockSebastian Huber2016-05-121-47/+51
| | | | Update #2556.
* score: Simplify _Thread_Get_interrupt_disable()Sebastian Huber2016-05-041-2/+1
| | | | Remove the object location parameter.
* score: Add _Thread_MP_Is_remote()Sebastian Huber2016-05-041-0/+21
|
* score: Simplify _Objects_Initialize_information()Sebastian Huber2016-04-211-4/+0
| | | | | | Remove unused supports_global parameter. Convert _Objects_Initialize_information() to a macro to avoid use of RTEMS_MULTIPROCESSING define for each caller.
* score: Delete Thread_Wait_information::idSebastian Huber2016-04-061-0/+36
| | | | | | | | | | | This field was only by the monitor in non-multiprocessing configurations. Add new field Thread_Wait_information::remote_id in multiprocessing configurations and use it for the remote procedure call thread queue. Add _Thread_Wait_get_id() to obtain the object identifier for debug and system information tools. Ensure the object layout via static asserts. Add test cases to sptests/spthreadq01.
* score: Fix multiprocessing thread proxiesSebastian Huber2016-03-291-0/+10
| | | | | | | We must provide thread queue heads for the thread wait information for each thread proxy (thread queue heads were introduced by d7665823b208daefb6855591d808e1f3075cedcb). The thread proxy must be allocated before the enqueue operation.
* rtems: Rework rate-monotonic schedulerSebastian Huber2016-03-221-1/+6
| | | | | | | | | | Use the default thread lock to protect rate-monotonic state changes. This avoids use of the Giant lock. Split rtems_rate_monotonic_period() body into several static functions. Introduce a new thread wait class THREAD_WAIT_CLASS_PERIOD for period objects to synchronize the blocking operation. Close #2631.
* score: C++ compatibilitySebastian Huber2016-03-181-1/+1
|
* score: Fix CPU time used by executing threadsSebastian Huber2016-03-171-47/+20
| | | | | | | | | | | | | | The CPU time used of a thread was previously maintained per-processor mostly during _Thread_Dispatch(). However, on SMP configurations the actual processor of a thread is difficult to figure out since thread dispatching is a highly asynchronous process (e.g. via inter-processor interrupts). Only the intended processor of a thread is known to the scheduler easily. Do the CPU usage accounting during thread heir updates in the context of the scheduler operations. Provide the function _Thread_Get_CPU_time_used() to get the CPU usage of a thread using proper locks to get a consistent value. Close #2627.
* score: Replace watchdog handler implementationSebastian Huber2016-03-041-3/+58
| | | | | | | | | Use a red-black tree instead of delta chains. Close #2344. Update #2554. Update #2555. Close #2606.